illiliti / libudev-zero

Daemonless replacement for libudev
ISC License
202 stars 22 forks source link

RFC: propose helper script interface for writing rules #70

Open Ella-0 opened 4 months ago

Ella-0 commented 4 months ago

Proposes the use of a helper script to allow setting udev properties as a replacement for udev rules. For example setting ACP_IGNORE=1 on the visense pcm in apple silicon macs.

#!/bin/sh -e

if printf '%s\n' "$SYSNAME" | grep '^pcmC.*D2c$'
then
    printf 'ACP_IGNORE=1\n'
fi
xplshn commented 4 months ago

@illiliti Will this not be merged into master/main?

illiliti commented 4 months ago

@illiliti Will this not be merged into master/main?

I like the idea, so it is highly likely I'll merge this. Just need to sort out issues with code.

Ella-0 commented 4 months ago

Addressed all comments and added an example rules script to contrib with the SOUND_INITIALIZED and ACP_IGNORE stuff. Note: this on its own will not fix pipewire since pipewire still depends on the enumeration of parent devices

illiliti commented 4 months ago

Note: this on its own will not fix pipewire since pipewire still depends on the enumeration of parent devices

One could access parent device via $SYSPATH/../ or $SYSPATH/device/, so unless I'm missing something it is indeed possible to fix pipewire.

Ella-0 commented 4 months ago

Note: this on its own will not fix pipewire since pipewire still depends on the enumeration of parent devices

One could access parent device via $SYSPATH/../ or $SYSPATH/device/, so unless I'm missing something it is indeed possible to fix pipewire.

The problem with pipewire is it enumerates the following devices

/sys/devices/platform/sound/sound/card0/pcmC0D0p
/sys/devices/platform/sound/sound/card0/pcmC0D1p
/sys/devices/virtual/sound/timer
/sys/devices/platform/sound/sound/card0/pcmC0D0c
/sys/devices/platform/sound/sound/card0/pcmC0D2c
/sys/devices/platform/sound/sound/card0/controlC0

however the following is intended. card0 is missing. this is due to scan_devices working on /sys/dev/{char,block} but card? does not have an associated character or block device so isn't enumerated.

/sys/devices/platform/sound/sound/card0
/sys/devices/platform/sound/sound/card0/pcmC0D0p
/sys/devices/platform/sound/sound/card0/pcmC0D1p
/sys/devices/virtual/sound/timer
/sys/devices/platform/sound/sound/card0/pcmC0D0c
/sys/devices/platform/sound/sound/card0/pcmC0D2c
/sys/devices/platform/sound/sound/card0/controlC0
illiliti commented 4 months ago

Ah! Right. Forgot about this one. Well, we could switch our enumeration approach to appease pipewire. Let's keep it for later.