This isn't entirely pyusb related, but it could possibly affect the future
of pyusb.

I've been working on an LCD controller, with the goal of being able to
control multiple, concurrent devices. I needed USB support for my newest
LCD, so I began work on that using pyusb-0.1. However, it became clear
pretty quickly that I needed an asynchronous solution, so I set out to work
on this wielding ctypes and a fresh copy of libusb-1.0. I've run into some
snags, overcoming most (Python's GIL was getting in the way for instance),
but there's this one issue that just won't go away. See, the operations work
fine synchronously following the steps below in sequence.

We can view asynchronous I/O as a 5 step process:

   1. Allocation: allocate a libusb_transfer (This is self.transfer)
   2. Filling: populate the libusb_transfer instance with information about
   the transfer you wish to perform (libusb_fill_bulk_transfer)
   3. Submission: ask libusb to submit the transfer (libusb_submit_transfer)
   4. Completion handling: examine transfer results in the libusb_transfer
   structure (libusb_handle_events and libusb_handle_events_timeout)
   5. Deallocation: clean up resources (Not shown below)

However, when performing these steps asynchronously only a portion of the
LCD is filled with pixels. I've been through libusb's debug messages and
usbmon's output, and between async and sync there are no differences, except
when I look at the LCD for the results. I'm starting to believe that this is
just not possible with Python+ctypes, which is why I said this could
possibly affect pyusb. I am of course hoping for an answer to this, and
having some experience in both Python and libusb I'm hoping maybe you would
have one. I've attached some code if you feel up to looking into this.

Also, I have a question opened at Stackoverflow here:
http://stackoverflow.com/questions/1060305/usb-sync-vs-async-vs-semi-async-partially-answered-now

Attachment: USB4.py
Description: Binary data

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have 
the opportunity to enter the BlackBerry Developer Challenge. See full prize 
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Pyusb-users mailing list
Pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to