Linux udev
#
udevudev
(userspace /dev) is a device manager for the Linux kernel.
udevd
listens to kernel uevents and passes the incoming events to udev.
Users can register custom rules in /etc/udev/rules.d/
.
#
device infoIf you want to know the information of /dev/i2c-1
, run the below command.
The information displayed is useful for writing rules for the device.
#
xx-descriptive-name.rulesFiles 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
#
Example/etc/udev/rules.d/50-gpio.rules
The first line means that if i2c-dev is detected, the group is set to i2c and the mode is set to 0660.