lspci reads PCI config space, and the kernel resumes a runtime-suspended device to serve that read. On a hybrid laptop the discrete GPU idles in D3cold, so the first lspci of a Hyprland config load spends over a second waking it — longer than the 1.5s budget Hyprland gives the whole load. The reload then fails at whichever line runs next, which is why the error pointed at default/hypr/apps/1password.lua rather than at nvidia.lua. Read the vendor, class, and device IDs from sysfs instead. Those are served from cached fields and never touch config space, so nothing wakes up. Classify by device ID while we're here: Turing is both the first generation with GSP firmware and the first at 0x1e00 or above, and Maxwell opens at 0x1340, one ID past the last Kepler part. Bounding the older detector at both ends keeps pre-Maxwell cards off the 580xx driver that cannot drive them, and picks up the Maxwell and Pascal parts the lspci name regex used to miss. omarchy-hw-nvidia was also checked in without its executable bit, which it needs now that nvidia.lua runs it. Fixes #6660 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
24 lines
894 B
Bash
Executable File
24 lines
894 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Detect whether the computer has an NVIDIA GPU without GSP firmware (Maxwell/Pascal/Volta).
|
|
|
|
# Bounded at both ends, because the callers install the 580xx driver on a match
|
|
# and it supports exactly this span. GSP firmware arrived with Turing, which is
|
|
# also where device IDs cross 0x1e00. Maxwell opens at 0x1340, one ID after the
|
|
# last Kepler part; anything older needs a legacy driver we don't package.
|
|
#
|
|
# Read the cached sysfs IDs rather than lspci, which reads PCI config space and
|
|
# resumes runtime-suspended GPUs.
|
|
pci_devices_path="${OMARCHY_PCI_DEVICES_PATH:-/sys/bus/pci/devices}"
|
|
|
|
shopt -s nullglob
|
|
|
|
for device in "$pci_devices_path"/*; do
|
|
[[ $(< "$device/vendor") == "0x10de" ]] || continue
|
|
[[ $(< "$device/class") == 0x03* ]] || continue
|
|
device_id=$(< "$device/device")
|
|
(( device_id >= 0x1340 && device_id < 0x1e00 )) && exit 0
|
|
done
|
|
|
|
exit 1
|