Repository navigation
Disable MacBook10,1 BCM4350 wakeup through S3 - #14020
omarchybot wants to merge 5 commits into
Conversation
Airport stays armed as ARPT, which holds the radio up for the whole suspend. Do not follow S3 with hibernate on this chassis: that path hung with a dead SPI keyboard. Co-authored-by: Cursor <[email protected]>
The unit and system-sleep hook baked ${OMARCHY_PATH}/bin into files root executes on every boot and suspend. Under omarchy dev link that is a checkout the user owns, so replacing the script there runs it as root, and the baked path outlives omarchy dev unlink. privileged-heredoc-test fails on it. Quote both heredocs and name /usr/bin, where the package installs every bin/ command.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The leaf deleted /etc/systemd/logind.conf.d/30-macbook10-suspend-then-hibernate.conf and sleep.conf.d/30-macbook10-hibernate-delay.conf and reloaded logind. Omarchy has never written either file, so on any machine but the one they were tried on, the only file they can match is one an administrator wrote, and an update would silently change their lid or hibernate policy. The lid action was never this change's to set; it stays as it is. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
[High impact] Adds hardware power-management code that runs at boot and sleep. The PR does not appear safe to merge until service startup and migration retry behavior are addressed. Findings
SummaryThe PR adds a MacBook10,1-specific helper, udev rule, boot service, sleep hook, and migration to disable BCM4350 wakeup during S3.
|
| sudo chmod 755 "$sleep_hook" | ||
|
|
||
| sudo systemctl daemon-reload | ||
| sudo systemctl enable --now omarchy-macbook10-sleep-drain.service |
There was a problem hiding this comment.
Service can start without helper If a MacBook10,1 uses
omarchy dev link and the new helper has not been installed at /usr/bin, this migration still writes and immediately starts a service that requires it. The service fails, the update stops, and the sleep hook also points to the missing helper. Keep the packaged path for root execution, but wait to activate the service until that helper is installed.
| OMARCHY_SYSFS_ROOT="$sys" OMARCHY_ACPI_WAKEUP="$acpi" bash "$apply" | ||
| [[ $(cat "$sys/sys/bus/pci/devices/0000:02:00.0/power/wakeup") == disabled ]] || | ||
| fail "apply disables BCM4350 PCI wakeup" | ||
| [[ $(cat "$acpi") == ARPT ]] || fail "apply toggles ACPI ARPT when it was enabled" "$(cat "$acpi")" |
There was a problem hiding this comment.
ACPI toggle result goes untested The fixture is an ordinary file, so asserting that it now contains
ARPT only proves the helper attempted a write. It cannot verify that /proc/acpi/wakeup changed ARPT from enabled to disabled. The test could pass while the wake source remains enabled; model the toggle or validate the resulting state on hardware.
|
Looks careful, and the quoted heredocs pass
As the description says, this still needs someone with a MacBook10,1 to confirm the drain actually drops (cc #9060). |
The setup stopped touching any resume or sleep configuration, but the test still passed OMARCHY_MACBOOK10_RESUME_CONF to it, which reads as if the leaf had a resume file to write. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Migration markers are per-user, so a second user on the same MacBook re-ran the privileged setup and needed sudo for a repair the machine already had; one who could not elevate would leave it pending and stop every later migration. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
|
Reviewed at 7b9f449 against Pushed to this branch:
What ran: Points raised on this PR, checked against the source:
Waiting on: confirmation from a MacBook10,1. @Skeptomenos, you measured the original drain, and @4ever911, you reported it in #9060. If either of you can test this head, the command can run straight from a checkout without installing anything, and it lasts until the next reboot: git clone https://github.com/basecamp/omarchy.git && cd omarchy
git checkout 7b9f449c3f13af6cbe4222edb911f43d1449e3ef
sudo bash bin/omarchy-hw-macbook10-sleep-drain
bash bin/omarchy-hw-macbook10-sleep-drain status # expect acpi_arpt=disabled and wakeup=disabledThen suspend for a known length of time, ideally overnight, and reply here with:
This addresses only the Wi-Fi wake source. The D3 timeout and the LID0 wake described in #9060 are not covered here. |
| echo "Cut MacBook10,1 S3 drain by disabling Wi-Fi wakeup" | ||
|
|
||
| # The fix is machine-wide, so a second user finds the service enabled and has nothing to escalate for. | ||
| if ! systemctl is-enabled --quiet omarchy-macbook10-sleep-drain.service 2>/dev/null; then |
There was a problem hiding this comment.
Failed start skips migration retry If
systemctl enable --now enables the unit but its initial start fails, the migration stops without a completion marker. On the next run, this is-enabled check skips setup and lets the migration be marked complete even though the service has never started successfully. Check successful activation, not just enablement, before treating the fix as applied.
On the 2017 12-inch MacBook (MacBook10,1), ACPI leaves the Broadcom BCM4350 Wi-Fi card (
ARPT, PCI14e4:43a3) armed as a wake source through S3, which the author measured as roughly a third of a watt of drain while asleep. This disables that wakeup on MacBook10,1 only: a udev rule sets the PCI device'spower/wakeuptodisabled, and a boot oneshot plus a system-sleep hook runomarchy-hw-macbook10-sleep-drain, which does the same and togglesARPTin/proc/acpi/wakeupif it is still enabled. A migration brings existing MacBook10,1 installs along. Lid-close stayssuspend: hibernate on this chassis did not reach S4 and left applespi delivering no keyboard or trackpad input.The unit and the sleep hook run as root on every boot and suspend, so they name
/usr/bin/omarchy-hw-macbook10-sleep-drainthrough quoted heredocs rather than$OMARCHY_PATH/bin. Underomarchy dev linkthat variable points at a checkout the user owns, and a path baked into a root-owned file would let that user's copy run as root, and keep doing so afteromarchy dev unlink.privileged-heredoc-testenforces this. The setup touches no lid or sleep configuration: it writes its three files, enables the oneshot, and leaves/etc/systemd/logind.conf.dandsleep.conf.das it found them.Nothing here has run on a MacBook10,1 at this commit, and the tests stub sysfs, so whether it saves the power it describes rests on someone with the hardware. It is related to #9060, the same model draining overnight, but does not fix it: that report's main causes are the card timing out on entering D3 and a spurious LID0 wake, and this addresses only the Wi-Fi wake source among them.
Supersedes #10314 by @Skeptomenos, whose commits this carries unchanged, with the fixes above on top.