Question

I wanted to read the usb data. for that i am using the pyusb library. and i had written a script

import usb.core
import usb.util

device = usb.core.find(bDeviceClass=9) # 9 is for hub type usb device

if device is None:
    sys.exit("Could not find Id System Barcode Reader.")

if device.is_kernel_driver_active(0):
    print "Kernal Driver Active!"

while running this its giving me the error. like

usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
Was it helpful?

Solution 2

Try to run the file using root user to change the user to root

sudo su root

it will ask the root password

after that you can run the file with the all the access rights.

or use sudo, it will give all the access right of root user.

OTHER TIPS

Every direct access to an hardware (in your case USB) device need root privileges.

So, try to start as root!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top