Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions install/hardware/fix-bcm43xx.sh
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)
# - BCM43228 (HP ProBook 6570b)

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:4359"); then
echo "BCM4360 / BCM4331 / BCM43228 detected"
omarchy-pkg-add broadcom-wl-dkms
fi
8 changes: 8 additions & 0 deletions migrations/1792750214.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
echo "Install the Broadcom wl driver for BCM43228 Wi-Fi"

# Hardware setup only runs at install. A machine already running b43 on firmware
# its owner added works, and broadcom-wl-dkms would blacklist b43.
if [[ $(lspci -nn) == *"14e4:4359"* && ! -d /usr/lib/firmware/b43 ]] && omarchy-pkg-missing broadcom-wl-dkms; then
omarchy-pkg-add broadcom-wl-dkms
omarchy-state set reboot-required
fi
62 changes: 62 additions & 0 deletions test/shell.d/bcm43228-wifi-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

set -euo pipefail

source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"

setup="$ROOT/install/hardware/fix-bcm43xx.sh"
migration="$ROOT/migrations/1792750214.sh"
scratch=$(mktemp -d)
trap 'rm -rf "$scratch"' EXIT

bash -n "$setup" || fail "Broadcom hardware script has valid syntax"
bash -n "$migration" || fail "BCM43228 migration has valid syntax"

actions() {
[[ -f $scratch/actions ]] && cat "$scratch/actions" || true
}

run_setup() {
local pci=$1
rm -f "$scratch/actions"
lspci() { printf '%s\n' "$pci"; }
omarchy-pkg-add() { printf '%s\n' "$*" >>"$scratch/actions"; }
source "$setup"
}

for chip in "BCM43228 [14e4:4359]" "BCM4360 [14e4:43a0]" "BCM4331 [14e4:4331]"; do
run_setup "00:00.0 Network controller [0280]: Broadcom Inc. $chip" >/dev/null
[[ $(actions) == "broadcom-wl-dkms" ]] ||
fail "$chip installs broadcom-wl-dkms" "$(actions)"
done

run_setup "00:1f.6 Ethernet controller [0200]: Intel I219-LM [8086:15b7]" >/dev/null
[[ -z $(actions) ]] ||
fail "other network hardware installs no Broadcom driver" "$(actions)"

run_migration() {
local pci=$1
local installed=$2
rm -f "$scratch/actions"
lspci() { printf '%s\n' "$pci"; }
omarchy-pkg-missing() { [[ $installed == no ]]; }
omarchy-pkg-add() { printf 'add %s\n' "$*" >>"$scratch/actions"; }
omarchy-state() { printf 'state %s\n' "$*" >>"$scratch/actions"; }
source "$migration"
}

run_migration "00:1f.6 Ethernet controller [0200]: Intel I219-LM [8086:15b7]" no >/dev/null
[[ -z $(actions) ]] ||
fail "the migration does nothing without a BCM43228" "$(actions)"

run_migration "00:00.0 Network controller [0280]: Broadcom Inc. BCM43228 [14e4:4359]" yes >/dev/null
[[ -z $(actions) ]] ||
fail "the migration leaves an installed broadcom-wl-dkms alone" "$(actions)"

if [[ ! -d /usr/lib/firmware/b43 ]]; then
run_migration "00:00.0 Network controller [0280]: Broadcom Inc. BCM43228 [14e4:4359]" no >/dev/null
[[ $(actions) == $'add broadcom-wl-dkms\nstate set reboot-required' ]] ||
fail "the migration installs broadcom-wl-dkms and asks for a reboot" "$(actions)"
fi
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved

pass "BCM43228 gets the wl driver on install and on existing machines"