Repository navigation
Conversation
The Broadcom Wi-Fi firmware on Macs driven by brcmfmac (BCM4350 and relatives) does not reliably survive a long suspend: after wake it stops answering msgbuf commands, the kernel logs 'Timeout on response for query command' for every request, and the interface never recovers -- only a reboot brings Wi-Fi back. A system-sleep hook now unbinds the device before sleep and rebinds it after wake, forcing a clean firmware reload. NetworkManager sees a fresh interface and reconnects on its own. Gated like the WPA-handshake quirk: T2 Macs by the T2 PCI ID, older Macs by the brcmfmac PCI IDs from brcm_hw_ids.h. A migration installs the hook on existing installs; no reboot is needed because systemd-sleep runs every executable in system-sleep on the next suspend.
|
Related: #11434 is still open and targets the same brcmfmac firmware timeout on these Apple/Broadcom devices. The lifecycle differs: that PR unbinds/rebinds through a post-resume service, while this one unbinds before sleep and records which devices to rebind afterward. These look like alternative fixes to coordinate before landing both migrations. A long-suspend test on the BCM4350 case here and the BCM43602 case in #11434 would help establish which lifecycle covers both reports. |
|
Agreed these shouldn't both land — but I think the lifecycle difference settles it rather than test coverage alone. Unbinding pre-sleep means the firmware never executes its S3 suspend/resume path at all: the wedge is avoided, not recovered from. The post-resume service in #11434 still lets the firmware suspend normally and bets the rebind heals it afterward — which is exactly the assumption that fails in the long-suspend case here. The hardware gate and device table are identical in both PRs, so this hook should cover the BCM43602 population as-is. @TheoAndersen — could you try the |
|
Reviewed at Tests. On a disposable Omarchy worker: Against #10332. That is the other open fix for this bug. This one is the better of the two, and both reviewers reached that conclusion. Codex was given both diffs without my answer, but it can read this session, so its agreement is not guaranteed to be independent. In #10332, the pre-sleep What still stands, for the maintainer:
Not yet verified. This is a hardware bug, so it is verified by someone who has it, on this exact commit. @hanscnelson (MacBookPro14,2), @makoni (MacBookPro14,3) and @rand0mdud3 (MacBookPro11,5) reported this signature on #10332. If any of you can run this hook through a long suspend, that is the confirmation this PR waits on. Remove #10332's After a suspend of an hour or more, please report the machine model, whether Wi-Fi reconnected on its own, and what Next: this waits on that confirmation, and then on the maintainer to choose between this PR and #10332. |
|
Looks solid — pre-sleep unbind is a cleaner lifecycle than post-resume reload (#11434, now closed), and the PCI-ID gate + migration for existing installs are the right shape. Overlaps the broader Apple suspend cluster (#9830, #7180, #11377). If maintainers want one brcmfmac path, this seems the stronger candidate for the wedge-after-long-suspend case. Happy for a maintainer pass. |
|
Checked again at Please don't install this hook on a stock Omarchy kernel yet. My last comment asked owners of affected Macs to try it. Since then, @makoni traced a kernel oops on #7333 to a P2P interface removal race in brcmfmac's own teardown. It is fixed upstream by "wifi: brcmfmac: fix P2P device removal race in brcmf_detach()" ( Which fix to carry forward. There are now four open fixes for this bug: #7180 (draft), #7333, #10332 and this one. I compared them again, and Codex was given all four diffs separately, without my answer. Both chose #7333. It is older than this PR, it covers BCM4350 and BCM43602, it reaches existing installs, and it records the device before unbinding. Codex can read this session, so its agreement is not guaranteed to be independent. Compared with #10332, this PR is still better: it uses sysfs unbind instead of Still open at this head, beyond the kernel race. Codex raised the first two, and I checked both against the diff:
Since this one is not the fix to carry forward, it was not run on a worker again. The earlier run at this commit ( What it waits on: the maintainer, who chooses among #7180, #7333, #10332 and this PR. Whichever is chosen, it also needs a |
Problem
On Macs whose Wi-Fi is driven by
brcmfmac(BCM4350 and relatives), a long suspend wedges the Broadcom firmware. After wake the kernel logsbrcmf_msgbuf_query_dcmd: Timeout on response for query commandfor every request, NetworkManager seesdo-change-link: failure 5 (Input/output error), and the interface never recovers — only a reboot brings Wi-Fi back. Short suspends (seconds) resume fine; the failure shows up after hours asleep.Observed on a MacBook10,1 (BCM4350,
14e4:43a3): suspended 16:53, resumed 19:55, firmware dead from the first msgbuf command after wake.Fix
A
systemd/system-sleephook unbinds the Wi-Fi PCI device frombrcmfmacbefore sleep and rebinds it after wake, forcing a clean firmware reload. NetworkManager then sees a fresh interface and reconnects on its own (~seconds after wake). Devices unbound atpreare recorded under/runand only those are rebound atpost; apostwith no matchingpreis a no-op.Gating
Mirrors
fix-brcmfmac-supplicant.sh: T2 Macs via the T2 PCI ID, older Macs via thebrcmfmacPCI IDs frombrcm_hw_ids.h. Hardware brcmfmac doesn't drive is left alone.Rollout
install/hardware/apple/fix-brcmfmac-suspend.shruns frominstall/hardware/all.sh.system-sleepon the next suspend. Idempotent: an identical hook is left untouched, a locally modified one is refreshed.Tests
test/shell.d/brcmfmac-suspend-test.sh(13 assertions): hardware gating for the leaf and migration, idempotency, refresh of a modified hook, and the hook's own pre/post/no-op behavior against a stub sysfs.brcmfmac-supplicant-test.shandsystem-sleep-ownership-migration-test.shstill pass.