>>> Unfortunately, PyUSB doesn't have async support yet :(
>>>
>>>
>> Ouch...
>>
>> So what can be done?
>> Direct acess to lubusb? Is it possible to make callback in python?!?
>> Or another library in c is way to go?!?
>>
>> any hint?
>>
> For PyUSB there is nothing to be done on short term, but you can try
> [1]. It is a thin Python wrapper around libusb 1.0.
>
> [1] https://github.com/vpelletier/python-libusb1
>
> Best Regards,
> Wander Lairson Costa
>


Hmm I got into trouble here.
The synchronous work as I get result with (after oppende device)

result=USBdev.controlRead(160, 3, 0, 0, 4096, 1000)


But when I try async I got some error and don't know how to handle it...

the code snipset is:

#***********************
transfer=USBdev.getTransfer()

requestType=160        #ControlWrite request_type defines transfer 
direction (see libusb1.LIBUSB_ENDPOINT_OUT and libusb1.LIBUSB_ENDPOINT_IN)).
request=3            #request to get data from XMEGA
index=0                #not used
bufferOrLen=4096    #Either a string (when sending data), or expected 
data length (when receiving data).
callback=None        #Callback function to be invoked on transfer 
completion. Called with transfer as parameter, return value ignored.
userData=None        #User data to pass to callback function.
timeout=0            #Transfer timeout in milliseconds. 0 to disable.

transfer.setControl(requestType, request, index, bufferOrLen, callback, 
userData, timeout)
#***********************

and eror message is:

Traceback (most recent call last):
   File "usb1test.py", line 25, in <module>
     transfer.setControl(requestType, request, index, bufferOrLen, 
callback, userData, timeout)
   File "/usr/local/lib/python2.7/dist-packages/usb1.py", line 271, in 
setControl
     length = len(buffer_or_len)
TypeError: object of type 'NoneType' has no len()



When I search the usb1.py at line 271 it semms nonsence to me as program 
should never reach that point.

there is part from usb1.py

     if isinstance(buffer_or_len, (int, long)):
             length = buffer_or_len                <-------------I THINK 
PROGRAM SHOULD BE HERE
             string_buffer = create_binary_buffer(length +
                 libusb1.LIBUSB_CONTROL_SETUP_SIZE)
         else:
             length = len(buffer_or_len)        <------------- BUT GAVE 
ERROR HERE


Any hint more?








------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to