libudev-zero icon indicating copy to clipboard operation
libudev-zero copied to clipboard

RFC: propose helper script interface for writing rules

Open Ella-0 opened this issue 1 year ago • 10 comments

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

Ella-0 avatar Jul 10 '24 18:07 Ella-0

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

xplshn avatar Jul 11 '24 01:07 xplshn

@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.

illiliti avatar Jul 11 '24 01:07 illiliti

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

Ella-0 avatar Jul 11 '24 18:07 Ella-0

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.

illiliti avatar Jul 11 '24 20:07 illiliti

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

Ella-0 avatar Jul 11 '24 20:07 Ella-0

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

illiliti avatar Jul 11 '24 21:07 illiliti

@illiliti any plans to merge this or work on it?

xplshn avatar Jan 08 '25 21:01 xplshn

Hopefully yes

illiliti avatar Jan 15 '25 13:01 illiliti

Do I understand correctly that every script would run for every event received by every process subscribed to events?

WhyNotHugo avatar May 06 '25 13:05 WhyNotHugo

Hi sorry about the delay on this. I am very very busy at the moment.

Ella-0 avatar Jun 15 '25 15:06 Ella-0