Repository navigation
Map the DSP microphone's MONO port and recover it after an update - #54
Conversation
[Medium impact] The PR appears safe to merge, with no actionable issues found in the latest changes. SummaryThe PR supports AUX0 and MONO microphone ports and adds recovery after audio package updates.
Reviews (7) · Last reviewed commit: "Count only array cards asahi-audio build..." · Reviewed by Greptile |
Hardware run: M2 Max (Mac14,6, J416), 2026-10-24 BrisbaneThis PR's mapper was installed over 0.1.4 on a running session (
Caveat: the run needed a lab-only patch to the installed |
e993eb4 to
32ba8ac
Compare
asahi-audio ab1b469 names the mono DSP output MONO instead of AUX0. The mapper only looked for capture_AUX0, so it would stop mapping as soon as Aurora's asahi-audio picks that change up. It now takes the one mono port the DSP offers, AUX0 or MONO, and refuses a DSP that offers both. When an update installs what the DSP graph lacked (aurora-audio without triforce-lv2 left every array Mac but J700 without its DSP microphone, omacom/omarchy-pkgs#1527), no audio event follows: WirePlumber builds the filter only when the array's node appears, so the microphone stayed missing until a restart. The watcher now also polls the LV2, asahi-audio and WirePlumber configuration directories on its two-second schedule. Once a pacman transaction that changed them has finished, and the DSP microphone is missing while an Apple array card is present and enabled, it asks omarchy-audio-watchdog to restart WirePlumber once, regardless of the repair interval. The last signature is kept in the runtime directory, so a watcher that reloads its own upgraded file in the same transaction still sees the change. Macs without an array, or with the card off, are left alone.
…s reloads - The mapping's capture side can be one input_MONO port once PipeWire negotiates against a MONO DSP port; map onto that or onto FL/FR, and refuse a graph offering both shapes. dsp_port() counts every AUX0 and MONO candidate together, so duplicates are refused too. - The update record in the runtime directory now holds the signature and whether the repair is pending, written atomically, so a watcher that execs its upgraded file before the repair ran keeps it. - While that repair is pending it owns recovery: the outage repair and notice wait, a deferred restart is retried after 30 s and not sooner, and a successful one counts as the outage repair. - An unreadable directory leaves the previous signature in place instead of raising through the watcher's wait. - Tests: negotiated MONO, ambiguous graphs, real Audio.array() against card fixtures, the reload sequence, a deferred repair with an overdue outage under mocked time, an unreadable directory, explicit timestamps, and the host's model and sound cards kept out. - Manual wording says the restart is attempted; omarchy-mac 0.1.5.
…oads - A pending repair now checks for a running pacman transaction itself and looks again in 5 s, so a repair deferred during one update never restarts WirePlumber in the middle of the next. - The runtime record keeps the deferred retry time, and a reloaded watcher restores it and its wake, so an early event after a reload does not retry before the 30 s are up. - capture_inputs() counts every FL, FR and MONO candidate: exactly one FL and one FR, or exactly one MONO, and nothing else, is mapped. - The reload test watches no host audio directories; Installed reads AUDIO_FILES when constructed rather than at definition. - README, manual and the linking comment describe negotiated MONO and the attempted restart.
A directory change noticed while a deferred repair was pending cleared its retry time, so the next event asked the watchdog again before 30 s.
The first run of this mapper comes after the update that installed it, and that update may also have brought the plugin the DSP graph lacked (aurora-audio 4.1.aurora3-2 pulls in triforce-lv2). With no record the watcher took the updated tree as its starting point and never saw the change, and with no mapping yet the outage repair never ran either, so the microphone stayed missing until a reboot. A watcher with no record (or a damaged one) now starts with a pending repair due 30 s later. A DSP microphone present by then ends it without a restart, which is the usual case at login; a DSP still missing on a Mac with an enabled array gets the one WirePlumber restart.
32ba8ac to
c19d293
Compare
Audio.array() matched any AppleJ*HPAI or AOP card, so a card without a
microphone graph in asahi-audio's rules could still get the update and
first-look restarts. It now also requires that a rule under
/usr/share/wireplumber/wireplumber.conf.d names the card ("hw:<id>,"),
as aurora-audio's 99-asahi.conf does for AppleJ416HPAI and AppleJ700AOP.
The first look runs once per fresh runtime directory, so a session whose
microphone is still missing 30 s after it starts gets one restart; the
manual says so, and a test covers the second session start.
Summary
Two follow-ups to omacom/omarchy-pkgs#1527 (the missing
triforce-lv2that left the M2 Max's built-in mic silent), inomarchy-audio-asahi-mic-map. omarchy-mac 0.2.2 (rebased on 0.2.0; #56 takes 0.2.1).ab1b469renames the DSP mic's mono output fromAUX0toMONO, and the mapper hardcodedcapture_AUX0.capture_AUX0orcapture_MONO.input_MONOwhen PipeWire negotiates the capture side down to mono./usr/lib/lv2,/usr/share/asahi-audioandwireplumber.conf.d(and their subdirectories).AppleJ*HPAI/AOP), it asksomarchy-audio-watchdogto restart WirePlumber once, regardless of the repair interval.Review
GPT-6 Astra, four rounds. Fixed along the way:
Final verdict: CORRECT.
Tests
omarchy-mac/test/mic-test.shandmic-reload-test.shpass, and CI ran both:Audio.array()against card fixturesInstalledgating, reload and persistenceNot yet verified
Live on the M2 Max (remove
triforce-lv2, reinstall it with the watcher running). The Mac is off the network right now.Depends on #56 for the watchdog to accept automatic restarts on Quickshell 0.3.2; without it the update repair is declined like every other automatic restart.