Debugging udev rules | under Debian

Published: Sat 10 December 2011

In Tech.

tags: linux

I've been playing with the Finch, however today I was unhappy to discover that the robot stopped working again for non-root users. The Finch documentation helpfully links to this blog post on how to write a udev rule, which is the script I was using in the first place.

SUBSYSTEM=="usb", SYSFS{idVendor}=="2354", SYSFS{idProduct}=="1111", MODE="0660", GROUP="plugdev"

Time to figure out how to debug udev rules! The debian wiki hints at a tool called udevtest, which doesn't exist on my system or in aptitude. Turns out nowadays one should use udevadm test instead. Here we go: thanks to lsusb I know that the Finch is on bus 001, device 007.

# udevadm test /dev/bus/001/007

In the output around the rules file for the finch, there is this:

add_rule: unknown key 'SYSFS{idVendor}' in /etc/udev/rules.d/55-finch.rules:1
add_rule: invalid rule '/etc/udev/rules.d/55-finch.rules:1'

Looking for documentation on how to write udev rules, one would find the following guide, which indicates that ATTR should be used instead of SYSFS. Let's rewrite the rule:

SUBSYSTEM=="usb", ATTR{idVendor}=="2354", ATTR{idProduct}=="1111", MODE="0660", GROUP="plugdev"

The error doesn't show in the udevadm test output anymore, and unplugging/replugging the Finch makes it usable by non-root users again. Victory!

links

social