From: Prince A. RAMAHEFA-A. <pri...@gm...> - 2012-05-29 11:42:01
|
Hello, I've make this test on PyUSB to recover the data sent of the microcontroller : >import time >import usb.util >import usb.backend >import os >import sys >from usb import * >import ctypes >from ctypes import c_ubyte >import time >ep_write=0x01 >ep_read = 0x81 ># find our device >dev = usb.core.find(idVendor=0x04D8, idProduct=0x0204) ># 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() >d1 = time.time() >while i<10000: > dev.write(ep_write, [0], 0, 18) > data = dev.read(ep_read, 64, 0, 18) > i = i+1 >d2 = time.time() >print d2-d1 and I have : >pythonw -u "py_libusb.py" 20.8320000172 >Exit code: 0 |