From 4e8afe854fb153ee62195c6d5d53a20a34f19b85 Mon Sep 17 00:00:00 2001 From: clowdyffs <48922292+Clowdyffs@users.noreply.github.com> Date: Sat, 26 Sep 2026 03:06:19 -0400 Subject: [PATCH 1/3] Fix BCM4350 Bluetooth coexistence on MacBookPro14,1 --- docs/file-layout.md | 6 + .../90-omarchy-bcm4350-coexistence | 106 ++++++++++ test/shell.d/bcm4350-coexistence-test.sh | 185 ++++++++++++++++++ 3 files changed, 297 insertions(+) create mode 100755 etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence create mode 100644 test/shell.d/bcm4350-coexistence-test.sh diff --git a/docs/file-layout.md b/docs/file-layout.md index 73c48c4f340a..7814244ed855 100644 --- a/docs/file-layout.md +++ b/docs/file-layout.md @@ -140,6 +140,12 @@ logo.{txt,svg}, icon.{txt,png} ──► omarchy-settings /usr/share/omarchy The hardware-conditional `force-igpu` and `keyboard-backlight` sources also live under `default/systemd/system-sleep/`, but their setup commands publish root-owned copies only on machines that need them; they are not installed by `omarchy-settings`. +### BCM4350 Bluetooth coexistence + +`etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence` ships executable through `omarchy-settings`, so package updates also update or retire the quirk. It selects parallel coexistence for MacBookPro14,1 with BCM4350 rev 5 and firmware `7.35.180.133` / `01-c45b39d6` on 2.4 GHz; [the controlled comparison](https://github.com/omacom/omarchy/issues/13297) documents the audio failure under the default hybrid policy. Other hardware, firmware versions, and nondefault policies are preserved. + +The dispatcher runs on network activation, reapply, DHCP changes, and disconnect. It restores hybrid mode when the link leaves 2.4 GHz only if `/run/omarchy-bcm4350-coexistence/` records that it applied parallel mode. New and existing installations pick it up at their next network activation; no copied installer artifact or migration is needed. Roaming within an active connection is checked at the next dispatcher event, not continuously. Reboot/resume and headset microphone calls have not been validated on hardware. + ### Why `etc-overrides/` exists Some files under `/etc/` (`.bashrc` in `/etc/skel`, `nsswitch.conf`, diff --git a/etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence b/etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence new file mode 100755 index 000000000000..3c4080f56916 --- /dev/null +++ b/etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence @@ -0,0 +1,106 @@ +#!/bin/bash + +# The hybrid policy starves A2DP on this Mac's BCM4350 with 2.4 GHz Wi-Fi. +# Measurements and scope: https://github.com/omacom/omarchy/issues/13297 +# Keep other machines out of the vendor-command path entirely. +[[ -r /sys/class/dmi/id/product_name ]] || exit 0 +[[ $( len(response): + raise ValueError('invalid vendor response') + if kind & 0x3fff == 2: + result.extend(response[offset + 4:offset + length]) + offset += (length + 3) & ~3 + if not result: + raise ValueError('empty vendor response') + return bytes(result) + + +def mode(iface): + return struct.unpack_from(' Date: Sun, 27 Sep 2026 18:56:34 -0400 Subject: [PATCH 2/3] Tie BCM4350 coexistence ownership to interface identity --- docs/file-layout.md | 4 +- .../90-omarchy-bcm4350-coexistence | 23 ++++-- test/shell.d/bcm4350-coexistence-test.sh | 70 +++++++++++++++++-- 3 files changed, 87 insertions(+), 10 deletions(-) diff --git a/docs/file-layout.md b/docs/file-layout.md index 7814244ed855..005db735bdbc 100644 --- a/docs/file-layout.md +++ b/docs/file-layout.md @@ -144,7 +144,9 @@ The hardware-conditional `force-igpu` and `keyboard-backlight` sources also live `etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence` ships executable through `omarchy-settings`, so package updates also update or retire the quirk. It selects parallel coexistence for MacBookPro14,1 with BCM4350 rev 5 and firmware `7.35.180.133` / `01-c45b39d6` on 2.4 GHz; [the controlled comparison](https://github.com/omacom/omarchy/issues/13297) documents the audio failure under the default hybrid policy. Other hardware, firmware versions, and nondefault policies are preserved. -The dispatcher runs on network activation, reapply, DHCP changes, and disconnect. It restores hybrid mode when the link leaves 2.4 GHz only if `/run/omarchy-bcm4350-coexistence/` records that it applied parallel mode. New and existing installations pick it up at their next network activation; no copied installer artifact or migration is needed. Roaming within an active connection is checked at the next dispatcher event, not continuously. Reboot/resume and headset microphone calls have not been validated on hardware. +The dispatcher runs on network activation, reapply, DHCP changes, and disconnect. It writes only when the mode needs changing; repeated events with parallel mode active perform no firmware write. It restores hybrid mode when the link leaves 2.4 GHz only if `/run/omarchy-bcm4350-coexistence/` records ownership for the current interface's `ifindex`. Device removal and re-registration discard old ownership, including markers from the previous empty format. New and existing installations pick it up at their next network activation; no copied installer artifact or migration is needed. Roaming within an active connection is checked at the next dispatcher event, not continuously. Reboot/resume and headset microphone calls have not been validated on hardware. + +A boot-only action can lose its effect when brcmfmac reloads firmware during recovery or a cold resume. The event hook handles subsequent network activation and keeps the override limited to the tested 2.4 GHz case. Changing board NVRAM or leaving parallel mode enabled on every band requires separate hardware validation. ### Why `etc-overrides/` exists diff --git a/etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence b/etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence index 3c4080f56916..c6440abcf191 100755 --- a/etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence +++ b/etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence @@ -3,6 +3,10 @@ # The hybrid policy starves A2DP on this Mac's BCM4350 with 2.4 GHz Wi-Fi. # Measurements and scope: https://github.com/omacom/omarchy/issues/13297 # Keep other machines out of the vendor-command path entirely. +case "${2:-}" in + up|reapply|dhcp4-change|dhcp6-change|down) ;; + *) exit 0 ;; +esac [[ -r /sys/class/dmi/id/product_name ]] || exit 0 [[ $( Date: Mon, 5 Oct 2026 16:41:10 -0400 Subject: [PATCH 3/3] Release BCM4350 policy ownership after a confirmed failed write AI-assisted-by: GPT-6.1 Sol high --- .../90-omarchy-bcm4350-coexistence | 3 ++ test/shell.d/bcm4350-coexistence-test.sh | 31 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence b/etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence index c6440abcf191..965130dc13d7 100755 --- a/etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence +++ b/etc/NetworkManager/dispatcher.d/90-omarchy-bcm4350-coexistence @@ -92,6 +92,9 @@ def apply(iface): state.write_text(ifindex + '\n') iovar(iface, 'btc_mode', 4) if mode(iface) != 4: + # A definite nonparallel readback is not an override we own. Exceptions + # leave the marker intact because the write's outcome is still unknown. + state.unlink() raise ValueError('parallel policy readback failed') print('BCM4350: enabled parallel coexistence on 2.4 GHz', file=sys.stderr) elif not on_2ghz and state.exists(): diff --git a/test/shell.d/bcm4350-coexistence-test.sh b/test/shell.d/bcm4350-coexistence-test.sh index 0694796dee1b..51e0be74d46e 100644 --- a/test/shell.d/bcm4350-coexistence-test.sh +++ b/test/shell.d/bcm4350-coexistence-test.sh @@ -65,9 +65,15 @@ else: assert mode in (4, 5) if not config.get('ignore_write'): config['mode'] = mode + if config.get('lose_write_ack') or config.get('lose_readback'): + config['fail_mode_read'] = True (root / 'config').write_text(json.dumps(config)) + if config.get('lose_write_ack'): + sys.exit(1) sys.exit(0) assert value == b'' and name in (b'ver', b'btc_mode') + if name == b'btc_mode' and config.get('fail_mode_read'): + sys.exit(1) payload = config['version'].encode() + b'\\0' if name == b'ver' else struct.pack('