PyUSB dev.set_configuration()

前端 未结 2 1861
醉梦人生
醉梦人生 2021-01-14 13:15

I am trying to send data to a usb stick using the python library PyUSB. The code I am using is the following:

import usb.core
import usb.util

# find our dev         


        
相关标签:
2条回答
  • 2021-01-14 13:50

    you have to do - on ubuntu:

    sudo usermod -a -G uucp YOURUSER
    sudo usermod -a -G dialout YOURUSER
    

    and then

    sudo echo "SUBSYSTEM==\"usb\", ATTR{idVendor}==\"YOURVENDOR\", ATTR{idProduct}==\"YOURID\", MODE=\"666\"">/etc/udev/rules.d/99-YOURDEVICENAME.rules
    

    in Your example:

     sudo echo "SUBSYSTEM==\"usb\", ATTR{idVendor}==\"090c\", ATTR{idProduct}==\"1000\", MODE=\"666\"">/etc/udev/rules.d/99-YOURDEVICENAME.rules
    
    0 讨论(0)
  • 2021-01-14 14:00

    I just realized from the tags that you are using Ubuntu. In Ubuntu USB device permissions are tied to the USB device numbers. When Ubuntu ships it comes with global permissions for some standard devices (e.g. flash drives) so that non-root users can use these. However, it does not globally unlock USB devices because some USB devices could be harmful. Please see this post to understand how to modify the Ubuntu configuration (in particular /etc/udev/rules.d/40-basic-permissions.rules) in order to allow your device to be used by non-root users.

    0 讨论(0)
提交回复
热议问题