Repository navigation
Detect BCM43xx, T2, Vulkan, and NVIDIA via sysfs helpers - #12076
Chessing234 wants to merge 11 commits into
Conversation
The previous script grepped the same lspci snapshot twice.
The old lspci | grep -q path SIGPIPE'd on a long device list and looked like "no T2" under pipefail.
Both install scripts asked lspci the same question.
Three lspci greps used to wake every GPU once per vendor. NVIDIA stays with nvidia.sh.
lspci walks PCI config space and can resume a runtime-suspended GPU. Hyprland already uses the sysfs helper for the same question.
Automated AI review
Verified: The main issue is that the NVIDIA test cannot detect a broken install gate. One open PR also merges cleanly but stops working after this change.
|
Gate line in install/hardware/nvidia.sh |
Effect | Test |
|---|---|---|
if omarchy-hw-nvidia; then (PR) |
intended | passes |
if true; then |
enters the block on every machine | passes |
if omarchy-hw-nvidia-gsp; then |
skips 580xx installs (Maxwell, Pascal, Volta) | passes |
if lspci | grep -qi 'NVIDIA'; then |
back to lspci |
passes |
Impact: a regression in the only line this test is named for would go unnoticed.
Suggested change: run nvidia.sh against synthetic sysfs devices with omarchy-pkg-add stubbed, as vulkan-sysfs-test.sh does, and assert the package choice. Its hardcoded /etc writes would also need an override or a rewritten copy. At minimum, match the whole gate line (for example grep -qx 'if omarchy-hw-nvidia; then').
Open PR #11311 merges cleanly but its BCM4322 check stops firing
#11311 adds a BCM4322 branch to install/hardware/fix-bcm43xx.sh that tests echo "$pci_info" | grep -q "14e4:432b". This PR deletes the pci_info=$(lspci -nn) assignment. A three-way merge of both has no conflict markers, and install leaves run without nounset, so the branch silently never matches:
#11311 alone: pci_info=$(lspci -nn) -> 14e4:432b found -> b43-firmware requested from the AUR (when reachable)
#11311 + this PR: pci_info unset -> no match -> nothing installed, exit 0
A sandboxed run of the merged script with a synthetic 14e4:432b device exited 0 and requested no firmware package. hw-bcm43xx-test.sh would not catch this, because the merged file contains no lspci text.
Impact: if both land, fresh installs on BCM4322 machines never request b43-firmware, and nothing reports an error.
Suggested change: if both PRs are accepted, move the BCM4322 check to a sysfs read (for example a helper like omarchy-hw-bcm43xx) as part of combining them.
Vulkan selection changes that the PR does not describe
| Machine | Old (VGA|Display).*<vendor> regex |
New PCI class 0x03* + vendor ID |
|---|---|---|
| Synthetic T2 Mac (Intel iGPU + AMD dGPU) | vulkan-intel vulkan-asahi vulkan-radeon |
vulkan-intel vulkan-radeon |
| Intel or AMD GPU with class 0x0301 (XGA) or 0x0302 (3D controller) | nothing | vendor package installed |
On T2 Macs, lspci -nn shows Non-VGA unclassified device [0000]: Apple Inc. T2 Bridge Controller [106b:1801] (as quoted in #6608 and #6559). The old regex matched VGA inside Non-VGA, so every T2 Mac got vulkan-asahi, an Apple Silicon driver that is of no use there. Both changes look like improvements, but only a synthetic Intel 0x0302 case was run, and it was not matched to a real Intel or AMD GPU.
Impact: Vulkan package selection changes without being described in the PR. bin/omarchy-upgrade-to-quattro (lines 786-787) and migrations/1784401744.sh (lines 24-25) keep the old regex, so fresh installs and upgraded T2 Macs will now select different packages.
Suggested change: state both changes in the PR description, and decide whether the upgrade paths should use the same detection.
Unneeded heredoc rename: changing the nvidia.sh heredoc delimiters from EOF to NVEOF writes byte-identical files. It is not in the predecessor PR #10806, and it is the only reason this PR conflicts with open PR #8263 (a copy of the head without the rename merges with #8263 cleanly). Dropping it avoids that conflict.
Rationale wording: the config-space reason is correct: lspci reads each device's config space, which can resume a runtime-suspended GPU, while the sysfs vendor, device and class files are cached. The SIGPIPE reason in the PR body and the omarchy-hw-t2 comment does not apply to the replaced call sites. The old T2 checks used grep ... >/dev/null without -q, and install leaves run with errexit but without pipefail. Consider limiting the comment to the config-space reason. T2 detection also still uses lspci in install/hardware/apple/fix-brcmfmac-supplicant.sh (line 23), in the same install pass.
Optional test improvement: removing the vendor check from omarchy-hw-bcm43xx or omarchy-hw-t2 leaves their tests green, and so does deleting the 0x106b branch in vulkan.sh. A fixture with the right device ID under another vendor, and a 0x106b display-class fixture, would cover those lines.
Related open PRs: these overlap the same detection and would need adapting after this change:
- Refuse hibernation setup on Apple T2 Macs by default #9238 adds its own
bin/omarchy-hw-t2usinglspci -nn | grep -q(add/add conflict). It could reuse this helper. - Avoid lspci in favor of sysfs #11259 is a competing sysfs design (shared
install/helpers/pci-sysfs.sh). The draft [Intel Mac P03] Consolidate Apple hardware detection #12681 carries a copy of this PR plus a hot-unplug change. - fix(bcm43xx): add BCM43224 detection and blacklist conflicting drivers #10910, Support Broadcom BCM4352 Wi-Fi during installation #11655 and Support pre-GCN AMD GPUs and BCM4321 wireless #10936 add Broadcom IDs to the old
fix-bcm43xx.shcheck. Accepted IDs would belong inomarchy-hw-bcm43xx. - Install Apple Broadcom Wi-Fi firmware on every Mac brcmfmac drives, not just T2 #10306 widens the
arch-mact2gate inpacman.shto non-T2 Macs with brcmfmac Wi-Fi, and the draft [codex] OM-SEC-05: Remove the unsigned Apple T2 package source #9461 removes the unsignedarch-mact2repository. Keeping only this PR's side of those conflicts would drop their changes. - Support pre-GCN AMD GPUs and BCM4321 wireless #10936 adds an
amdgpu-driver guard tovulkan.sh, and Run Omarchy on Apple Silicon under Asahi Linux #9835 replaces the Apple PCI match there with Apple Silicon device-tree detection. Both conflict with the new sysfs loop.
Review information
Test scope: source review of the head against the merge base and current quattro tip. The new and neighbouring hardware tests ran in an isolated sandbox against synthetic sysfs trees, and the full shell suites ran in the same sandbox with /sys hidden. The PR adds no failing test files; the suites have the same pre-existing failures before and after the change. Old and new install scripts were compared on synthetic machine layouts with a stubbed lspci, stubbed package installs and redirected /etc writes. The T2 lspci lines were modelled on public user reports; the other lspci lines are hand-written approximations. Merges with the tip and with open PRs touching these files were simulated. No physical hardware was tested.
AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.
Opt out: To stop receiving these reviews, reply to this comment saying so.
|
Read cached sysfs vendor, device and display-class IDs for BCM4360/BCM4331, Apple T2, Vulkan package selection and the NVIDIA install gate, avoiding full PCI configuration-space scans in these paths.
Vulkan selection deliberately excludes non-display Apple T2 functions and includes 3D/XGA display classes. Those are behavioral changes from the old text matching. The upgrade migration and quattro upgrade script still use the old detection and need reconciliation before claiming parity across fresh installs and upgrades. The separate brcmfmac supplicant setup still uses lspci.
Validation: 24 focused groups pass against synthetic sysfs trees. The NVIDIA test now executes the actual installer with /etc destinations relocated and package installation stubbed, checking non-NVIDIA, audio, GSP, pre-GSP and unsupported devices. Tests also reject device IDs under the wrong vendor and cover Apple display/non-display and Intel/AMD 3D/XGA classes. Six intentionally broken variants fail: an unconditional NVIDIA gate, a GSP-only gate, an lspci gate, either removed vendor check, and a removed Apple Vulkan branch. The unnecessary NVIDIA heredoc rename was removed. No physical hardware, native driver loading, package transaction or fresh OS install was tested.
Integration remains open: #11311's BCM4322 branch reads the deleted pci_info variable and must be converted to sysfs if combined with this work. #9238, #11259, #12681, #10910, #11655, #10936, #10306, #9461 and #9835 have overlapping detection or policy changes identified in review. This follow-up does not claim those combined branches are compatible.