Ubuntu – Configure udev to change permissions on USB HID device


I have a USB scale, a USB HID. Currently, when it is plugged in, the permissions only allow the superuser to access it. How can I configure udev to let anybody access this device? I have the vendor and product IDs, but I would like to match it based on the HID type instead.

Right now, I'm having trouble finding any existing rule that applies to this (I grepped for "hidraw" in /lib/udev/rules.d and /etc/udev/rules.d, among other things).

Best Answer

Normally, this is done by adding to /etc/udev/rules.d a file maybe named 50-usb-scale.conf with contents like this:

SUBSYSTEM=="usb", ATTR{idVendor}=="HEX1", ATTR{idProduct}=="HEX2", MODE="0666"

Where HEX1 and HEX2 are replaced with the vendor and product id respectively.

To match on the Interface type instead, you could try replacing ATTR{idVendor}=="HEX1", ATTR{idProduct}=="HEX2" with a match for bInterfaceClass being 03 (HID):

SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="03", MODE="0666"

But be warned, that will catch mice and keyboards too.

Related Question