[LAD] New udev rules for firewire character device are added to systemd

Takashi Sakamoto o-takashi at sakamocchi.jp
Fri Apr 23 13:10:49 CEST 2021


Hi,

Summary of this message:
 * systemd got udev rules with new database for firewire node/unit
 * then fw character device for audio is owned by 'audio' group with ACL
 * the entries are added by my investigation, thus doesn't cover all
 * if you have firewire audio devices not listed in README of below
   repository, please contact to me with image of configuration ROM:
    * https://github.com/takaswie/am-config-roms/

The way to create image file of configuration ROM is typically:

```
$ cat /sys/bus/firewire/devices/fw1/config_rom > filename.img
```

Here, I presuppose that Linux FireWire subsystem detects your device as
'fw1'.


Well, in the past, access permission of Linux firewire character device
is decided by udev rules just for video devices[1]. This was
inconvenient some project such as ALSA and FFADO to produce audio
application.

The source code of libffado includes own file for udev rules[2] to take
firewire character device owned by 'audio' group. Additionally the rules
gives 'ID_FFADO' tag, and systemd includes another udev rule[3] to ACL
at logging-in time according to it.

As a whole, the above is not comprehensive and self-contained. I
proposed patchset to systemd for better solution and today it was merged.
 * https://github.com/systemd/systemd/pull/19124

In the patchset, I add some udev rules, based on hwdb for new entries of
node and units in IEEE 1394 bus. You can see the database[4].

The entries of database have below variables when matching to either
node or unit devices:
 * IEEE1394_UNIT_FUNCTION_MIDI
 * IEEE1394_UNIT_FUNCTION_AUDIO
 * IEEE1394_UNIT_FUNCTION_VIDEO

The added udev rules interpret the content of variables and decide group
owner of fw character device(see [1]). Furthermore, the variables are
used again to decide ACL in logging-in time(see [3], too).

The entries of database also include below variables:
 * ID_VENDOR_FROM_DATABASE
 * ID_MODEL_FROM_DATABASE

They are expected to use applications such as PipeWire and PulseAudio for
better names of sound device, which binds to unit instead of node. I
expect the variables can obsolete my former patch for pulseaudio[5].


I handy write the entries of database from my investigation, thus
it could includes the lack of your device, or mistakes. I wish you to
contact to me with image file of configuration ROM when you can not find
your device in README of my collection repository[6], or when you find
any mistakes in database file.

Thanks for your cooperation in advance.

[1] 4 rules in 'rules.d/50-udev-default.rules'
https://github.com/systemd/systemd/blob/main/rules.d/50-udev-default.rules.in#L52
[2] many rules in 'libffado/60-ffado.rules'
http://subversion.ffado.org/browser/trunk/libffado/libffado/60-ffado.rules?rev=2794
[3] 'src/login/70-uaccess.rules.m4'
https://github.com/systemd/systemd/blob/main/src/login/70-uaccess.rules.m4
[4] 'hwdb.d/80-ieee1394-unit-function.hwdb'
https://github.com/systemd/systemd/blob/main/hwdb.d/80-ieee1394-unit-function.hwdb
[5] udev: use ID_MODEL/ID_VENDOR to give friendly name for FireWire devices 
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/3ac73598c67c
[6] https://github.com/takaswie/am-config-roms/


Takashi Sakamoto


More information about the Linux-audio-dev mailing list