meta data for this page
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| linux:udev [2016/04/06 12:07] – created niziak | linux:udev [2023/12/13 16:31] (current) – niziak | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | === Debug === | + | ==== udevadm ==== |
| + | === reloading rules === | ||
| + | <code bash> | ||
| + | <code bash> | ||
| + | |||
| + | === Testing rules === | ||
| + | <code bash> | ||
| + | |||
| + | NOTE: This program is for debugging only, it does not run any program specified by a RUN key. It may show incorrect results, because some values may be different, or not available at a simulation run. | ||
| + | |||
| + | ==== Getting info ==== | ||
| + | <code bash> | ||
| + | udevadm info --attribute-walk --path=/ | ||
| + | udevadm info --attribute-walk --name=/ | ||
| + | </ | ||
| + | |||
| + | === Get Telit modem serial number === | ||
| + | <code bash> | ||
| + | udevadm info -q property -n / | ||
| + | ID_SERIAL_SHORT=356136070718830 | ||
| + | </ | ||
| + | |||
| + | ==== Debug ==== | ||
| <file | / | <file | / | ||
| udev_log=" | udev_log=" | ||
| </ | </ | ||
| + | |||
| + | <code bash> | ||
| + | udevadm control --log-priority=debug | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== Rules ==== | ||
| + | === Order === | ||
| + | |||
| + | >Files should be named xx-descriptive-name.rules, | ||
| + | > | ||
| + | > < 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) | ||
| + | > | ||
| + | > > | ||
| + | |||
| + | |||
| + | ==== Executing commands ==== | ||
| + | Triggering commands should be done using RUN, because it is executed after all systemd actions. | ||
| + | < | ||
| + | SUBSYSTEM==" | ||
| + | SUBSYSTEM==" | ||
| + | </ | ||
| + | |||
| + | **RUN vs PROGRAM** | ||
| + | |||
| + | PROGRAM is used to return device name, e.g. to return name for symlink. It is called during device setup, so it is not good place to execute external tools. | ||
| + | |||
| + | |||
| + | < | ||
| + | ACTION==" | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | === Shell ENV === | ||
| + | <code bash> | ||
| + | ID_BUS=usb | ||
| + | DEVNAME=/ | ||
| + | ID_VENDOR_FROM_DATABASE=Telit Wireless Solutions | ||
| + | ACTION=add | ||
| + | ID_SERIAL_SHORT=356611070046259 | ||
| + | ID_USB_DRIVER=cdc_acm | ||
| + | ID_TYPE=generic | ||
| + | MAJOR=166 | ||
| + | DEVPATH=/ | ||
| + | ID_MODEL_ENC=FIH7160 | ||
| + | ID_USB_INTERFACES=: | ||
| + | ID_MODEL=FIH7160 | ||
| + | DEVLINKS=/ | ||
| + | ID_SERIAL=Telit_FIH7160_356611070046259 | ||
| + | SUBSYSTEM=tty | ||
| + | ID_MODEL_ID=0036 | ||
| + | MINOR=0 | ||
| + | ID_PATH=platform-musb-hdrc.0.auto-usb-0: | ||
| + | ID_MODEL_FROM_DATABASE=LE910 V2 | ||
| + | ID_VENDOR_ENC=Telit | ||
| + | ID_PATH_TAG=platform-musb-hdrc_0_auto-usb-0_1_1_0 | ||
| + | ID_VENDOR=Telit | ||
| + | ID_USB_INTERFACE_NUM=00 | ||
| + | ID_VENDOR_ID=1bc7 | ||
| + | ID_REVISION=1730 | ||
| + | </ | ||
| + | |||
| + | |||
| + | === Creating device symlinks === | ||
| + | < | ||
| + | SUBSYSTEM==" | ||
| + | SUBSYSTEM==" | ||
| + | </ | ||
| + | '' | ||
| + | |||
| + | Define symlink name in device tree (add property '' | ||
| + | < | ||
| + | &pwm4 { | ||
| + | pinctrl-names = " | ||
| + | pinctrl-0 = <& | ||
| + | status = " | ||
| + | symlink = " | ||
| + | }; | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | ATTR{device/ | ||
| + | </ | ||
| + | |||
| + | See: | ||
| + | - [[https:// | ||
| + | - [[https:// | ||
| + | - [[https:// | ||
| + | |||
| + | === Triggering systemd === | ||
| + | < | ||
| + | SUBSYSTEM==" | ||
| + | SUBSYSTEM==" | ||
| + | SUBSYSTEM==" | ||
| + | </ | ||
| + | |||
| + | More info about systemd interactions: | ||
| + | |||
| + | === Prevent ModemManager === | ||
| + | <file | / | ||
| + | ATTRS{idVendor}==" | ||
| + | </ | ||
| + | |||