Skip to content

libudev-zero: let PipeWire find the sound cards - #31249

Draft
dangowrt wants to merge 1 commit into
openwrt:masterfrom
dangowrt:libudev-zero-sound-initialized
Draft

dangowrt wants to merge 1 commit into
openwrt:masterfrom
dangowrt:libudev-zero-sound-initialized

Conversation

@dangowrt

Copy link
Copy Markdown
Member

📦 Package Details

Maintainer: @dangowrt

Description:
PipeWire's ALSA udev plugin builds its device list from the sound card objects (/sys/class/sound/cardN) and uses only those carrying the SOUND_INITIALIZED property, which udev's 78-sound-card rule sets once alsactl has restored the card. With libudev-zero, PipeWire therefore offers only a dummy output. This adds two libudev-zero patches: udev_device synthesises SOUND_INITIALIZED for sound card devices, the way libudev-zero already synthesises ID_INPUT for input devices, and udev_enumerate also scans /sys/class/<subsystem> for every subsystem the caller matched, without duplicates, since /sys/dev lists only class members with a device node and the card objects have none. Upstream has open pull requests by others for the same two points, illiliti/libudev-zero#69 and illiliti/libudev-zero#71; these patches have not been submitted there.

PipeWire itself is in #30683.

LLM use: the patches, the commit message and this description were written with an LLM coding agent working under my direction, which also ran the test below on my device.


🔬 Run Testing Details

  • OpenWrt Version: SNAPSHOT (main)
  • OpenWrt Target/Subtarget: rockchip/armv8
  • OpenWrt Device: Radxa ROCK 5B
  • PipeWire running in system mode with its ALSA udev plugin: wpctl status lists the es8316 and both HDMI sound cards as sinks, and Kodi's audio device list shows them; without the patches PipeWire offered only its dummy output.

✅ Formalities

If your PR contains a patch:

  • It can be applied using git am
  • It has been refreshed to avoid offsets, fuzzes, etc.
  • It is structured in a way that it is potentially upstreamable

PipeWire's ALSA udev plugin looks for the sound card objects and uses
only those carrying the SOUND_INITIALIZED property, which udev sets
once alsactl has restored the card. Add two patches: one synthesises
the property for sound card devices, as libudev-zero already does with
ID_INPUT for input devices; the other makes the enumerator scan
/sys/class/<subsystem> for every subsystem the caller matched, without
duplicates, since /sys/dev lists only class members with a device node
and the card objects have none.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+ list_entry = udev_list_entry_get_next(&udev_enumerate->subsystem_match);
+
+ while (list_entry) {
+ snprintf(class_path, sizeof(class_path), "/sys/class/%s", udev_list_entry_get_name(list_entry));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Subsystem matches are fnmatch() patterns (filter_subsystem() at udev_enumerate.c:105-111), so a glob match such as sound* builds a literal /sys/class/sound* path, scandir() fails silently, and node-less class members are still missed. Optional: scan /sys/class and fnmatch() each entry against the pattern instead. PipeWire's literal sound match is unaffected, so this does not block the merge.


Generated by Claude Code

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.

2 participants