[LAU] udev rule for running a ALSA to Jack bridge when USB device is plugged in

Len Ovens len at ovenwerks.net
Tue Dec 3 17:32:32 CET 2019

On Tue, 3 Dec 2019, Max wrote:

> I was trying to create a udev rule to start a zita-a2j ALSA to Jack 
> bridge automatically if i plug in a specific USB device.
> Has anyone succeeded doing something like this?
> One issue is that the user is wrong, udev rules are not launched by the 
> user account.

I chose the other route and listen to the system side of dbus for the 
right signal. This does mean there has to be something running to monitor 
dbus. The up side is that daemon also knows that jack is actually running 
and so only starts zita-ajbridge if there is a jack to work with.

If you are not running dbus then you will need to set your user in the 
script udev calls. Then check that jack is running and then you can run 
zita-ajbridge and detach it so the udev script can exit.

>From experience, you will also need to send the zita-ajbridge a SIGINT 
when UDEV detects that device has left. If you do not have anything 
sitting around to read the exit info from zita-ajbridge it will leave 
zombie processes. While having zombies hanging around is not really a 
problem, actually having zita-ajbridge continue to run after the USB 
device has vanished tends to use a lot of cpu.

Len Ovens

More information about the Linux-audio-user mailing list