Skip to content

Instantly share code, notes, and snippets.

@frengky
Created January 13, 2016 01:58
Show Gist options
  • Save frengky/ed13a2c7a6bdc69628de to your computer and use it in GitHub Desktop.
Save frengky/ed13a2c7a6bdc69628de to your computer and use it in GitHub Desktop.
Linux UDEV snippets

Linux UDEV snippets

Find out what is the device path

$ udevadm info -q path -n /dev/sda1

Testing the udev rules, make sure its handle the device as expected

$ udevadm test `udevadm info -q path -n /dev/sda1`
KERNEL!="sd[a-z][0-9]", GOTO="not_usb_storage"
## PQI USB Flash Drive
ACTION=="add", ATTRS{idVendor}=="3538", ATTRS{idProduct}=="0901", ENV{DEVTYPE}=="partition", SYMLINK+="usb_pqi%n"
## SONY USB Flash Drive
ACTION=="add", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="05b8", ENV{DEVTYPE}=="partition", SYMLINK+="usb_sony%n"
LABEL="not_usb_storage"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment