Why does PyUSB / libusb require root (sudo) permissions on Linux?

后端 未结 3 1790
北荒
北荒 2020-12-31 12:25

I have been toying around with PyUSB lately, and found that it works beautifully on Linux (Ubuntu has libusb 0.1 and 1.0, as well as OpenUSB)... but only if I run the progra

3条回答
  •  佛祖请我去吃肉
    2020-12-31 12:57

    You can change the permissions of your usb device node by creating a udev rule. e.g. I added the following line to a file in /etc/udev/rules.d/

    SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664", GROUP="usbusers"
    

    This sets the owner of the device node to root:usbusers rather than root:root

    After adding myself to the usbusers group, I can access the device.

提交回复
热议问题