Skip to content

Detect BCM43xx, T2, Vulkan, and NVIDIA via sysfs helpers - #12076

Open
Chessing234 wants to merge 11 commits into
omacom:quattrofrom
Chessing234:fix/hardware-detect-via-sysfs
Open

Chessing234 wants to merge 11 commits into
omacom:quattrofrom
Chessing234:fix/hardware-detect-via-sysfs

Conversation

@Chessing234

@Chessing234 Chessing234 commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

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.

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.
@llstrk

llstrk commented Sep 27, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Verified: omarchy-hw-bcm43xx and omarchy-hw-t2 detect the same BCM4360/BCM4331 and T2 hardware as the lspci checks they replace, and follow the existing omarchy-hw-nvidia* helpers (same OMARCHY_PCI_DEVICES_PATH override, nullglob, exit codes and sysfs value format). The PR applies cleanly to the current quattro tip. All four new tests pass on the head and on a synthetic merge with the tip, and fail on the merge base. On synthetic machine layouts, the old and new install scripts install the same packages and write the same files, except for the Vulkan differences below.

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.

nvidia-hw-detect-test.sh passes with a broken NVIDIA gate

The test only greps nvidia.sh, and never runs it. Its first check, grep -Fq 'omarchy-hw-nvidia', already matches omarchy-hw-nvidia-gsp at the merge base, and at the head it also matches the new comment on line 1. The second check, ! grep -Eq "lspci.*nvidia", is case-sensitive. Copies of the head that change only the gate line all pass the test:

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:


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.

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Refactors hardware detection to use sysfs instead of lspci.

The PR appears safe to merge; no actionable regression was established.

Summary

This PR replaces lspci-based hardware checks with sysfs detection for Broadcom Wi-Fi, Apple T2, NVIDIA, and Vulkan driver selection.

  • Adds BCM43xx and T2 helpers and uses them in the corresponding installation paths.
  • Selects Vulkan packages from display-class PCI vendor IDs.
  • Adds isolated tests for all four detection paths; all four test files passed.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  PCI["PCI devices in sysfs"] --> BCM["BCM43xx helper"]
  PCI --> T2["T2 helper"]
  PCI --> NV["NVIDIA helper"]
  PCI --> VK["Vulkan vendor/class scan"]
  BCM --> WL["Broadcom wl package"]
  T2 --> T2PKG["T2 packages and repository"]
  NV --> NVPKG["NVIDIA driver packages"]
  VK --> VKPKG["Intel, Radeon, or Asahi Vulkan package"]
Loading

Reviews (1) · Last reviewed commit: "Exercise hardware install decisions with..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants