Skip to content

Recover Apple Silicon Bluetooth after resume - #21

Open
malik-na wants to merge 9 commits into
mainfrom
port/498-bluetooth-resume-recovery
Open

malik-na wants to merge 9 commits into
mainfrom
port/498-bluetooth-resume-recovery

Conversation

@malik-na

@malik-na malik-na commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Port of omacom/omarchy-mac#498 by @n0mahd, with the recovery moved into omarchy-mac/. Co-authored commit.

After s2idle the Broadcom Bluetooth firmware can stop answering HCI commands (hci0: command 0x0c01 tx timeout), and only rebinding hci_bcm4377 brings it back. omarchy-bluetooth-resume-fix.service, a vendor unit ordered after the sleep targets, rebinds the Bluetooth PCI function (Wi-Fi on the same chip is not touched) when the kernel logs an HCI command timeout from that controller during the current suspend cycle. A timeout shows that a command failed, not that the controller is still stuck, so it can rebind a controller that would have recovered. A radio you turned off is left alone.

Changes from the source PR:

  • Gated by lib/bluetooth-supported: the runtime's omarchy-hw-apple-silicon predicate (omarchy-hw-platform reports aarch64-apple) plus the PCI ID.
  • The package ships a vendor suspend.target.wants link, so installs and upgrades both get the unit and omarchy-mac-setup-system is unchanged from main. Only systemctl mask turns it off (disable cannot remove the link). The quattro migration is dropped.
  • The watch is tied to the current suspend: it waits up to 10 s for journald to hold the PM: suspend entry the kernel counted in /sys/power/suspend_stats, reads only this boot, and restarts its 20 passes if the Mac suspends again. Without that entry it reads after a journal cursor taken at its start, not a --since time. Hibernate targets are dropped.
  • A second commit adds BCM4388 (14e4:5f72): @oliverlukschander saw the same wedge on an M2 Pro in the source PR's review.
  • omarchy-mac goes to 0.1.5.

Tested: omarchy-mac/test/all and test/integration/all (runtime e1b0e5e9) run natively on an M1 Air (J313, BCM4378) at d277aa9; electron-desktop-repair-test.sh fails there on main too. Before the rebase, the package installed without running setup was wanted by suspend.target and ran after three pm_test=devices suspends. @scottjones's lid-close runs on an M2 Max covered BCM4388: two wedged resumes, each recovered in about 2.5 s with Wi-Fi up. Still needed before release: a lid-close resume through the unit on BCM4387.

@maralcbr

maralcbr commented Oct 9, 2026

Copy link
Copy Markdown
Member

Thanks @malik-na, this is a useful port. A few things need changing before merge:

  1. Reach Macs that upgrade. setup-system is only run at install, a hardware rerun or first boot, and the migration from the source PR was dropped, so existing installs never get the unit enabled. Either enable it on upgrade or document the manual step.
  2. Don't let a Bluetooth failure stop the rest of setup. Under set -e, a failed systemctl enable (setup-system:75) or detection error (:78-80) aborts the speaker and launcher setup that follows. Finish the unrelated setup, then exit nonzero with the marker still pending so it retries.
  3. Tie the journal check to the current suspend cycle (omarchy-bluetooth-resume-fix:85-98). As written, a timeout from an earlier cycle can trigger a rebind. Also either handle the hibernation path properly or drop the hibernate targets from the unit (.service:3,13).
  4. Soften the docs. A tx timeout shows a timeout happened, not that the controller is still stuck, so "healthy controllers are left alone" (README, manual) and "wedged controller confirmed" overclaim.
  5. Add tests: timeouts before the current suspend but after a saved cursor; hci0 disappearing on unbind and returning on bind; setup continuing after a Bluetooth failure; a second suspend during the 20-pass watch.

For release (not the source merge): a real lid-close resume through the unit on both BCM4387 and BCM4388.

malik-na added a commit that referenced this pull request Oct 9, 2026
Review of #21:

- A wants link under /usr/lib/systemd/system/suspend.target.wants runs the
  unit after every suspend on installs and upgrades alike, as the audio
  watchdog's link does, so Macs that only update get it. System setup no
  longer enables it, so a Bluetooth detection failure can no longer stop
  the speaker and launcher setup after it. Turning it off is a mask.
- The watch starts from this suspend's entry: the kernel counts suspend
  attempts in /sys/power/suspend_stats, and the command waits up to 10 s
  for journald to hold that entry before taking its cursor, so an earlier
  cycle's timeouts are never read as this one's. Without it, it watches a
  bounded window from now. Journal reads stay within this boot.
- A suspend during the 20 s watch moves it to the newer resume and restarts
  the watch: systemd will not start the unit again while it runs.
- Hibernation is dropped from the unit; Apple Silicon Macs don't hibernate.
- The README, manual and messages say what was seen (an HCI command
  timeout) instead of claiming a confirmed wedge or a healthy controller.
- Tests: a fixture journal that changes over time covers timeouts after an
  earlier cycle's entry, a lagging journal, an entry that never arrives, a
  second suspend during the watch, hci0 leaving on unbind and returning on
  bind (or not), and setup finishing after a Bluetooth detection failure.
@malik-na

malik-na commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

Thanks @maralcbr. Changes in 1a499ff:

  1. Upgrades: the package ships a wants link under /usr/lib/systemd/system/suspend.target.wants, as the audio watchdog does, so installs and upgrades both get the unit. setup-system no longer enables it; the runtime only runs setup from the install leaves. Turning it off is a mask, and the README and manual say so.
  2. Setup: with no Bluetooth step left, setup-system is back to main's. A test checks that setup finishes, speaker safety included, when lspci fails.
  3. Current cycle: the watch waits up to 10 s for journald to hold the suspend entry the kernel counted in /sys/power/suspend_stats before taking its cursor. Otherwise it falls back to a window from now, and it reads only this boot. A suspend during the watch moves it to the newer entry and restarts the 20 passes. Hibernate targets dropped.
  4. Docs and messages say "HCI command timeout", and note that a rebind may hit a controller that would have recovered.
  5. Tests: a fixture journal that changes over time covers your four cases, plus a lagging journal and an entry that never arrives.

Tested:

  • omarchy-mac/test/all and test/integration/all (runtime 8614160) pass natively on an M1 Air.
  • On the Air (J313, BCM4378), the package built from this commit was installed without running setup, as an update would be. The unit was wanted by suspend.target and ran after 3 pm_test=devices suspends.
  • A second suspend during the watch logged "Suspended again while watching" and watched 20 s from the newer resume.

No wedge occurred, so the rebind itself is covered only by the tests. Still needed for release: lid-close resumes on BCM4387 and BCM4388.

@scottjones

Copy link
Copy Markdown
Collaborator

Thanks @malik-na, this is really careful work. You covered all five of @maralcbr's points, and the logic holds up. Anchoring the watch on the PM: suspend entry count from /sys/power/suspend_stats ties it to this cycle and nothing earlier, and the rebind only touches Bluetooth's PCI function, so Wi-Fi on the same chip stays out of it.

It can't land as is, though, now that #26 has merged and moved main underneath it. Notes against 1a499ff:

Blocking

  1. omarchy-mac/lib/bluetooth-supported:5 compares against the literal apple-silicon. On quattro's runtime (omacom/omarchy@e1b0e5e9, main's CI pin since Follow Omarchy's x86 / aarch64 / aarch64-apple platform names #26), omarchy-hw-platform prints aarch64-apple, so the gate exits 1 and the unit's ExecCondition skips the fix. I ran e1b0e5e9's detector on my 14" M2 Max to confirm. The pattern Follow Omarchy's x86 / aarch64 / aarch64-apple platform names #26 uses in omarchy-mac-setup-system works here and keeps your exit codes:
    omarchy-hw-platform >/dev/null || exit 2
    omarchy-hw-apple-silicon || exit 1
  2. The tests stub the detector as apple-silicon (omarchy-mac/test/bluetooth-test.sh:9-10, :171 and :293, and test/integration/bluetooth-setup-test.sh:13), so they pass while the real runtime skips the fix. Switch them to aarch64-apple and stub the omarchy-hw-apple-silicon predicate. Both base-test.sh helpers on main have stub_apple_predicate for that.
  3. Version: omarchy-mac/version and omarchy-mac/README.md:3 set 0.1.1, which Skip the Electron wrapping on a runtime without its helpers #23 already shipped, and Follow Omarchy's x86 / aarch64 / aarch64-apple platform names #26 took 0.1.2. After the rebase this needs 0.1.3.

Smaller

  • The PR body is out of date. It still says setup enables the unit and honours later disables, but the package now ships a vendor suspend.target.wants link, so only systemctl mask turns it off.
  • The bare command tx timeout form, with no opcode, isn't matched (omarchy-bluetooth-resume-fix:69). That's only ever a missed recovery, never a false one, so it's optional.

Hardware

I can be one of the two test machines you still need. My MacBook Pro 14" M2 Max (J414c) has a BCM4388: Bluetooth at 01:00.1 is 14e4:5f72 (BCM4388_DEVICE_ID in hci_bcm4377) and Wi-Fi at 01:00.0 is brcmfmac's 14e4:4434. So it covers BCM4388, not BCM4387. Once the rebase is in, I'll run a lid-close resume through the unit, plus a manual unbind/bind of 01:00.1 with Wi-Fi up, to check Wi-Fi survives the reset without waiting for a real wedge.

If you'd rather I push the rebase myself, I'm happy to. The branch is in this repo, so just say the word.

malik-na added a commit that referenced this pull request Oct 11, 2026
Review of #21:

- A wants link under /usr/lib/systemd/system/suspend.target.wants runs the
  unit after every suspend on installs and upgrades alike, as the audio
  watchdog's link does, so Macs that only update get it. System setup no
  longer enables it, so a Bluetooth detection failure can no longer stop
  the speaker and launcher setup after it. Turning it off is a mask.
- The watch starts from this suspend's entry: the kernel counts suspend
  attempts in /sys/power/suspend_stats, and the command waits up to 10 s
  for journald to hold that entry before taking its cursor, so an earlier
  cycle's timeouts are never read as this one's. Without it, it watches a
  bounded window from now. Journal reads stay within this boot.
- A suspend during the 20 s watch moves it to the newer resume and restarts
  the watch: systemd will not start the unit again while it runs.
- Hibernation is dropped from the unit; Apple Silicon Macs don't hibernate.
- The README, manual and messages say what was seen (an HCI command
  timeout) instead of claiming a confirmed wedge or a healthy controller.
- Tests: a fixture journal that changes over time covers timeouts after an
  earlier cycle's entry, a lagging journal, an entry that never arrives, a
  second suspend during the watch, hci0 leaving on unbind and returning on
  bind (or not), and setup finishing after a Bluetooth detection failure.
@malik-na
malik-na force-pushed the port/498-bluetooth-resume-recovery branch from 1a499ff to 2e4c968 Compare October 11, 2026 09:35
@malik-na

Copy link
Copy Markdown
Member Author

Thanks @scottjones, this is all fixed and the branch is rebased on d8100ec and force-pushed (2e4c968).

Blocking

  1. lib/bluetooth-supported now asks omarchy-hw-platform >/dev/null || exit 2 then omarchy-hw-apple-silicon || exit 1, your pattern with the same exit codes.
  2. The tests stub aarch64-apple and stub_apple_predicate in omarchy-mac/test/bluetooth-test.sh (including the excluded-chipset case) and test/integration/bluetooth-setup-test.sh.
  3. Version: main already shipped 0.1.3 (ce67a88), so this is 0.1.4 in omarchy-mac/version and omarchy-mac/README.md.

Smaller

  • The PR body is updated for the vendor wants link, systemctl mask, and the current-suspend watch. The setup-contract sentence in the README that still said setup enables recovery is fixed too.
  • I left the bare command tx timeout form unmatched.

Not yet run: I rebased and made these changes on macOS, which can't run the suites, so omarchy-mac/test/all and test/integration/all have not run on the rebased branch. I'll run them on the M1 Air and post the result here. CI will also run.

Hardware: yes please, and thank you. Your BCM4388 lid-close resume through the unit, plus the manual unbind/bind of 01:00.1 with Wi-Fi up, would cover that chip. BCM4387 still needs a tester. No need to push the rebase; it's done.

@scottjones

Copy link
Copy Markdown
Collaborator

Thanks for the rebase, @malik-na. Here are the BCM4388 results from my 14" M2 Max (J414c, Bluetooth 14e4:5f72 at 01:00.1) on 7.1.12-2-20261011.14-sep-ARCH, the omacom/linux-aurora .14 release. Every sleep was a lid close with a Bluetooth speaker playing.

Without the fix

  • 30 s sleep: clean, no Bluetooth errors.
  • 1m43s sleep: hci0 hung from resume. 64 timeout lines (0x0c01 tx timeout, 0x0c1a/0x2005/0x2041 failed -110), repeating until I rebound it by hand.
  • Manual unbind/bind of 0000:01:00.1 with wlan0 up: the driver logged "transport needs hardware reset on next open", "resetting", then "reset done". Bluetooth came back, Wi-Fi stayed up, and the speaker reconnected.

With the fix

I installed omarchy-bluetooth-resume-fix and lib/bluetooth-supported from 2e4c968 by hand (both byte-identical to the PR head), plus the unit with ExecStart pointed at /usr/local/bin, enabled with systemctl enable. So this covers the script and the unit, not the package build or its wants link.

4m27s sleep: hci0 hung again at resume, and the unit caught it.

17:17:19.496 kernel: Bluetooth: hci0: command 0x0c01 tx timeout
17:17:19.557 omarchy-bluetooth-resume-fix: HCI command timeout from hci0 0s after resume (0000:01:00.1); rebinding hci_bcm4377
17:17:21.726 kernel: hci_bcm4377 0000:01:00.1: reset done
17:17:22.063 omarchy-bluetooth-resume-fix: Controller back 0s after the rebind

No timeouts after that. Wi-Fi reconnected normally and the speaker reconnected by itself.

A second lid close (3m26s) did the same: timeouts at resume, rebind started at 17:28:05.99, controller back at 17:28:08.44, no timeouts after, Wi-Fi back within about a second.

So the rebind works on BCM4388, and Wi-Fi on the same chip survives the reset. It's one wedged resume without the fix and two with it, so a small sample, and I haven't compared against the previous kernel. BCM4387 still needs a tester.

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @malik-na, and thanks @scottjones for the BCM4388 runs. All five of my earlier points are fixed at 2e4c968: the vendor wants link reaches upgrades, setup-system is back to main's, the watch is anchored on the suspend_stats count, the docs are softer, and the four tests are there. Scott's gate, test-stub and version points are fixed too. His two wedged lid-close resumes, each recovered in about 2.5 s with Wi-Fi still up, are good evidence for BCM4388.

One fix before merge:

  • omarchy-mac/README.md:15: 2e4c968 replaced "It enables resume recovery only for BCM4378, BCM4387 and BCM4388 on Apple Silicon; Intel/T2 Macs are excluded." That sentence described the Wi-Fi unit, which omarchy-mac-setup-system:53-63 still enables, so the setup contract no longer mentions it. Please put it back as "It enables Wi-Fi resume recovery only for …" and keep the Bluetooth sentence after it.

Non-blocking:

  • The Wi-Fi and Bluetooth recovery units both start after suspend.target with no ordering between them, and they act on the same chip. The Wi-Fi fix reloads brcmfmac, and on some PCIe core revisions brcmfmac's reset (brcmf_pcie_reset_device) uses a chip watchdog that resets every PCIe function, Bluetooth included. Scott's manual test showed Wi-Fi surviving a Bluetooth rebind, but not the reverse, and not both recoveries at once. @scottjones, could you run modprobe -r brcmfmac_wcc brcmfmac && modprobe brcmfmac while an unbind/bind of 0000:01:00.1 is in flight? If that misbehaves, add After=omarchy-wifi-resume-fix.service. I'd rather not add that ordering without evidence, because it delays Bluetooth until Wi-Fi reconnects.
  • Fallback window (omarchy-bluetooth-resume-fix:104-108, :125). When the journal never catches up to the kernel's suspend count (for example, this boot's early kernel lines were vacuumed), every resume waits 10 s, resets started to that moment and reads --since it. That drops the first 10 s, and a clock step after resume (timesyncd) can empty the window. Taking a tail cursor when the script starts (journalctl -kqb -n 0 --show-cursor) and using it in place of --since fixes both. omarchy-wifi-resume-fix uses a cursor for the same reason. A real wedge repeats its timeouts, so this is unlikely to miss one in practice. The test stub ignores the --since value, so this path isn't covered.
  • Nit: README :43 says the fallback "watches a bounded window from its own start". On the count-mismatch path it starts 10 s later. The :116 message says "watching from now" but uses the script's start time.
  • Nit: omarchy-bluetooth-resume-fix:175 "…${elapsed}s after resume": elapsed counts watch passes since anchoring, not time since resume. Scott's log shows "0s after resume" for a timeout logged during device resume. Something like "after N s of watching" would be accurate.
  • Please post the native omarchy-mac/test/all and test/integration/all run on the rebased branch when you have it. BCM4387 lid-close is still open for release, not for this merge.

@malik-na
malik-na requested a review from maralcbr October 17, 2026 10:04

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @malik-na. aa747a8 fixes the README point, and Scott's BCM4388 lid-close runs are good evidence for the rebind.

One fix before merge:

  • Version. Main has since released omarchy-mac 0.1.4 (2d0c5b2), and this branch also sets omarchy-mac/version and README.md:3 to 0.1.4. GitHub reports no conflict because the two bumps are identical, so a merge would put the Bluetooth unit under the version that's already published, and nothing would ship it as an upgrade. Please rebase on main and make it 0.1.5. If #30 lands first, drop the bump instead, since it moves bumps into the release PR.

Still open from my last review, not blocking:

  • The native omarchy-mac/test/all and test/integration/all run on the rebased branch. CI is green on the merge ref, so a post after the rebase is enough.
  • The journal cursor in place of --since for the fallback window (omarchy-bluetooth-resume-fix:104-108, :125).
  • BCM4387 lid-close is still needed before release.

malik-na and others added 8 commits October 23, 2026 00:17
Port omacom/omarchy-mac#498 into the hardware package, with controller-specific journal recovery and setup that preserves administrator choices.

Co-authored-by: n0mahd <39080654+n0mahd@users.noreply.github.com>
On an M2 Pro (t6020, 14e4:5f72) the controller wedged across 2 of 7
suspends with the same HCI tx timeout signature before PM: suspend exit,
and reloading hci_bcm4377 brought it back, as reported in the review of
omacom/omarchy-mac#498. The source PR left BCM4388 out only because its
one report then was the rfkill path; this adds it to the gate, the setup
tests, the README and the manual.

Co-authored-by: Oliver Lukschander <33756270+oliverlukschander@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #21:

- A wants link under /usr/lib/systemd/system/suspend.target.wants runs the
  unit after every suspend on installs and upgrades alike, as the audio
  watchdog's link does, so Macs that only update get it. System setup no
  longer enables it, so a Bluetooth detection failure can no longer stop
  the speaker and launcher setup after it. Turning it off is a mask.
- The watch starts from this suspend's entry: the kernel counts suspend
  attempts in /sys/power/suspend_stats, and the command waits up to 10 s
  for journald to hold that entry before taking its cursor, so an earlier
  cycle's timeouts are never read as this one's. Without it, it watches a
  bounded window from now. Journal reads stay within this boot.
- A suspend during the 20 s watch moves it to the newer resume and restarts
  the watch: systemd will not start the unit again while it runs.
- Hibernation is dropped from the unit; Apple Silicon Macs don't hibernate.
- The README, manual and messages say what was seen (an HCI command
  timeout) instead of claiming a confirmed wedge or a healthy controller.
- Tests: a fixture journal that changes over time covers timeouts after an
  earlier cycle's entry, a lagging journal, an entry that never arrives, a
  second suspend during the watch, hci0 leaving on unbind and returning on
  bind (or not), and setup finishing after a Bluetooth detection failure.
The runtime's omarchy-hw-platform names a Mac aarch64-apple, so the literal
apple-silicon comparison skipped the fix there. Ask omarchy-hw-apple-silicon,
as omarchy-mac-setup-system does, and stub it in the tests over an
aarch64-apple detector.
2e4c968 replaced the sentence about the Wi-Fi resume unit, which
omarchy-mac-setup-system still enables, rather than adding the Bluetooth
one after it. Put it back, naming Wi-Fi, ahead of the Bluetooth sentence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main released 0.1.4 in 2d0c5b2, so the unit needs its own version to
ship as an upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the journal never holds this suspend's entry, the watch read --since
a time taken after the 10 s wait, dropping those seconds, and a clock step
after resume could empty the window. It now reads after the kernel journal's
tail as the service started, or as of the pass before a suspend during the
watch, as omarchy-wifi-resume-fix does. The journal stub filters by cursor
alone, so the tests cover that path: a timeout logged during the wait is
read, and a second suspend with no entry reads from the pass before it.

The rebind message counts seconds of watching, not since resume, and the
fallback messages and README say where the window starts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@malik-na
malik-na force-pushed the port/498-bluetooth-resume-recovery branch from aa747a8 to d277aa9 Compare October 22, 2026 18:51
@malik-na

Copy link
Copy Markdown
Member Author

Thanks @maralcbr. Rebased on main (c0356a2) and force-pushed as d277aa9.

Blocking

From your earlier review (d277aa9)

  • Fallback window: the script takes a tail cursor (journalctl -kqb -n 0 --show-cursor) when it starts and reads --after-cursor from it instead of --since. A timeout logged during the 10 s wait is no longer dropped, and a clock step after resume can't empty the window. When the Mac suspends again during the watch, the fallback starts from the cursor taken on the pass just before that suspend. --since is gone.
  • Tests: the journal stub now filters by cursor only, so the fallback path is covered. Two new cases: a timeout logged while waiting for an entry that never arrives gets rebound, and after a second suspend with no entry the watch reads after the previous pass's cursor (a timeout from another adapter before it is ignored). Both new cases fail on the old script.
  • Nits: the rebind message now says "after N s of watching". The fallback messages say where the window starts ("the service's start" or "just before the latest suspend"). README :43 describes the cursor.

Tested natively at d277aa9 on an M1 Air (J313, BCM4378 14e4:5f69), runtime e1b0e5e9:

  • omarchy-mac/test/all: passes (106 ok).
  • test/integration/all with OMARCHY_TEST_RUNTIME: bluetooth-setup-test.sh and every other test pass except electron-desktop-repair-test.sh, which fails at its "runtime has no" assertion. It fails the same way on main on this machine, so it isn't from this branch.

BCM4387 lid-close is still needed for release.

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change affects Bluetooth recovery on a limited set of Apple Silicon Macs.

The PR should not merge yet because journal cleanup can still prevent Bluetooth recovery after resume.

Findings

  1. P1 Journal cleanup breaks Bluetooth recovery ▶

Summary

Adds automatic Bluetooth recovery after suspend on supported Apple Silicon Macs.

  • Supported Macs recover Bluetooth after a timeout during resume.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Suspend finishes] --> B[Vendor service starts]
  B --> C{Supported Mac and enabled radio?}
  C -->|No| D[Exit without changes]
  C -->|Yes| E[Choose this suspend's journal cursor]
  E --> F[Watch for this controller's timeout]
  F -->|No timeout| D
  F -->|Another suspend| E
  F -->|Timeout| G{Radio still enabled?}
  G -->|No| D
  G -->|Yes| H[Unbind and bind Bluetooth PCI function]
  H --> I[Wait for controller to return]
Loading

Reviews (2) · Last reviewed commit: "Merge origin/main into port/498-bluetoot..." · Reviewed by Greptile

Comment on lines +108 to +115
kernel=$(journalctl -kqb --no-pager -o cat 2>/dev/null) || return 2
seen=$(grep -c 'PM: suspend entry' <<<"$kernel" || true)
if [[ -z $attempts ]] || (( seen >= attempts )); then
break
fi
if (( waited >= wait_journal )); then
echo "The journal has no entry for this suspend after ${wait_journal}s; watching from $mark_origin instead"
cursor=$mark

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Journal cleanup breaks Bluetooth recovery

If journal cleanup removes an earlier suspend entry, anchor() sees fewer entries than the kernel's lifetime suspend count, even when the current entry is present. It waits 10 seconds and falls back to the service-start cursor. That skips timeouts logged during device resume, so Bluetooth can stay stuck despite the timeout being in the journal.

Track the current cycle without requiring all earlier suspend entries to remain, and add a test with an older entry removed.

Main is at 0.2.3 after omarchy-mac-pkgs#32, so this bumps to 0.2.4. The
README keeps main's mpv and microphone wording beside the Bluetooth
resume recovery text.
scottjones added a commit that referenced this pull request Nov 18, 2026
PRs that each bumped omarchy-mac/version kept colliding (#23 and #24 on
0.1.1, #21 and #28 on 0.1.3) or forgot to bump. Only a release reads the
number, through the recipe's pkgver, so the release now sets it: in a
pull request from release/omarchy-mac-<version> that changes only that
file. A new gate fails any other pull request that touches the file.
The README no longer repeats the number.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants