Jordi M
2015-11-09 12:05:08 UTC
Hi all,
I'm trying to connect an ST Micrielectronics board that runs ChiBios OS
to a PC either running Ubunto or windows using PyUsb (I have the same
problem in both Os)
The problem is that it works well the first time but when I re-execute
the sricpt it shows this error and I have to unplug and replug again a
couple of times the usb cable until it works again.
The error message is :
[Errno None] libusb0-dll:err [_usb_reap_async] reaping request failed,
win error: A device attached to the system is not functioning.
Any aidea what is happenning?
Maybe I need to close the device before exiting the script or similar?
My code is:
# find our device
dev = usb.core.find(idVendor=0x0483, idProduct=0xFEDC)
# was it found?
if dev is None:
raise ValueError('Device not found')
# set the active configuration. With no arguments, the first
# configuration will be the active one
#dev.set_configuration()
# get an endpoint instance
cfg = dev.get_active_configuration()
intf = cfg[(0, 0)]
ep = usb.util.find_descriptor(
intf,
# match the first OUT endpoint
custom_match=\
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_OUT)
epr = usb.util.find_descriptor(
intf,
# match the first IN endpoint
custom_match=\
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_IN)
assert ep is not None
assert epr is not None
####Some code######
usb.util.dispose_resources(dev)
print "END"
I'm trying to connect an ST Micrielectronics board that runs ChiBios OS
to a PC either running Ubunto or windows using PyUsb (I have the same
problem in both Os)
The problem is that it works well the first time but when I re-execute
the sricpt it shows this error and I have to unplug and replug again a
couple of times the usb cable until it works again.
The error message is :
[Errno None] libusb0-dll:err [_usb_reap_async] reaping request failed,
win error: A device attached to the system is not functioning.
Any aidea what is happenning?
Maybe I need to close the device before exiting the script or similar?
My code is:
# find our device
dev = usb.core.find(idVendor=0x0483, idProduct=0xFEDC)
# was it found?
if dev is None:
raise ValueError('Device not found')
# set the active configuration. With no arguments, the first
# configuration will be the active one
#dev.set_configuration()
# get an endpoint instance
cfg = dev.get_active_configuration()
intf = cfg[(0, 0)]
ep = usb.util.find_descriptor(
intf,
# match the first OUT endpoint
custom_match=\
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_OUT)
epr = usb.util.find_descriptor(
intf,
# match the first IN endpoint
custom_match=\
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_IN)
assert ep is not None
assert epr is not None
####Some code######
usb.util.dispose_resources(dev)
print "END"