Generate a New udev Rule

Get Info on a Device

udevadm info --name=${dev_node} --attribute-walk

Produce Rule

``` tab="/etc/udev/rules.d/ec25" ACTION=="add", ENV{ID_VENDOR_ID}=="2c7c", ENV{ID_MODEL_ID}=="0125", ATTRS{bInterfaceNumber}=="03", SYMLINK+="ec25-at"


!!! tip
    The match keys are `KERNEL`, `SUBSYSTEM`, `DRIVER` and `ATTR`...
    To match a parent's property too, use the plural, e.g: `ATTRS`.

!!! warning
    When matching against parent properties (e.g: using `ATTRS`), all parent matches must be valid for a single parent.

### Multiple Parents

It sounds like it _should_ be possible to use multiple parents, like this... but I couldn't get it to work.

``` tab="/etc/udev/rules.d/50-ec25.rules"
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{ec25}="yes"
ACTION=="add", ENV{ec25}=="yes", ATTRS{bInterfaceNumber}=="03", SYMLINK+="ec25-at"

``` tab="/etc/udev/rules.d/50-cr10-v3.rules" ACTION=="add", SUBSYSTEM=="tty", KERNELS=="1-2", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="cr10-v3"


## Reload Rules

```bash
udevadm control --reload-rules
udevadm trigger

Test Rule

dev_path="$( udevadm info -q path -n ${dev_node} )"
action="add"
udevadm test -a "${action}" "${dev_path}"

Tip

udevadm test gives you a list of the environment variables that are available!

Reference