I'm making a custom USB HID device, and a desktop app to go with it, using HIDAPI on Lubuntu 16.04.3 LTS. We'll call it myapp
for now.
Apparently, if I do $ ./myapp
, libusb_open()
fails with LIBUSB_ERROR_ACCESS
. (shown in my debugger as -3
; it took a while to figure that out because the enum doesn't seem to be documented very well)
But if I do $ sudo ./myapp
, it succeeds.
I really don't want myapp
to have root permissions, so how can I talk to my USB device without them?
I was hoping for an answer here, but it seems to have been abandoned at exactly this point. It says something about user permissions, but I can't seem to find that on my system. I thought I might find a group called usb
or libusb
that I could add myself to, but no such luck.
This question on a different SE site has an answer that uses some austere text files to change the permissions either globally (probably a bad idea) or for a specific device, but:
- It's not the "muggle's tweak" that I was looking for.
- Most of those files have a warning against modifying directly because they're auto-generated. So how can I be sure that a random package update isn't going to wipe out my changes and thus break
myapp
? - It doesn't seem to do anything anyway. I followed those instructions and rebooted, and
myapp
with user permissions still can't talk to USB.