Skip to content

Reset Apple BCM4350/BCM43602 Wi-Fi around sleep - #7333

Open
Rouxgrr wants to merge 7 commits into
omacom:quattrofrom
Rouxgrr:fix/apple-bcm43602-suspend
Open

Rouxgrr wants to merge 7 commits into
omacom:quattrofrom
Rouxgrr:fix/apple-bcm43602-suspend

Conversation

@Rouxgrr

@Rouxgrr Rouxgrr commented Aug 18, 2026

Copy link
Copy Markdown

Summary

  • Install a sleep service only on Apple systems with BCM4350 (14e4:43a3) or BCM43602 (14e4:43ba / 43bb / 43bc).
  • Unbind that device from brcmfmac before sleep and bind it again after wake, forcing a clean firmware initialization.
  • Add an idempotent migration for existing installs and tests for hardware gating, helper recovery, and installation.

This generalizes the approach in #7180, which already proved the unbind/bind cycle on BCM4350, so one service can cover both confirmed S3-dead chips. T2-era parts stay out of the allowlist: BCM4364 must remain bound, and BCM4377/4378/4387 have their own recovery path.

Failure

Reproduced on a MacBookPro12,1 (Early 2015 13") running Omarchy 4.0.0-1, kernel 7.1.8, in-tree brcmfmac for BCM43602 (14e4:43ba, firmware 7.35.177.61).

Closing the lid suspends (deep S3). After resume, the Wi-Fi toggle stays on and the network panel only shows DNS. The radio is enabled, but the firmware is dead:

platform-linux: do-change-link[2]: failure 5 (Input/output error)
device (wlp3s0): set-hw-addr: failed to set MAC address ... (scanning) (NME_UNSPEC)
device (wlp3s0): Couldn't initialize supplicant interface: Timeout was reached
ieee80211 phy0: brcmf_msgbuf_tx_ioctl: Failed to reserve space in commonring
ieee80211 phy0: brcmf_cfg80211_scan: scan error (-12)

Toggling the slider only flips rfkill/NetworkManager state. A reboot reinitializes the firmware and Wi-Fi works again. Same machine, same failure, on Omarchy 3 — this is not leftover Quattro UI.

#7180 recorded the same class of failure on MacBook10,1 / BCM4350, including a later suspend that then timed out in brcmf_pcie_pm_enter_D3.

Approach

A sleep.target oneshot keeps the matching PCI device unbound for the sleep transaction, then binds it after wake so NetworkManager sees a freshly initialized radio. The helper also records an already-unbound matching device so a leftover cycle cannot block the next suspend.

Module unload was discarded in #7180 because udev immediately reloaded brcmfmac and an exploratory cycle coincided with a hard lock. This PR uses that same unbind/bind path.

The installer and migration no-op unless the machine is Apple and lspci shows one of the confirmed IDs.

Testing

  • bash -n on the helper, installer, migration, and test
  • test/shell.d/brcmfmac-suspend-test.sh
  • test/shell.d/brcmfmac-supplicant-test.sh
  • test/cli (including command metadata for the new helper)

Live lid-close/resume of this service still needs a run on the MacBookPro12,1 that produced the logs. #7180 already completed that cycle on BCM4350 with the same unit ordering.

If this should land after #7180 instead of beside it, the BCM43602 IDs can be added there and this closed.

These Broadcom firmwares stop answering after S3. Unbind the device
before sleep and bind it after wake so NetworkManager gets a fresh
radio. Leave T2-era chips alone.
Copilot AI balanced review requested due to automatic review settings August 18, 2026 00:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an Apple-specific Broadcom (BCM4350/BCM43602) suspend/resume recovery mechanism by unbinding/rebinding brcmfmac around sleep, including a systemd unit, a migration for existing installs, and a shell-based regression test.

Changes:

  • Introduces omarchy-hw-brcmfmac-suspend helper to unbind/rebind affected Broadcom PCI devices on suspend/resume.
  • Adds an Apple hardware setup script and a sleep.target-bound systemd unit to run the helper.
  • Adds migration 1787013338 plus a dedicated shell test covering install/migration behavior and helper logic.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/shell.d/brcmfmac-suspend-test.sh Adds regression tests validating unit content, helper behavior, installer path, and migration idempotency.
migrations/1787013338.sh Introduces a migration to install/enable the sleep service on existing affected Apple systems.
install/hardware/apple/omarchy-brcmfmac-suspend.service Adds a systemd oneshot service bound to sleep.target to run pre/post helper actions.
install/hardware/apple/fix-brcmfmac-suspend.sh Adds hardware-setup script to install and enable the sleep service on matching Apple devices.
install/hardware/all.sh Hooks the new Apple Broadcom suspend fix into the global hardware setup flow.
bin/omarchy-hw-brcmfmac-suspend Adds the unbind/rebind helper with state tracking across suspend/resume.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread migrations/1787013338.sh
Comment on lines +1 to +3
echo "Reset Apple BCM4350/BCM43602 Wi-Fi around sleep"

# The installer only reaches new systems. Existing Apple BCM4350 and BCM43602
Comment thread migrations/1787013338.sh
Comment on lines +1 to +3
echo "Reset Apple BCM4350/BCM43602 Wi-Fi around sleep"

# The installer only reaches new systems. Existing Apple BCM4350 and BCM43602
Comment on lines +10 to +13
sys_vendor="$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null || true)"

if [[ $sys_vendor == Apple* ]] &&
lspci -nn | grep -E "14e4:(43a3|43ba|43bb|43bc)" >/dev/null; then
Comment on lines +10 to +11
ExecStart=/usr/bin/omarchy-hw-brcmfmac-suspend pre
ExecStop=/usr/bin/omarchy-hw-brcmfmac-suspend post
@Rouxgrr

Rouxgrr commented Aug 18, 2026

Copy link
Copy Markdown
Author

Live lid-close/resume on the MacBookPro12,1 that produced the original failure (BCM43602 14e4:43ba, Omarchy 4.0.0-1, kernel 7.1.8). The service is installed locally from this branch (ExecStart/ExecStop pointed at /usr/local/bin until the package ships the helper).

Ordering:

18:28:32 Starting Reset Broadcom Wi-Fi around sleep...
18:28:33 Finished Reset Broadcom Wi-Fi around sleep
18:28:33 Starting System Suspend...
18:28:40 System returned from sleep operation 'suspend'
18:28:40 Stopping Reset Broadcom Wi-Fi around sleep...
18:28:40 rfkill2: found Wi-Fi radio killswitch ... (driver brcmfmac)
18:28:40 device (wlan0): interface index 4 renamed iface from 'wlan0' to 'wlp3s0'
18:28:44 Connected to wireless network "Blazin"
18:28:46 device (wlp3s0): Activation: successful, device activated

About six seconds from wake to an activated link. Zero Input/output error, zero supplicant timeouts, zero brcmf_msgbuf_tx_ioctl / scan -12 after resume. The panel is empty for that window because the phy is being rebound, then the network comes back on its own.

andrew-boyd added a commit to andrew-boyd/omarchy that referenced this pull request Sep 21, 2026
Use the BCM4350/BCM43602 allowlist from omacom#7333 in setup, migration and
the per-device hook. The supplicant workaround does not justify
applying one recovery lifecycle to T2 radios. Preserve pending-device
restoration and the existing custom-hook protection.

Source-Commit: omacom#7333
Co-authored-by: Jared Ogden <[email protected]>
(cherry picked from commit 6096d649643d0d0e0bae65c7949e5043bf2cc338)
@omarchybot omarchybot added bug Something isn't working compatibility Make Omarchy work better on everything! labels Sep 27, 2026
systemd skips ExecStop for a oneshot whose ExecStart failed or timed out, so a pre that detached the radio and then failed, or hit its 10s timeout while firmware was hanging the unbind, left Wi-Fi unbound after wake. ExecStopPost runs in both cases. The helper also records each device before unbinding it and keeps that record on failure, so post still knows what to rebind.

Co-Authored-By: Codex Medium <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at ff52b69a2e6b22093e241e458e1f438c3eb1765c, with one fix pushed to your branch.

Pushed: ff52b69, rebind the radio even when the pre-sleep step fails. systemd skips ExecStop for a oneshot whose ExecStart failed or timed out. So if pre unbound the device and then failed, or hit TimeoutStartSec=10s while dying firmware held up the unbind, the machine woke with Wi-Fi unbound and nothing rebinding it. I checked this on systemd 261: after both a failed start and a timed-out start, ExecStop never ran and ExecStopPost did. The unit now runs post from ExecStopPost. The helper records each device before unbinding it and keeps that record if the unbind fails, so post still knows what to rebind. The new regression in test/shell.d/brcmfmac-suspend-test.sh fails against 64bde7e and passes at ff52b69.

Tests: ./test/cli and the full ./test/shell (2274 passed, 0 failed) ran on a disposable Omarchy ISO worker VM at ff52b69. The worker has no Broadcom radio, so the suspend failure itself was not reproduced. Nothing here proves the fix on hardware.

Competing PRs: five open PRs work around this same failure: #7180, #10332, #11570, #12314 and this one. This one covers the most for the least. It is #7180's unbind/bind service with BCM43602 added. Unlike #10332 and #11570, it unbinds instead of unloading the module. The comments on #10332 and closed #11434 show modprobe -r failing silently while NetworkManager holds the module. Unlike #12314, it leaves the T2-era parts alone. Unlike #11570, it carries no Thunderbolt changes. Unbinding still goes through brcmf_pcie_remove, so the teardown GPF reported on #10332 is not ruled out here either. Only one of them should land. #7180, #10332 and #12314 create the same install/hardware/apple/fix-brcmfmac-suspend.sh as this one, and #11570 installs a second hook for the same chip. Choosing between them is the maintainer's call.

Second opinion (Codex Medium): I asked it to pick among the five without giving it my answer, and it also chose this one. Its independence is not guaranteed, because it can read this session's own notes. It found the ExecStop defect above, which I confirmed and fixed. Its review of ff52b69 found nothing further. It also noted that the migration replaces a changed unit file without daemon-reload when the service is already enabled. That can only happen to a hand-installed copy, since this unit has never shipped, so I left it alone.

Copilot's four comments: none of them needed a change. The installer and the migration omit a shebang because Omarchy's AGENTS.md says install/ and migrations/ scripts are sourced. Every migration opens with its echo banner. The unit is only WantedBy=sleep.target, so its failure cannot veto suspend, and SuccessExitStatus= would add nothing.

What it waits on: proof on hardware, and the maintainer's choice among the competing PRs. @Rouxgrr, your lid-close test predates this commit. The project also only counts hardware confirmation from an issue's reporter or a maintainer, never the PR's author, so a run on another affected Mac would help most. @hanscnelson and @rand0mdud3 offered to test on #10332. To try it on a BCM43602 or BCM4350 Mac:

sha=ff52b69a2e6b22093e241e458e1f438c3eb1765c
src=https://raw.githubusercontent.com/Rouxgrr/omarchy/$sha
sudo curl -fsSL -o /usr/local/bin/omarchy-hw-brcmfmac-suspend "$src/bin/omarchy-hw-brcmfmac-suspend"
sudo chmod 755 /usr/local/bin/omarchy-hw-brcmfmac-suspend
curl -fsSL "$src/install/hardware/apple/omarchy-brcmfmac-suspend.service" |
  sed 's|/usr/bin/omarchy-hw|/usr/local/bin/omarchy-hw|' |
  sudo tee /etc/systemd/system/omarchy-brcmfmac-suspend.service >/dev/null
sudo systemctl daemon-reload
sudo systemctl enable omarchy-brcmfmac-suspend.service

Then close the lid for a while, open it, and post your model, lspci -nn | grep 14e4, whether Wi-Fi came back on its own, and the output of journalctl -b -k -u omarchy-brcmfmac-suspend | grep -E 'brcmf|Broadcom'.

@AdamLien

AdamLien commented Oct 4, 2026

Copy link
Copy Markdown

Additional reproduction and recovery evidence from a MacBookPro12,1. This supports the PCI unbind/bind approach in this PR, but is not a live validation of this PR's sleep service.

System details

  • MacBookPro12,1, Intel i5-5257U, Intel Iris Graphics 6100
  • Omarchy 4.0.4-1; kernel 7.2.5-3-omarchy
  • BCM43602 14e4:43ba, Apple subsystem 106b:0133, PCI 0000:03:00.0, interface wlp3s0
  • brcmfmac firmware 7.35.177.61 (r598657), dated Nov 10 2015
  • Wi-Fi power save off; PCI runtime power/control=on
  • Important qualification: the recorded Oct 4 suspend reproduction used a locally built, out-of-tree brcmfmac module based on Linux stable v7.2.5. It tolerates a missing D3 ACK when WoWLAN is disabled, based on the proposed change at https://lists.openwall.net/linux-kernel/2026/09/15/57. It does not change the firmware binary. It still failed after resume. This is not a clean stock-driver regression test.
  • No Broadcom suspend recovery service/hook was installed in the system-sleep hooks inspected for this report. A USB Realtek adapter was unplugged during the recorded sleep test.

Reproduction steps

  1. Connect the internal adapter to a saved Wi-Fi network; verify the default route uses wlp3s0, iw dev wlp3s0 link shows a connection, and the gateway/Internet respond.
  2. Run systemctl suspend, then wake the laptop.
  3. Check nmcli device status, iw dev wlp3s0 link, and the current boot's kernel journal.
  4. Observed result: wlp3s0 becomes unavailable, the default route is absent, and firmware command queries repeatedly time out. This is an intermittent failure; not every sleep cycle has been shown to fail.

Recorded sequence (2026-10-04, UTC+08:00)

02:38:58 PM: suspend entry (deep)
02:39:12 ACPI: PM: Waking up from system sleep state S3
02:39:13 PM: suspend exit
02:39:15 brcmf_msgbuf_query_dcmd: Timeout on response for query command
02:39:15 _brcmf_set_multicast_list: Setting mcast_list failed, -5
02:39:19 brcmf_cfg80211_get_channel: chanspec failed (-5)
02:39:30 Couldn't initialize supplicant interface: Timeout was reached
02:40:54 brcmf_fw_alloc_request: using brcm/brcmfmac43602-pcie for chip BCM43602/1
02:41:00 DHCP activation began after recovery; subsequent status showed connected

The live status before suspend showed power saving off and successful Internet probes. After suspend it showed unavailable/no route. A radio toggle and NetworkManager restart did not recover it in this cycle (the restart timed out). modprobe -r brcmfmac failed with Module brcmfmac is in use.

The local recovery script then unbound and rebound PCI 0000:03:00.0, started the network services, and activated the saved connection. Firmware initialization appeared in the journal and the internal adapter regained its address/default route; gateway and Internet probes succeeded, without rebooting the machine. Because service restart and reconnection were also part of this sequence, this does not isolate PCI rebind as the only action needed.

Interpretation / limitations

  • Disabling ordinary Wi-Fi power saving did not prevent this recorded system-suspend failure.
  • The evidence points to loss of firmware/driver communication across S3, rather than a weak-signal or DNS-only failure. It does not identify the exact defective code path or conclusively exclude hardware.
  • The missing-D3-ACK patch alone was insufficient on this machine.
  • An additional local experiment forcing the existing cold-resume path was compiled but not installed or tested; it is not presented as a fix.
  • A separate configuration issue was found: the saved internal profile had autoconnect disabled. Enabling it addresses a healthy adapter not reconnecting to the SSID; it does not recover an unavailable adapter with firmware timeouts.
  • We have not installed this PR's service or measured repeated real sleep/wake cycles with it. The above is manual recovery evidence only, and complements Fix Wi-Fi dying after suspend on BCM43602 MacBooks #10332.

AI assistance was used to collect and summarize local diagnostics. SSID, hostname, IP addresses, and MAC addresses have been omitted.

@makoni

makoni commented Oct 5, 2026

Copy link
Copy Markdown

Tested ff52b69a on a MacBookPro14,3 (15" 2017), and it found a kernel bug that I think needs to be sorted out before this lands.

  • Omarchy 4.0.4-1, kernel 7.2.5-3-omarchy, NetworkManager + wpa_supplicant (the default setup)
  • lspci -nn | grep 14e4: 03:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM43602 802.11ac Wireless LAN SoC [14e4:43ba] (rev 02)
  • Sleep is s2idle here, because deep S3 never comes back on this machine. So I can't say whether this PR fixes the dead firmware after S3. I can only say what the unbind/bind does here.

I installed the helper and the unit from that commit (same commands as in the bot's comment, checksums match) and closed the lid.

Stock brcmfmac: the first sleep went fine, and Wi-Fi was back 5 s after wake. On the second lid close the unbind hit a kernel oops:

Oops: general protection fault, probably for non-canonical address 0xdead000000000122: 0000 [#1] SMP PTI
RIP: 0010:_cfg80211_unregister_wdev+0x76/0x230 [cfg80211]
 brcmf_p2p_ifp_removed+0x87/0xb0 [brcmfmac]
 brcmf_remove_interface+0x1fe/0x250 [brcmfmac]
 brcmf_detach+0xaf/0x1a0 [brcmfmac]
 brcmf_pcie_remove+0xb5/0x1e0 [brcmfmac]

After that the helper died with SEGV and its process was left behind even after SIGKILL. All 8 suspend attempts after that failed because 6 to 13 tasks refused to freeze, Wi-Fi never came back, and the reboot hung, so I had to hold the power button.

Cause: this is a race in brcmfmac itself, not something in the helper. When the device is unbound, brcmf_detach() removes the P2P device interface. At the same time userspace (wpa_supplicant) deletes the same interface through nl80211, and brcmf_p2p_del_vif() waits 1.5 s for a firmware event that never comes, because the bus is already down. Both paths remove the interface, and the second removal hits the list entry the first one already deleted (0xdead000000000122 is LIST_POISON2). NetworkManager has wpa_supplicant create p2p-dev-wlp3s0 out of the box (it is there on this machine), so any Mac this PR installs on will most likely have that P2P device too.

There is already a fix upstream: wifi: brcmfmac: fix P2P device removal race in brcmf_detach() by Michele Dionisio, acked by the brcmfmac maintainer on Oct 4, but not merged into any tree yet.

With that patch: I built brcmfmac 7.2.5 with it plus a few debug prints and ran 30 automatic suspend/resume cycles with this PR's unit enabled (rtcwake + systemctl suspend). The race window opened in 3 of the 30 cycles and the patch handled it every time. There were no oops, and Wi-Fi reconnected by itself 5-8 s after every wake. I've sent a Tested-by to the list.

So the unbind/bind cycle itself works here, but with the current driver it breaks some suspends. With patched modules the race window opened in 3 of 9 cycles in one run (my own earlier fix) and 3 of 30 in another (Dionisio's patch). With the stock driver each of those would most likely have been this oops. Maybe this should wait until the fix is in the kernel Omarchy ships, or the helper could get the P2P device out of the way before unbinding. I haven't tested the second option.

@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at ff52b69a2e6b22093e241e458e1f438c3eb1765c after @makoni's hardware test. The code has not changed since the last review. That test is the first live run of this commit, and it shows the unbind can crash the kernel, so this cannot land as it stands with the kernel Omarchy ships today.

What the test found. On a MacBookPro14,3 with a BCM43602 (14e4:43ba) and stock 7.2.5-3-omarchy, the first sleep recovered Wi-Fi as intended. On the second, the pre unbind oopsed in _cfg80211_unregister_wdev via brcmf_pcie_remove → brcmf_detach → brcmf_p2p_ifp_removed. After that every suspend failed and the machine needed a hard power-off. That is worse than the failure this PR works around, which is Wi-Fi dead until a reboot.

Checked against the driver source. The mechanism makoni describes matches upstream brcmfmac/p2p.c. When wpa_supplicant deletes the P2P device, brcmf_p2p_del_vif waits for a firmware event, gives up on a timeout, and still calls brcmf_remove_interface. brcmf_p2p_ifp_removed reads the vif before it takes RTNL and the wiphy lock, and it does not check again afterwards. So if both removals run at once, the second unregisters and frees a wdev the first has already removed. NetworkManager has wpa_supplicant create p2p-dev-wlp3s0 by default, so most Macs this installs on will have that device. The upstream fix is "wifi: brcmfmac: fix P2P device removal race in brcmf_detach()" by Michele Dionisio, posted 2026-09-24. It takes RTNL and the wiphy lock in brcmf_detach. I could not confirm whether it has been merged into any tree. With that patch, makoni ran 30 suspend cycles with this unit and saw no oops, and Wi-Fi came back after every wake. That supports the approach on a patched driver, not on the one users run.

One more thing the test shows. That machine uses s2idle, and omarchy-brcmfmac-suspend.service runs for every sleep.target, so it unbinds the radio on s2idle and hibernate as well as on S3. The firmware failure this PR fixes has only been reported after S3. Wherever the race can still happen, a gate on /sys/power/mem_sleep would at least keep s2idle machines out of it.

Second opinion (Codex Medium): agreed it is neither verified nor ready, and agreed the race is consistent with p2p.c. Its independence is not guaranteed, because it can read this session's notes. It added the point that the unbind also runs on s2idle. It could not fetch the diff itself, so its review of the rest of the change is incomplete. Tests were not rerun this time: the code is unchanged, and the last run at this commit (./test/cli and the full ./test/shell, 2274 passed) cannot see a kernel race anyway. @AdamLien's report used a modified module and a manual rebind, so it supports the recovery step but not this service.

What it waits on: the maintainer. This can land once Omarchy's kernel carries the brcmfmac fix, either upstream or as a patch on the Omarchy kernel. The other option is for the helper to remove the P2P device while the firmware is still answering, before it unbinds. That is plausible but untested, and the reviewer pointed out that wpa_supplicant could recreate the device in between. A mistake there means a hard power-off on someone's laptop, so it would need repeated sleep cycles on an affected Mac before it counts. The choice among this PR and #7180, #10332, #11570 and #12314 is still open, and all five unbind the radio or unload the driver, so they all hit the same teardown path.

@makoni

makoni commented Oct 8, 2026

Copy link
Copy Markdown

Quick update: the brcmfmac fix has been picked up. It's in wireless.git as 08a3f02fea63 ("wifi: brcmfmac: fix P2P device removal race in brcmf_detach()"), and Johannes included it in the wireless-2026-10-07 fixes pull, so it isn't in mainline yet but is on its way to 7.3. It has Cc: stable, so it should reach 7.2.y as well, and from there the Omarchy kernel.

bjhinkle added a commit to bjhinkle/omarchy that referenced this pull request Oct 8, 2026
Remove brcmfmac-reload. Five open pull requests work around the same
brcmfmac failure after S3, and only one should land: systemd runs every
sleep hook at once, so two resets of one radio would race. The reviews on
omacom#10332 and omacom#7333 pick omacom#7333. Unloading brcmfmac also tears the device
down through brcmf_pcie_remove, the path where a P2P interface removal
race in the driver has oopsed during sleep (reported on omacom#7333 and
omacom#10332), so a second copy of that exposure here would not help.

This pull request now covers Thunderbolt and USB-C only. The installer and
the migration install thunderbolt-remove-rescan alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@omarchybot

Copy link
Copy Markdown
Collaborator

Checked again at ff52b69a2e6b22093e241e458e1f438c3eb1765c after @makoni's update. The code has not changed, so nothing was rerun on a worker. The last run at this commit is still the latest (./test/cli and the full ./test/shell, 2274 passed), and it cannot see a kernel race anyway.

The kernel fix is upstream, but users don't have it yet. I confirmed 08a3f02fea63 ("wifi: brcmfmac: fix P2P device removal race in brcmf_detach()") is in wireless.git and linux-next. It carries Cc: [email protected], Fixes: 9831bcb987df and Arend van Spriel's ack. I could not find it in mainline, and the second opinion found the old unlocked removal loop still in mainline core.c, linux-7.2.y and v7.2.9. So the blocker from the last review stands: on the kernel Omarchy ships today, this unbind can oops and leave the machine needing a hard power-off. It is now a question of when, not whether, the fix arrives.

Two things to settle before it lands, beyond the kernel:

  • Gate on the running driver, not the installed package. Once a fixed linux-omarchy ships, a migration that enables this unit still runs under the old kernel until the next reboot. The unbind should only happen when the brcmfmac that is actually loaded has the fix.
  • Limit it to S3. The unit is WantedBy=sleep.target (install/hardware/apple/omarchy-brcmfmac-suspend.service), and pre in bin/omarchy-hw-brcmfmac-suspend has no sleep-mode check, so it also unbinds on s2idle and hibernate. The dead-firmware failure has only been reported after S3, and makoni's oops happened on s2idle. Checking /sys/power/mem_sleep alone won't do it, because it can't tell hibernate from suspend. The helper also has to know which kind of sleep it is running for.

Competing PRs: #11570 has dropped its Wi-Fi hook and now leaves Wi-Fi to this PR, and #7180 is now a draft. #10332 still unloads the module, and #12314 still installs on T2-era chips. This remains the Wi-Fi fix to carry forward, but choosing it is still the maintainer's call.

Second opinion (Codex Medium): it read the upstream commit itself and agrees on all of the above. It raised the running-kernel point and the fact that a mem_sleep check can't distinguish hibernate. Its independence is not guaranteed, because it can read this session's notes.

What it waits on: the brcmfmac fix reaching the Omarchy kernel, either as a 7.2.y stable release or as a patch on linux-omarchy, plus the S3 gate. Then it needs repeated S3 cycles on an affected Mac running that shipped kernel.

@makoni

makoni commented Oct 9, 2026

Copy link
Copy Markdown

Small update on the kernel side: the brcmfmac fix reached mainline a few hours after the last review. Linus merged net-7.3-rc7 on Oct 9 (merge af32da41b032), which brings in 08a3f02fea63 via the wireless-2026-10-07 pull, so it should be in v7.3-rc7. It isn't in a 7.2.y release yet (latest is v7.2.9) and linux-omarchy is still 7.2.5-3, so this doesn't change what the PR waits on, only how close it is.

Once a linux-omarchy with the fix is out, I can run this PR's unit through repeated s2idle cycles on the stock kernel here. S3 I can't test: deep sleep never comes back on this MacBookPro14,3.

@TheoAndersen

Copy link
Copy Markdown

Tested on hardware, against ff52b69.

Machine: MacBookPro11,5 (mid-2015 15", Haswell), mem_sleep=deep (S3)
Wi-Fi: BCM43602 802.11ac [14e4:43ba] (rev 01), the same chip as the MacBookPro12,1 in the description
Kernel: linux-omarchy 7.2.5 + upstream 08a3f02fea63 ("wifi: brcmfmac: fix P2P device removal race", in v7.3-rc7, not yet in 7.2.y)

Result: 2 lid-close S3 cycles, and Wi-Fi came back both times: firmware reloaded, wlp4s0 re-created and NetworkManager reconnected on its own. No kernel warnings or oopses.

Without the service the radio is dead after the first resume (the same symptoms as the PR description).

journalctl -b -k -u omarchy-brcmfmac-suspend
07:51:32 systemd[1]: Starting Reset Broadcom Wi-Fi around sleep on affected Apple hardware...
07:51:34 kernel: ieee80211 phy0: brcmf_msgbuf_query_dcmd: Timeout on response for query command
07:51:34 kernel: ieee80211 phy0: brcmf_fil_cmd_data: bus is down. we have nothing to do.
07:51:37 systemd[1]: Finished Reset Broadcom Wi-Fi around sleep on affected Apple hardware.
07:51:37 kernel: PM: suspend entry (deep)
07:52:02 kernel: PM: suspend exit
07:52:02 systemd[1]: Stopped Reset Broadcom Wi-Fi around sleep on affected Apple hardware.
07:52:02 kernel: brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43602-pcie for chip BCM43602/1
07:52:03 kernel: brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43602/1 wl0: Nov 10 2015 06:38:10 version 7.35.177.61 (r598657) FWID 01-ea662a8c
07:52:03 kernel: brcmfmac 0000:04:00.0 wlp4s0: renamed from wlan0
08:09:33 systemd[1]: Starting Reset Broadcom Wi-Fi around sleep on affected Apple hardware...
08:09:33 kernel: ieee80211 phy1: brcmf_fil_cmd_data: bus is down. we have nothing to do.
08:09:33 kernel: ieee80211 phy1: brcmf_notify_escan_complete: Scan abort failed
08:09:33 systemd[1]: Finished Reset Broadcom Wi-Fi around sleep on affected Apple hardware.
08:09:33 kernel: PM: suspend entry (deep)
08:09:52 kernel: PM: suspend exit
08:09:52 systemd[1]: Stopped Reset Broadcom Wi-Fi around sleep on affected Apple hardware.
08:09:52 kernel: brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43602/1 wl0: Nov 10 2015 06:38:10 version 7.35.177.61 (r598657) FWID 01-ea662a8c
08:09:52 kernel: brcmfmac 0000:04:00.0 wlp4s0: renamed from wlan0

The "bus is down" / "Scan abort failed" lines during pre are expected: they come from the unbind tearing the interface down. Without 08a3f02fea63 that unbind can race P2P device removal in brcmfmac, which is worth knowing about for kernels that don't carry it yet.

@omarchybot

Copy link
Copy Markdown
Collaborator

Checked again at ff52b69a2e6b22093e241e458e1f438c3eb1765c after @TheoAndersen's hardware test and @makoni's kernel update. The code has not changed, so nothing was rerun on a worker; the last run at this commit (./test/cli and the full ./test/shell, 2274 passed) still stands, and it cannot see a kernel race anyway.

The new hardware test. On a MacBookPro11,5 with a BCM43602 (14e4:43ba) in deep S3, the configuration this pull request was written for, two lid-close cycles at this commit brought Wi-Fi back each time, with no oops. That is the first S3 run of this commit, and it supports the approach. It ran on a kernel with the brcmfmac fix built in, so it says nothing about the kernel users have today. It also does not count as the project's hardware confirmation, which has to come from the reporter of an issue or a maintainer.

The kernel. I confirmed 08a3f02fea63 ("wifi: brcmfmac: fix P2P device removal race in brcmf_detach()") is in mainline and tagged in v7.3-rc7. It is not in linux-7.2.y as of v7.2.10, and linux-omarchy in omarchy-pkgs is 7.2.8-5 with no brcmfmac patch. So on the kernel Omarchy ships, the unbind in bin/omarchy-hw-brcmfmac-suspend can still hit the oops makoni reported, and the blocker from the last review stands.

Still open at this head: the two changes from the last review. The unit is still WantedBy=sleep.target with no check on which kind of sleep it is, so it also unbinds on s2idle and hibernate. Nothing checks that the loaded brcmfmac carries the fix, so a migration can enable it under an old kernel. I have not pushed either. A driver gate cannot name a fixed linux-omarchy until one exists, and an S3-only gate changes which machines the service runs on, so it needs a new hardware run before it counts.

Related: draft #12688 now carries a sleep hook that does the same unbind for the same chips, so it has the same kernel dependency. #7180, #10332, #11570 and #12314 are as described last time.

Second opinion (Codex Medium): it read the upstream and 7.2.y core.c itself and agrees on all of the above. It found no new defect at this head. It considers both gates contained enough to push; I left them because neither can be proven yet. Its independence is not guaranteed, because it can read this session's notes.

What it waits on: the maintainer. The brcmfmac fix has to reach the Omarchy kernel, either through a 7.2.y stable release or as a patch on linux-omarchy. After that, it needs the two gates and repeated S3 cycles on an affected Mac running the shipped kernel.

@makoni

makoni commented Oct 16, 2026

Copy link
Copy Markdown

The kernel side of the blocker here is fixed in a stable release: 7.2.11 (2026-10-15) carries 08a3f02fea63 as 47ca6395a1d9. linux-omarchy isn't there yet (7.2.8-5 in edge, 7.2.5-3 in stable, no 7.2.11 bump in omarchy-pkgs). Once it is, I'll run this PR's unit through repeated s2idle cycles on the shipped kernel here, as I said above.

Until 08a3f02fea63 ("wifi: brcmfmac: fix P2P device removal race in brcmf_detach()"), unbinding the device can race wpa_supplicant deleting the P2P interface and oops in _cfg80211_unregister_wdev. A MacBookPro14,3 running this unit on 7.2.5 hit exactly that on its second sleep, and no suspend succeeded until a hard power-off. The fix reached stable as 47ca6395a1d9 in 7.2.11 and mainline in 7.3-rc7, while linux-omarchy is still 7.2.8.

Check the running kernel rather than the installed package, so a migration that enables the unit under an old kernel stays inert until the machine boots one that carries the fix. An unfixed kernel leaves the radio bound and records nothing, so post has nothing to rebind and sleep goes ahead as it would without the unit. Release candidates, recognised by rc followed by a digit so that Arch's arch1 suffix is not one, are refused outright: stripping the suffix makes 7.3-rc1 through rc6 sort above 7.2.11 though they lack the fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Codex Medium <[email protected]>
@omarchybot

Copy link
Copy Markdown
Collaborator

Checked again after @makoni's note that 7.2.11 carries the brcmfmac fix, and pushed one commit to your branch, 1b39f36e.

The kernel. I confirmed 47ca6395a1d9 is the stable backport of 08a3f02fea63 ("wifi: brcmfmac: fix P2P device removal race in brcmf_detach()"). It is in v7.2.11 and not in v7.2.10. linux-omarchy in omarchy-pkgs is still 7.2.8-5 with no brcmfmac patch, so Omarchy users don't have the fix yet.

Pushed: 1b39f36, leave the radio bound on a kernel without the fix. Now that a fixed release exists, the gate from the last review can name it. pre in bin/omarchy-hw-brcmfmac-suspend now reads the running kernel from uname -r, not the installed package. Below 7.2.11, it leaves Wi-Fi bound and records nothing, so post has nothing to rebind and sleep goes ahead as it would without the unit. It also refuses release candidates, because 7.3.0-rc6 would otherwise sort above 7.2.11 even though only rc7 carries the fix. The installer and migration are unchanged. On an old kernel the unit gets installed but does nothing. It starts unbinding on the first boot into 7.2.11 or later, so this no longer has to wait for the kernel bump to be safe to land. The new cases in test/shell.d/brcmfmac-suspend-test.sh fail against ff52b69a and pass at 1b39f36e.

Tests: these ran on a disposable Omarchy ISO worker VM at 1b39f36e: ./test/cli (116 passed), the helper's test, and the full ./test/shell. In the full suite, 179 of 181 files passed. runtime-smoke-test.sh and screenshot-sanity-test.sh failed with jq parse errors, and they fail the same way with your original files swapped back in, so that is the worker against this branch's older base, not this change. The worker has no Broadcom radio, so nothing here proves the sleep cycle on hardware.

Second opinion (Codex Medium): it reviewed the gate over three rounds. It found that a release candidate would get past it, and then that one written without a hyphen (7.3.0rc6, Ubuntu's 070300rc6) would too. Both are fixed in the commit above, with test cases. Its last round found nothing further. Its independence is not guaranteed, because it can read this session's notes.

Still open: the unit is WantedBy=sleep.target with no check on which kind of sleep it is, so it also unbinds on s2idle and hibernate, where the dead-firmware failure hasn't been reported. I left that alone, because it changes which machines the service runs on. @TheoAndersen's two S3 cycles ran an earlier commit on a patched 7.2.5. The project counts hardware confirmation only from an issue's reporter or a maintainer, so that run doesn't count as confirmation either. The choice among this PR, #7180 (draft), #10332, #11570, #12314 and #12688 (draft) is unchanged since the last review.

What it waits on: the maintainer. That means deciding whether the unit should be limited to S3, and choosing among the competing PRs. It also needs a run on an affected Mac booted into a kernel with the fix, either 7.2.11 or later from upstream, or a linux-omarchy that carries it.

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issue was found.

Summary

Adds a sleep service for Apple BCM4350 and BCM43602 Wi-Fi.

  • Apple BCM4350 and BCM43602 Wi-Fi cards reset around sleep.

No new actionable issues were found. omarchybot rejected the earlier request for migration tests because repository rules prohibit them; Greptile conceded that finding.

Diagram

sequenceDiagram
  participant S as Sleep service
  participant H as Helper
  participant W as Wi-Fi device
  S->>H: pre
  H->>H: Check kernel and device ID
  H->>H: Save device address
  H->>W: Unbind brcmfmac
  Note over S,W: System sleeps and wakes
  S->>H: post
  H->>W: Bind brcmfmac
  H->>H: Clear saved state on success
Loading

Reviews (4) · Last reviewed commit: "Merge quattro into the Broadcom suspend ..." · Reviewed by Greptile

Comment thread test/shell.d/brcmfmac-suspend-test.sh Resolved
pre records a matching device even when it is no longer bound to brcmfmac, so a wake whose rebind failed is retried on the next sleep instead of leaving Wi-Fi off for good. Nothing exercised that: every case started with the device bound. This one removes the driver link before pre and checks that pre records the device without writing to unbind, and that post binds it and clears the state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@omarchybot

Copy link
Copy Markdown
Collaborator

Pushed one commit to your branch, e1f7b312, after Greptile's review of 1b39f36e. It adds a test and changes no behaviour.

What Greptile found, and it holds. pre in bin/omarchy-hw-brcmfmac-suspend records every matching device, including one that is no longer bound to brcmfmac, so a wake whose rebind failed gets retried on the next sleep. No test covered that path, because every case started with the device bound. The new case in test/shell.d/brcmfmac-suspend-test.sh removes the driver link before pre. It then checks that pre records the device without unbinding it, and that post binds it and clears the saved state.

Tests: these ran on a disposable Omarchy ISO worker VM at e1f7b312. ./test/cli passed (116), brcmfmac-suspend-test.sh passed (16) and brcmfmac-supplicant-test.sh passed (13). I also ran a copy of the helper changed to record only bound devices, and the new case stopped it. The worker has no Broadcom radio, so nothing here proves the sleep cycle on hardware.

Second opinion (Codex Medium): it found no defect in the new case. It added that the case also fails if pre unbinds regardless of the current driver. Its independence is not guaranteed, because it can read this session's notes.

Unchanged since the last comment: linux-omarchy in omarchy-pkgs is still 7.2.8-5, so on the shipped kernel the unit stays inert until the brcmfmac fix arrives (7.2.11 or later). The unit still runs on every sleep.target, including s2idle and hibernate. The choice among this PR, #7180 (draft), #10332, #11570, #12314 and #12688 (draft) is also unchanged.

What it waits on: the maintainer. That means deciding whether to limit the unit to S3 and choosing among the competing PRs. It also needs a run on an affected Mac booted into a kernel that carries the fix.

@makoni

makoni commented Nov 2, 2026

Copy link
Copy Markdown

As promised, I ran this PR's unit through repeated s2idle cycles on the shipped kernel.

  • MacBookPro14,3, BCM43602 14e4:43ba, linux-omarchy 7.2.15-1 from stable, which carries the brcmfmac unbind fix, with the stock brcmfmac from that package. NetworkManager + wpa_supplicant, lid open.
  • PR head e1f7b312, helper and unit from the branch; the only change was the helper path in the unit (/usr/local/bin instead of /usr/bin).
  • Each cycle: rtcwake -m no -s 25, then systemctl suspend, in s2idle (mem_sleep is [s2idle] deep), about 25 s asleep. p2p-dev-wlp3s0 was there before every sleep, so every unbind had the P2P device to tear down, which is what the 7.2.5 race needed.
Cycles Wi-Fi back Wake to connected Firmware reload
With the unit, on AC 30 30 5 s (once 11 s) every wake
With the unit, on battery 10 10 5 s every wake
Without the unit, on AC 10 10 3.5 s none
Without the unit, on battery 10 10 3.5 s none

Wake to connected is from PM: suspend exit to NetworkManager's Activation: successful in the journal. Every reconnect was on 5 GHz. There was no oops, no unit error and no status_code=16 in any run. Every sleep logged 14 Thunderbolt tb_cfg_read/tb_cfg_write warnings (on the first sleep after boot, 12 plus one xhci disabling already-disabled device), with or without the unit. 7.2.8 logged the same over S3 without the unit, so they're unrelated to this PR.

So on the shipped kernel the unbind/bind is clean here, and the blocker from my first comment is gone. In these short s2idle sleeps, though, the unit bought nothing: Wi-Fi came back without it on AC and on battery, about 1.5 s sooner. That doesn't prove s2idle never needs it. On 7.2.5 in September the firmware here stopped answering twice, 2 s after waking from s2idle sleeps of 26 and 3.5 minutes, and after the first one every later suspend failed until a reboot. I can't say whether the unit would have saved those wakes. Limiting the unit to S3, as the bot suggested, would skip the firmware reload on s2idle but wouldn't cover cases like those.

S3 I still can't test here, because with the stock kernel the Radeon doesn't come back from deep sleep. One thing I found meanwhile that matters for S3 on some Apple BCM43602 boards (this 14,3, also reported on a 14,2 and a 13,3; the 11,5 boots without that bit and 5 GHz works there): after S3 on battery the chip comes back from a power-on reset and loses a chipcontrol bit that 5 GHz needs. A rebind or driver reload doesn't restore it, so 5 GHz joins fail with status_code=16 while 2.4 GHz works. So on those boards this unit alone won't bring 5 GHz back after S3 on battery (on the 14,2, after S3 on AC as well). I've sent a driver fix: https://lore.kernel.org/linux-wireless/[email protected]/

@fatalaa

fatalaa commented Nov 3, 2026

Copy link
Copy Markdown

Tested e1f7b312 on a MacBookPro14,1 (13" 2017, no Touch Bar) with a BCM4350 in deep S3. That's this PR's target chip and sleep state together on the fixed kernel, which I don't think has been covered yet.

  • Omarchy 4.0.6-1, linux-omarchy 7.2.15-1 (stable), mem_sleep is s2idle [deep]
  • BCM4350 14e4:43a3 (rev 05), Apple subsystem 106b:0170, PCI 0000:02:00.0, firmware 7.35.180.133 (r602372), FWID 01-c45b39d6
  • NetworkManager + wpa_supplicant, with feature_disable=0x82000 from fix-brcmfmac-supplicant.sh
  • Helper and unit from the branch; the only change was the helper path in the unit (/usr/local/bin instead of /usr/bin)

Without the unit (7.2.8)

Every boot I checked looked the same. The first resume, even after a 2 minute sleep, left the firmware answering nothing:

ieee80211 phy0: brcmf_msgbuf_query_dcmd: Timeout on response for query command
ieee80211 phy0: _brcmf_set_multicast_list: Setting mcast_list failed, -5
ieee80211 phy0: brcmf_cfg80211_get_channel: chanspec failed (-5)

The next long sleep, 15:22 → 00:26, took the chip off the bus completely, and only a reboot brought it back:

brcmfmac: brcmf_chip_recognition: MMIO read failed: 0xffffffff
brcmfmac: brcmf_pcie_probe: failed 14e4:43a3
brcmfmac: brcmf_pcie_pm_leave_D3: probe after resume failed, err=-19
brcmfmac 0000:02:00.0: PM: failed to resume async: error -19

Two earlier boots ended the same way: timeouts after every resume, then probe after resume failed, err=-19.

With the unit (7.2.15)

Cycles Wi-Fi back PM: suspend exit to Activation: successful
rtcwake + systemctl suspend, lid open (woke after ~5 s) 5 5 4–5 s
Lid close overnight, 10 h 41 min 1 1 5 s

p2p-dev-wlp2s0 existed before every sleep, so every unbind tore down the P2P device. I saw no oops, no call trace, and no query_dcmd timeouts after any wake. Every reconnect was on 5 GHz (5220 MHz). The only errors were one brcmf_cfg80211_get_channel: chanspec failed (-5) / get_tx_power: error (-5) pair while NetworkManager was shutting down before one sleep, before the unbind. Nothing came of it.

omarchybot and others added 2 commits November 16, 2026 17:02
…d test

AGENTS.md on quattro rules out a test for a migration, which runs once and is frozen when it ships, and a test that greps the source for the lines the change added. The migration cases went with the three OMARCHY_BRCMFMAC_* overrides the migration read only so the test could redirect it, and the systemctl stub's is-enabled branch that only they used. The greps of all.sh and the unit file checked that text was present, not that sleep ordering or the failed-start rebind work; that behaviour is systemd's and was checked on a real one. The helper and installer cases stay: they exercise the kernel gate, the record and rebind logic and the hardware gate.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The migration skips systemctl enable when the unit is already enabled, and enable was the only step that made systemd read the file again. A machine that had an earlier copy of the unit installed and enabled, as everyone who tested this by hand does, kept running the old definition until its next reboot.

Co-Authored-By: Codex Medium <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Comment thread migrations/1787013338.sh
Comment on lines +6 to +9
service_source="$OMARCHY_PATH/install/hardware/apple/omarchy-brcmfmac-suspend.service"
service_target="/etc/systemd/system/omarchy-brcmfmac-suspend.service"

sys_vendor="$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null || true)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Migration tests were removed

Removing these path overrides also removed every test for this migration. The remaining tests run the installer, so they no longer check installation, repeat runs, or skipping unaffected hardware for existing users. A broken migration can now pass while the installer still works.

Keep the migration tests by rewriting paths in a temporary copy, as run_leaf already does. Production overrides are not required.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT-6 in Codex (effort setting not exposed), Opus 5.5 High and muse-wonder via pi (thinking high) checked this against the current quattro rules. AGENTS.md says, "No test for a migration." The migration guide also prohibits adding migration tests under test/. The helper logic and installer hardware gate remain tested; the migration is checked by reading and a one-off worker run. The removal in b16ef54 follows those rules, so the migration tests will stay removed. The models agreed; independence is not guaranteed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right, and I apologize for the incorrect comment. If AGENTS.md explicitly states "No test for a migration" and the migration guide prohibits adding migration tests under test/, then removing those tests was the correct move, not a problem.

Thank you for the correction and for citing the actual project guidelines.

Got it — migrations should not have tests under test/ per project conventions; they are verified by reading and one-off worker runs. Shall I remember this as a rule: "Do not flag missing tests for migrations. AGENTS.md and the migration guide prohibit adding migration tests under test/. Migrations are checked by reading and worker runs, not automated tests."?

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed again after the two hardware runs on the shipped kernel, and pushed two commits to your branch, @Rouxgrr. The head is now d314fb38a8b30b762967735eeff6187c5e7668a6. Neither commit touches bin/omarchy-hw-brcmfmac-suspend, the unit or the installer, so they are byte for byte what makoni and fatalaa ran at e1f7b312.

Pushed: b16ef544, the test file brought in line with AGENTS.md on quattro. It rules out a test for a migration and a test that greps the source for the lines a change added. The migration cases are gone, along with the three OMARCHY_BRCMFMAC_* overrides that migrations/1787013338.sh read only so the test could redirect it. The greps of all.sh and the unit file are gone too. They showed the text was there, not that sleep ordering or the rebind after a failed start work. The helper and installer cases stay: the kernel gate, the record and rebind logic, and the hardware gate.

Pushed: d314fb38, the migration reloads systemd when it replaces the unit. It skips systemctl enable when the unit is already enabled, and that was the only step that made systemd read the file again. Anyone who installed an earlier copy by hand, as every tester here has, would have kept running the old definition until a reboot.

Tests: on a disposable Omarchy ISO worker VM (kernel 7.2.15-2-omarchy, no Broadcom radio), with this head merged with current quattro, which merges cleanly. ./test/cli passed (136) and brcmfmac-suspend-test.sh passed. In the full ./test/shell, 422 of 428 files passed. The six that failed (ascii, branding-about-animation, first-run, provision-owner-keyboard, remote-session-service, runtime-smoke) fail the same way with this pull request's files removed. The migration, run the way omarchy-migrate runs it, exits cleanly on unaffected hardware. Nothing on the worker proves the sleep cycle itself.

The hardware runs. fatalaa's is the first of the target chip and sleep state on the shipped kernel: a BCM4350 in deep S3 on linux-omarchy 7.2.15, six of six wakes with Wi-Fi back, one of them after 10 hours, where the same machine without the unit, on 7.2.8, came back from the first resume of every boot they checked with the firmware not answering. makoni's 40 s2idle cycles on 7.2.15 were clean, so the oops that held this up is gone on the kernel users now have. In those cycles Wi-Fi also came back without the unit, about 1.5 s sooner.

Second opinion (Codex Medium and muse-wonder via pi, thinking high): two rounds. Both read the diffs of #7180, #10332 and #12314 without my answer and both chose this one to carry the fix, which agrees with the earlier reviews; their independence is not guaranteed, because they can read this session's notes. Codex found the missing reload fixed above. Both called the test trim a house-rule fix and not a rewrite. Their last round, on the two new commits, found nothing. What else they raised:

  • Left for the maintainer: the unit runs on every sleep.target, so on s2idle and hibernate too. Both models call limiting it to S3 a product choice and not a defect, given makoni's two s2idle wedges on 7.2.5.
  • True, not changed: pre records a matching device that is already unbound, so post binds a radio someone left unbound on purpose. That is the deliberate retry for a failed wake, and it has its own test. The kernel gate reads the version, not the patch: it refuses 7.3-rc7 and later release candidates, which carry the fix, and would pass a custom pre-fix build numbered 7.2.11 or higher. It errs towards leaving Wi-Fi bound. The installer calls sudo though it now runs as root, as fix-suspend-nvme.sh beside it does.
  • Checked and not as described: muse-wonder argued that a pre killed at its 10 s timeout could let post run while the unbind is still in flight, see the driver link, skip the bind and delete the record. On the worker (systemd 262), ExecStopPost of a timed-out start only ran after the main process had been sent SIGTERM, waited out TimeoutStopSec and been killed. So it would take an unbind stuck in the kernel for more than 20 seconds, past a SIGKILL.

#17124 reports this failure on a BCM43602 in deep S3. I have not linked it as fixed, because its reporter later showed the same chip wedging with no suspend involved, which a sleep unit cannot reach.

What it waits on: a run of this head on an affected Mac by someone the project counts for hardware confirmation, which is the reporter of an issue or a maintainer. @rleap, as the reporter of #17124, you are the person whose test would settle it. Your own system-sleep hook would need to come out first, or both will run:

sha=d314fb38a8b30b762967735eeff6187c5e7668a6
src=https://raw.githubusercontent.com/Rouxgrr/omarchy/$sha
sudo curl -fsSL -o /usr/local/bin/omarchy-hw-brcmfmac-suspend "$src/bin/omarchy-hw-brcmfmac-suspend"
sudo chmod 755 /usr/local/bin/omarchy-hw-brcmfmac-suspend
curl -fsSL "$src/install/hardware/apple/omarchy-brcmfmac-suspend.service" |
  sed 's|/usr/bin/omarchy-hw|/usr/local/bin/omarchy-hw|' |
  sudo tee /etc/systemd/system/omarchy-brcmfmac-suspend.service >/dev/null
sudo systemctl daemon-reload
sudo systemctl enable omarchy-brcmfmac-suspend.service

It needs kernel 7.2.11 or later (linux-omarchy 7.2.15 qualifies); on anything older the unit does nothing. After a few lid-close sleeps, please reply here with the full commit above, your model, lspci -nn | grep 14e4, uname -r, whether Wi-Fi came back each time, and journalctl -b -k -u omarchy-brcmfmac-suspend | grep -E 'brcmf|Broadcom'. @estcarisimo, the BCM43602 deep S3 run you planned is still the combination nobody has posted on the shipped kernel, and it would be useful whoever it comes from.

Two things stay with the maintainer: whether the unit should be limited to S3, and the choice among this pull request, #7180 (draft), #10332, #12314 and #12688 (draft).

@ancientastronauttheorist

ancientastronauttheorist commented Nov 21, 2026 •

Copy link
Copy Markdown

Tested on a MacBookPro12,1 (13-inch, Early 2015, BCM43602 14e4:43ba). Omarchy 4.5.0-3, linux-omarchy 7.2.15-1. The bug reproduces here, and this PR fixes it through both sleep paths.

Kernel gate. 7.2.15 carries the stable backport of the P2P removal fix (47ca6395a1d9 in linux-7.2.y, "wifi: brcmfmac: fix P2P device removal race in brcmf_detach()"), so has_unbind_fix passes, and unbinding did not oops in either run below.

Without the fix (systemctl suspend, deep S3, about 2 s actually asleep): 2 s after PM: suspend exit, the usual cascade started and never stopped. That was 49 brcmf_msgbuf_query_dcmd: Timeout on response for query command over 3 minutes, with -5 errors from _brcmf_set_multicast_list, brcmf_cfg80211_get_channel and brcmf_cfg80211_get_tx_power, and NetworkManager logged Couldn't initialize supplicant interface: Timeout was reached three times. Recovery needed a reboot. So on this board even a few seconds of S3 is enough to trigger it.

With this PR (head d314fb38a, installed by hand: the unit as-is except ExecStart/ExecStopPost pointing at /usr/local/bin):

run sleep path asleep firmware timeouts fresh firmware load on resume network back
1 systemctl suspend ~4.5 s 0 yes 6 s after resume
2 lid close → logind ~62 s 0 yes 6 s after lid open

In both runs the unit started before sleep (unbind took ~0.7 s), and ExecStopPost rebound the card about 0.4 s after PM: suspend exit. brcmf_fw_alloc_request loaded brcmfmac43602-pcie again, wlp3s0 came back on a new phy1, and NetworkManager reconnected normally. No kernel warnings.

One more data point on the module-unload approach in #10332. On this kernel, brcmfmac is held by brcmfmac_wcc:

$ lsmod | grep ^brcmfmac
brcmfmac_wcc           12288  0
brcmfmac              667648  1 brcmfmac_wcc
$ pkexec modprobe -r brcmfmac
modprobe: FATAL: Module brcmfmac is in use.

So a plain modprobe -r brcmfmac fails every time here, even with NetworkManager idle. With its errors discarded, that kind of hook would silently do nothing, which may be part of the silent no-op reported on #10332. The sysfs unbind here does not depend on module reference counts, so it does not have this problem.

Tested on my machine with Claude Code's help. Filed by Claude Opus 5.5 via Claude Code.

@ancientastronauttheorist

ancientastronauttheorist commented Nov 21, 2026 •

Copy link
Copy Markdown

One small correction to my report above: the "asleep" figures were partly worked out from journald's receive timestamps, which are frozen during suspend. Recomputed from kernel timestamps (wall time from PM: suspend entry to PM: suspend exit, minus the time the kernel was actually awake):

run reported corrected
without the fix ~2 s ~2.2 s
with the fix, systemctl suspend ~4.5 s ~2.6 s
with the fix, lid close ~62 s ~62 s

The results themselves don't change: 49 timeouts and a dead link without the fix, 0 timeouts and the network back in 6 s with it, in both runs. A third run with the fix (lid closed for about 30 s) also came back in 6 s with 0 timeouts.

Tested on my machine with Claude Code's help. Filed by Claude Opus 5.5 via Claude Code.

@omarchybot

Copy link
Copy Markdown
Collaborator

GPT-6 in Codex (effort setting not exposed) read the current diff, review comments and the new hardware report at d314fb38a8b30b762967735eeff6187c5e7668a6. No code changed and no tests were rerun in this review.

@ancientastronauttheorist's report adds the BCM43602 deep-S3 result missing from the previous review: on a MacBookPro12,1 with linux-omarchy 7.2.15, both manual suspend and lid-close resumed with fresh firmware and Wi-Fi connected in about six seconds, while the control without the unit wedged. This is contributor-reported hardware evidence; the worker cannot reproduce it. The project's confirmation requirement still needs an affected issue's reporter or a maintainer to name the full tested commit. The installation instructions in the previous comment remain applicable.

The separate DeepSeek V4.1 Flash classifier returned no class for the current head, so classification is unsettled and this run stops there. GPT-6 in Codex was the only model to review the change substantively in this run. It is waiting for classification review and qualifying hardware confirmation; the previously reported maintainer decisions remain open.

@omarchybot omarchybot added bug Something isn't working compatibility Make Omarchy work better on everything! and removed bug Something isn't working compatibility Make Omarchy work better on everything! labels Nov 21, 2026
Keep the current hardware setup order and camera installer while retaining the Broadcom sleep-service setup beside the supplicant quirk.

Co-Authored-By: GPT-6 <[email protected]>
@omarchybot

Copy link
Copy Markdown
Collaborator

Classification is now agreed as a hardware compatibility bug. I pushed 9ff07e4c72b624e88ff178a82a9bf30ec84fffa1 to resolve the conflict with current quattro: both the new FaceTime camera setup and this Wi-Fi setup remain. The helper, service, installer, migration and tests are byte-identical to d314fb38a8b30b762967735eeff6187c5e7668a6.

GPT-6 in Codex (effort setting not exposed) checked the change, with second opinions from Opus 5.5 High and muse-wonder via pi (thinking high). Both agreed on the conflict resolution; independence is not guaranteed. On a disposable Omarchy ISO worker, the candidate passed all 136 CLI checks and 12 Broadcom checks. The full shell run completed 439 test files: 435 without failures, including six with skipped checks. The four failures in ASCII rendering, About animation, keyboard provisioning and runtime smoke tests reproduced at the same assertions on the tested base, 5b91db503c904bbfc5f34bdaaa9c708814958f3d. The migration exited cleanly on unaffected hardware. Skips do not count as passes, and the worker has no Broadcom radio.

Opus also raised a timeout limitation. An isolated systemd test confirmed that after a failed start, ExecStopPost cleanup runs before the sleep attempt continues. That cleanup cannot prove Wi-Fi survives the subsequent sleep. Whether an affected radio's unbind exceeds the current ten-second timeout needs a hardware measurement; I have not guessed a longer timeout. Greptile's completed review of the new head found no new actionable issues. Its earlier findings have replies: already-unbound recovery is tested, and current quattro rules prohibit the requested migration tests.

Hardware confirmation still needs an affected issue's reporter or a maintainer to test the full new commit. @rleap, the installation commands above still apply with:

sha=9ff07e4c72b624e88ff178a82a9bf30ec84fffa1

Remove any existing brcmfmac sleep hook first so only one workaround runs, and use a non-RC kernel at least 7.2.11; the helper otherwise leaves Wi-Fi bound. After repeated lid-close sleeps, report the full commit, Mac model, PCI ID, running kernel, whether Wi-Fi returned each time, and the service/kernel journal. Any timed-out unbind needs its duration recorded too.

This remains waiting for that hardware confirmation. Sleep-mode scope and the competing implementations remain maintainer decisions. It does not fix the awake firmware wedges also reported in #17124.

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

Labels

bug Something isn't working compatibility Make Omarchy work better on everything!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants