How do I make libusb work as non-root?
It's still not the "muggle's tweak" that I'm really looking for, but at least this works:
Apparently there are two directories for udev (I have no idea why):
/etc/udev/rules.d
/lib/udev/rules.d
I'd been messing with the /lib
one and getting nowhere. I found the /etc
one here, and it does work:
Put SUBSYSTEM=="usb", ATTRS{idVendor}=="VID", ATTRS{idProduct}=="PID", MODE="0666"
VID
is the USB-IF-assigned Vendor ID of the device in question *PID
is the Vendor-assigned Product ID of the device in question *0666
gives universal read/write access to whatever matches this line*
$ lsusb
to see all attached USB devices and their ID's.
In /etc/udev/rules.d/xx-my-rule.rules
(may need root/sudo permissions)
xx
is any number > 50 (the defaults are in 50, and higher numbers take priority)my-rule
is whatever you want to call it- must end in
.rules
Then udevadm control --reload-rules
(may also need root/sudo permissions), and it should "just work" for that specific VID/PID pair.
Another option, to tighten the permissions a little bit more, is to use TAG+="uaccess"
in place of MODE="0666"
. This limits access to the currently-logged-in (physical) user instead of all users. Thanks @Lekensteyn!
For anyone else struggling with this - i needed to add GROUP="plugdev" to my udev rule under Ubuntu 18.04 to make it work.
so for my BTD-400 adapter the file /etc/udev/rules.d/51-usb-device.rules reads:
SUBSYSTEM=="usb", ATTRS{idVendor}=="0a5c", ATTRS{idProduct}=="21e8", GROUP="plugdev", TAG+="uaccess"