PipeWire refuses to use ALSA cards with any subdevice in use
spa/plugins/alsa/alsa-udev.c
has a check (check_pcm_device_availability
) that refuses to probe the entire ALSA card if any subdevice is in use.
For Apple laptops, the layout of our subdevices is:
- hw:0,0: Headphone jack (capture/playback)
- hw:0,1: Speakers (playback)
- hw:0,2: Speaker Sense (capture)
Speaker sense is opened persistently by an out of band daemon (speakersafetyd
) and the kernel side is set up to feed it data (and actually power up the hardware) only when the speaker playback is started. That means that subdevice is always busy, and pipewire then refuses to use the entire card.
This trivial patch fixes the issue, but I don't understand the reasoning behind this check in the first place. The code even notes that with certain kernel config settings, the check cannot be done and always succeeds. Perhaps we should just get rid of this entirely? What purpose does it serve?
This is a blocker for enabling audio on Asahi systems (sorry for only noticing now, I wasn't expecting plugging in speakersafetyd to a separate subdevice to affect PipeWire...).
diff --git a/spa/plugins/alsa/alsa-udev.c b/spa/plugins/alsa/alsa-udev.c
index 3048d7363..b84db3ddd 100644
--- a/spa/plugins/alsa/alsa-udev.c
+++ b/spa/plugins/alsa/alsa-udev.c
@@ -349,6 +349,9 @@ static int check_pcm_device_availability(struct impl *this, struct card *card,
spa_log_debug(this->log, "card %u has %d PCM device(s)",
card->card_nr, *num_pcm_devices);
+
+ return 0;
+
/*
* Check if some pcm devices of the card are busy. Check it via /proc, as we
* don't want to actually open any devices using alsa-lib (generates uncontrolled