meta data for this page
  •  

This is an old revision of the document!


udevadm

reloading rules

udevadm control --reload-rules

Testing rules

udevadm test /sys/class/tty/ttyACM0

Getting info

udevadm info –attribute-walk –path=/sys/class/tty/ttyACM0

Get Telit modem serial number

udevadm info -q property -n /dev/ttyACM1 | grep ID_SERIAL_SHORT
ID_SERIAL_SHORT=356136070718830

Debug

/etc/udev/udev.conf
udev_log="debug"

Rules

Order

Files should be named xx-descriptive-name.rules, the xx should be chosen first according to the following sequence points:

< 60 most user rules; if you want to prevent an assignment being overriden by default rules, use the := operator.

these cannot access persistent information such as that from vol_id

< 70 rules that run helpers such as vol_id to populate the udev db

< 90 rules that run other programs (often using information in the udev db)

>=90 rules that should run last

Executing commands

SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/usr/bin/true"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/usr/bin/true"
SUBSYSTEM=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_TOUCHSCREEN}=="1", ATTRS{name}=="edt-ft53*", SYMLINK+="input/touchscreen", OPTIONS+="link_priority=100"
SUBSYSTEM=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_TOUCHSCREEN}=="1", ATTRS{name}=="ti-tsc",    SYMLINK+="input/touchscreen", OPTIONS+="link_priority=0"

link_priority: higher has higher priority

Triggering systemd

SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", TAG+="systemd", ENV{SYSTEMD_WANTS}="powersaving.service"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", TAG+="systemd", ENV{SYSTEMD_WANTS}="powersaving.service"
SUBSYSTEM=="printer", TAG+="systemd", ENV{SYSTEMD_WANTS}="printer.target"