Hello Jie,
On Tuesday, 11. August 2009 12:02:41 Jie Zhang wrote:
Would it be possible to move the libusb interface into an abstraction
layer? Most libftdi functions are using usb_control_msg(),
so only a few functions need "specialization".
Not yet. The API changes a lot between libusb 0.1 and 1.0. I attached
the patch I currently have.
The asynchronous API is changed completely with this patch. It fits
better for our needs in UrJTAG, but I don't know intra2net will like it
or not. Only async read is tested here. An example of async read looks
like
Wow, that patch is quite big. Thanks. Looking at the changes in the
public interface (ftdi.h), it should be possible to add a small indirection
layer so we can switch the backends. If we have to, we can break the async
mode for libusb 0.1 as it works on linux only anyway.
I'm currently thinking about adding a typedef like "ftdi_usb_device",
which either points to "usb_device" or "libusb_device" in ftdi.h.
We would need a function table to dispatch calls to usb_control_msg(),
ftdi_write_data_impl(), ftdi_read_data_impl() and so on.
This should really be 100% internal so we can change
the interface easily. What do you think?