libftdi Archives

Subject: Re: merging of libusb-1.0 support into mainline

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 7 Sep 2010 19:16:51 +0200
>>>>> "Emmanuel" == Emmanuel Blot <eblot.ml@xxxxxxxxx> writes:

    >> then there would be no reason at all for the public ftdi.h to include
    >> usb.h or libusb.h.

    Emmanuel> As it has been the case for a long time, this means that the
    Emmanuel> proposed change is an ABI compatibility break, as some
    Emmanuel> softwares may already use this structure...

Sorry for coming that late into the discussion. Much to do at work...

Probably I introduced the colliding patch with much ingorance about
extensability:

@@ -166,8 +175,10 @@
 struct ftdi_context
 {
     /* USB specific */
+    /** libusb's context */
+    struct libusb_context *usb_ctx;
     /** libusb's usb_dev_handle */
-    struct usb_dev_handle *usb_dev;
+    struct libusb_device_handle *usb_dev;
     /** usb read timeout */
     int usb_read_timeout;
     /** usb write timeout */

usb_ctx is only used inside libftdi itself, as in src/ftdi.c and
src/ftdi_stream.c 

As only libftdi references this variable, we can safely move it to the tail
of the ftdi_context structure. If we also keep the asyn buffer from \
version 0:

-    /** Buffer needed for async communication */
-    char *async_usb_buffer;
-    /** Number of URB-structures we can buffer */
-    unsigned int async_usb_buffer_size;

I guess we could use libftdi-1.0/src/ftdi.h for both the libftdi-0 and
libftdi-1. 

We could also make async_usb_buffer/usb_ctx a union, as
async_usb_buffer/usb_ctx also is accessed only inside libftdi0/1.

Bye
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

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

Current Thread