Repository navigation
fix(bcm43xx): add BCM43224 detection and blacklist conflicting drivers #10910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: quattro
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,11 @@ | ||
| # Install Wi-Fi drivers for Broadcom chips found in some MacBooks, as well as other systems: | ||
| # - BCM4360 (2013–2015 MacBooks) | ||
| # - BCM4331 (2012, early 2013 MacBooks) | ||
| # - BCM43224 (2012 MacBook Air 5,2) | ||
|
|
||
| pci_info=$(lspci -nn) | ||
|
|
||
| if (echo "$pci_info" | grep -q "14e4:43a0" || echo "$pci_info" | grep -q "14e4:4331"); then | ||
| echo "BCM4360 / BCM4331 detected" | ||
| if (echo "$pci_info" | grep -q "14e4:43a0" || echo "$pci_info" | grep -q "14e4:4331" || echo "$pci_info" | grep -q "14e4:4353"); then | ||
| echo "BCM4360 / BCM4331 / BCM43224 detected" | ||
| omarchy-pkg-add broadcom-wl-dkms | ||
| fi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" | ||
|
|
||
| fix_script="$ROOT/install/hardware/fix-bcm43xx.sh" | ||
|
|
||
| # === Static analysis === | ||
|
|
||
| grep -q '14e4:43a0' "$fix_script" || \ | ||
| fail "fix-bcm43xx.sh still detects BCM4360 (14e4:43a0)" | ||
| pass "fix-bcm43xx.sh still detects BCM4360 (14e4:43a0)" | ||
|
|
||
| grep -q '14e4:4331' "$fix_script" || \ | ||
| fail "fix-bcm43xx.sh still detects BCM4331 (14e4:4331)" | ||
| pass "fix-bcm43xx.sh still detects BCM4331 (14e4:4331)" | ||
|
Comment on lines
+11
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| grep -q '14e4:4353' "$fix_script" || \ | ||
| fail "fix-bcm43xx.sh detects BCM43224 (14e4:4353) in MacBook Air 5,2" | ||
| pass "fix-bcm43xx.sh detects BCM43224 (14e4:4353) in MacBook Air 5,2" | ||
|
|
||
| # === Test 1: BCM43224 detection === | ||
|
|
||
| test_tmp=$(mktemp -d) | ||
| trap 'rm -rf "$test_tmp"' EXIT | ||
|
|
||
| stub_bin="$test_tmp/bin" | ||
| calls="$test_tmp/calls.log" | ||
| mkdir -p "$stub_bin" | ||
| : >"$calls" | ||
|
|
||
| cat >"$stub_bin/lspci" <<'SH' | ||
| #!/bin/bash | ||
|
|
||
| echo '02:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM43224 802.11a/b/g/n [14e4:4353] (rev 01)' | ||
| SH | ||
|
|
||
| cat >"$stub_bin/omarchy-pkg-add" <<'SH' | ||
| #!/bin/bash | ||
|
|
||
| printf 'omarchy-pkg-add\t%s\n' "$*" >>"$TEST_LOG" | ||
| SH | ||
|
|
||
| chmod +x "$stub_bin"/* | ||
|
|
||
| # Redirect /etc/modprobe.d to sandbox so the test runs without root | ||
| script="$test_tmp/fix-bcm43xx.sh" | ||
| sed -e "s|/etc/modprobe.d|$test_tmp/etc/modprobe.d|g" \ | ||
| "$fix_script" >"$script" | ||
|
|
||
| PATH="$stub_bin:$PATH" \ | ||
| TEST_LOG="$calls" \ | ||
| OMARCHY_INSTALL="$ROOT/install" \ | ||
| bash -euo pipefail "$script" >/dev/null | ||
|
|
||
| # Verify package install was called (tab-separated) | ||
| grep -qx $'omarchy-pkg-add\tbroadcom-wl-dkms' "$calls" || \ | ||
| fail "BCM43224 triggers broadcom-wl-dkms installation, relying on the base install's kernel headers" | ||
| pass "BCM43224 triggers broadcom-wl-dkms installation, relying on the base install's kernel headers" | ||
|
|
||
| # broadcom-wl-dkms ships its own blacklist, which goes away with the package | ||
| [[ ! -d "$test_tmp/etc/modprobe.d" ]] || fail "BCM43224 leaves blacklisting to broadcom-wl-dkms" | ||
| pass "BCM43224 leaves blacklisting to broadcom-wl-dkms" | ||
|
|
||
| # === Test 2: Non-Broadcom hardware is skipped === | ||
|
|
||
| test_tmp2=$(mktemp -d) | ||
| trap 'rm -rf "$test_tmp" "$test_tmp2"' EXIT | ||
|
|
||
| stub_bin2="$test_tmp2/bin" | ||
| calls2="$test_tmp2/calls.log" | ||
| mkdir -p "$stub_bin2" | ||
| : >"$calls2" | ||
|
|
||
| cat >"$stub_bin2/lspci" <<'SH' | ||
| #!/bin/bash | ||
|
|
||
| echo '02:00.0 Network controller [0280]: Intel Corporation Wi-Fi 6 AX201 [8086:06f0] (rev 01)' | ||
| SH | ||
|
|
||
| cat >"$stub_bin2/omarchy-pkg-add" <<'SH' | ||
| #!/bin/bash | ||
|
|
||
| printf 'omarchy-pkg-add\t%s\n' "$*" >>"$TEST_LOG" | ||
| SH | ||
|
|
||
| chmod +x "$stub_bin2"/* | ||
|
|
||
| script2="$test_tmp2/fix-bcm43xx.sh" | ||
| sed -e "s|/etc/modprobe.d|$test_tmp2/etc/modprobe.d|g" \ | ||
| "$fix_script" >"$script2" | ||
|
|
||
| PATH="$stub_bin2:$PATH" \ | ||
| TEST_LOG="$calls2" \ | ||
| OMARCHY_INSTALL="$ROOT/install" \ | ||
| bash -euo pipefail "$script2" >/dev/null | ||
|
|
||
| [[ ! -s $calls2 ]] || fail "non-Broadcom hardware skips driver installation" | ||
| pass "non-Broadcom hardware skips driver installation" | ||
|
|
||
| [[ ! -d "$test_tmp2/etc/modprobe.d" ]] || fail "non-Broadcom hardware skips blacklist creation" | ||
| pass "non-Broadcom hardware skips blacklist creation" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.