akash
Posts: 6
Joined: Fri Jun 07, 2013 3:43 pm

usb error no 13

Mon Jun 17, 2013 10:13 pm

i am using this code to read in python for reading data from my usb barcode scanner on my raspberry pi
import usb.core
import usb.util
import sys

# find our device
dev = usb.core.find(idVendor=0x05e0, idProduct=0x1200)

# was it found?
if dev is None:
raise ValueError('Device not found')

# configuration will be the active one
dev.set_configuration()
print "Device found!"
print dev

#Read value from device

for bRequest in range(255):
try:
read = dev.ctrl_transfer(0x81, bRequest, 0, 0, 8) #read 8 bytes
print "bRequest ", bRequest
print read


but I am getting an this error "USBError: [Errno 13] Access denied (insufficient permission)"
Does anyone know how to get rid of it??
Please help!

Thanks in advance

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: usb error no 13

Mon Jun 17, 2013 10:30 pm

Direct low level access of USB devices requires root permissions so you'll need to launch Python with the prefix sudo.

Richard S.

Return to “Interfacing (DSI, CSI, I2C, etc.)”