libftdi Archives

Subject: Re: Use libusb 1.0

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 13 Aug 2009 16:58:37 +0200
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?

>    struct ftdi_transfer_control *tc;
>    tc = ftdi_read_data_submit(...);
>    ...
>    recvd = ftdi_transfer_data_done (tc);

Nice. Speaking of that, I don't see the new interfaces
in ftdi.h. Am I missing something?

> The configure script part is copied from SANE. It needs more tweaks
> after we decide how to deal with libusb 0.1.

Yes, there's still one SANE reference in there ;-)

Cheers,
Thomas


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread