2014-09-16 9:51 GMT-03:00 Gerry <[email protected]>:
> I have the following code but it is NOT getting any data.
>
> import usb.core
> import usb.util
> import sys
> VENDOR_ID = 0x24c0
> PRODUCT_ID = 0x0003
> device = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
> if device is None:
> sys.exit("Could not find the Weather Station")
> else:
> print (device)
>
> if device.is_kernel_driver_active(0):
> try:
> device.detach_kernel_driver(0)
> except usb.core.USBError as e:
> sys.exit("Could not detach driver: %s" % str(e))
>
> try:
> device.set_configuration()
> device.reset()
Once you did a reset, the device came back to a unconfigured state.
> except usb.core.USBError as e:
> sys.exit("Could not set configuration: %s" % str(e))
>
> endpoint = device[0][0,0][0]
>
> data = []
>
> data1 += device.read(endpoint.bEndpointAddress, endpoint.wMaxPacketSize)
>
Why not:
data = device.read(endpoint.bEndpointAddress, endpoint.wMaxPacketSize
> It does not give me any error code or anything...NOTHING.
>
> Any ideas????
>
Try to remove the reset() call, if it keeps not working, you can use
the PYUSB_DEBUG=debug environment variable to see what's happening and
report to us.
--
Best Regards,
Wander Lairson Costa
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
pyusb-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyusb-users