1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-26 08:55:18 +03:00
systemd-stable/rules.d
Takashi Sakamoto f125f8b1ba hwdb: add hardware database for unit of IEEE 1394
Current udev rules configures group owner of firewire character device
to video group, corresponding to nodes in IEEE 1394 in below cases:

1.the node with any unit for any minor version of IIDC version 1
  specification defined by 1394 Trading Association
2.the node with any unit for specification defined by Point Grey Research
3.the node with any unit for AV/C device v1.0 defined by 1394 Trading
  Association
4.the node with any unit for vendor-unique protocol defined by 1394
  Trading Association

Nevertheless, case 3 and 4 can cover the node with any unit for audio
function as well. In the cases, it's convenient to assign audio group.

Additionally, some nodes are known to have layout different from
the specification defined by 1394 Trading Association. In the case,
it's required to add rules specific to them.

Furthermore, some nodes have no fields for vendor name and model name in
configuration ROM. In the case, it's required to add entries to hardware
database for users convenience.

For the above reasons, this commit adds rules to use information in
hardware database for known units in IEEE 1394. One database entry
corresponds to one unit. Two types of key are used to match the unit;
customized key from node context, kernel modalias of unit context.
The entry has the type of function, at least. Supplementally, it has
vendor and model names.

For your information, below statements with Python pyparsing module are
expected to parse all of the custom key and module alias in the list:

```
subsystem_prefix = pp.Literal('ieee1394:').suppress()
hex_to_int = lambda a: int(a[0], 16)

node_prefix = pp.Literal('node:').suppress()
prefixed_lower_hex = pp.Combine(pp.Literal('0x') + pp.Word(pp.srange('[a-z0-9]'), exact=6)).setParseAction(hex_to_int)
ven_in_node = pp.dictOf(pp.Literal('ven'), prefixed_lower_hex)
mo_in_node = pp.dictOf(pp.Literal('mo'), prefixed_lower_hex)
unit_in_node = pp.Group(prefixed_lower_hex + pp.Literal(':').suppress() + prefixed_lower_hex)
units_in_node = pp.Group(pp.Literal('units') + pp.ZeroOrMore(pp.Literal('*')).suppress() + unit_in_node + pp.ZeroOrMore(pp.Literal('*')).suppress())
node_parser = subsystem_prefix + node_prefix + ven_in_node + pp.Optional(mo_in_node) + units_in_node

higher_hex = pp.Word(pp.srange('[A-Z0-9]'), exact=8).setParseAction(hex_to_int)
ven_in_unit = pp.dictOf(pp.Literal('ven'), higher_hex)
mo_literal_in_unit = pp.dictOf(pp.Literal('mo'), higher_hex)
mo_in_unit = pp.dictOf(pp.Literal('mo'), higher_hex ^ pp.Literal('*'))
sp_in_unit = pp.dictOf(pp.Literal('sp'), higher_hex)
ver_in_unit = pp.dictOf(pp.Literal('ver'), higher_hex)
unit_parser = subsystem_prefix + ven_in_unit + mo_in_unit + sp_in_unit + ver_in_unit

key_parser = node_parser ^ unit_parser
```

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2021-04-07 11:49:22 +09:00
..
50-udev-default.rules.in hwdb: add hardware database for unit of IEEE 1394 2021-04-07 11:49:22 +09:00
60-autosuspend.rules tools: rewrite make-autosuspend-rules.py and add udev rules 2020-06-22 14:45:20 +02:00
60-block.rules
60-cdrom_id.rules
60-drm.rules
60-evdev.rules rules.d: import the keyboard builtin instead of running it 2020-03-01 14:04:30 +01:00
60-fido-id.rules rules: Move ID_SMARTCARD_READER definition to a <70 configuration. 2021-03-03 15:18:55 +01:00
60-input-id.rules
60-persistent-alsa.rules
60-persistent-input.rules udev: add i2c to 60-persistent-input.rules for by-path (#18808) 2021-03-02 19:56:06 +10:00
60-persistent-storage-tape.rules
60-persistent-storage.rules no blkid for mmcblk[0-9]boot[0-9] 2021-02-13 10:38:29 +01:00
60-persistent-v4l.rules
60-sensor.rules
60-serial.rules Revert "udev: do not execute hwdb builtin import twice or thrice" 2021-03-10 15:26:45 +01:00
64-btrfs.rules.in
70-joystick.rules
70-memory.rules udev: Extract RAM properties from DMI information 2020-12-16 18:32:29 +01:00
70-mouse.rules
70-touchpad.rules
75-net-description.rules
75-probe_mtd.rules
78-sound-card.rules
80-drivers.rules
80-net-setup-link.rules udev: re-assign ID_NET_DRIVER=, ID_NET_LINK_FILE=, ID_NET_NAME= properties on non-'add' uevent 2020-09-15 11:29:35 +09:00
99-systemd.rules.in rules: Move ID_SMARTCARD_READER definition to a <70 configuration. 2021-03-03 15:18:55 +01:00
meson.build Add READMEs in all .d directories 2021-03-26 09:35:07 +01:00
README Add READMEs in all .d directories 2021-03-26 09:35:07 +01:00

Files in this directory contain configuration for systemd-udev.service, a
daemon that manages symlinks to device nodes, permissions of devices nodes,
emits device events for userspace, and renames network interfaces.

See man:udev(7) for an overview of the configuration file format, and
man:systemd-udevd.service(8) for a description of service itself.

Use 'systemd-analyze cat-config udev/rules.d' to display the effective config.