libftdi: (tomj) Applied open by description and/or serial patch
[libftdi] / ftdi / ftdi.h
index 50bf454..7d74701 100644 (file)
 #ifndef __libftdi_h__
 #define __libftdi_h__
 
-/* libusb header */
 #include <usb.h>
 
-/* Kernel USB headers */
-#include <linux/usb.h>
-#include <linux/usbdevice_fs.h>
-
-/* Keep this in sync with libusb */
-struct usb_dev_handle {
-  int fd;
-
-  struct usb_bus *bus;
-  struct usb_device *device;
-
-  int config;
-  int interface;
-  int altsetting;
-
-  /* Added by RMT so implementations can store other per-open-device data */
-  void *impl_info;
-};
-
-
 enum ftdi_chip_type { TYPE_AM=0, TYPE_BM=1, TYPE_2232C=2 };
 
 struct ftdi_context {
@@ -47,7 +26,6 @@ struct ftdi_context {
     struct usb_dev_handle *usb_dev;
     int usb_read_timeout;
     int usb_write_timeout;
-    struct usbdevfs_urb *urb;
 
     // FTDI specific
     enum ftdi_chip_type type;
@@ -103,6 +81,8 @@ extern "C" {
     void ftdi_deinit(struct ftdi_context *ftdi);
     void ftdi_set_usbdev (struct ftdi_context *ftdi, usb_dev_handle *usbdev);
     int ftdi_usb_open(struct ftdi_context *ftdi, int vendor, int product);
+    int ftdi_usb_open_desc(struct ftdi_context *ftdi, int vendor, int product,
+                           const char* description, const char* serial);
     int ftdi_usb_close(struct ftdi_context *ftdi);
     int ftdi_usb_reset(struct ftdi_context *ftdi);
     int ftdi_usb_purge_buffers(struct ftdi_context *ftdi);
@@ -124,12 +104,12 @@ extern "C" {
     int ftdi_set_latency_timer(struct ftdi_context *ftdi, unsigned char latency);
     int ftdi_get_latency_timer(struct ftdi_context *ftdi, unsigned char *latency);
 
-    /* init and build eeprom from ftdi_eeprom structure */
+    // init and build eeprom from ftdi_eeprom structure
     void ftdi_eeprom_initdefaults(struct ftdi_eeprom *eeprom);
     int  ftdi_eeprom_build(struct ftdi_eeprom *eeprom, unsigned char *output);
 
-    /* "eeprom" needs to be valid 128 byte eeprom (generated by the eeprom generator)
-       the checksum of the eeprom is valided */
+    // "eeprom" needs to be valid 128 byte eeprom (generated by the eeprom generator)
+    // the checksum of the eeprom is valided
     int ftdi_read_eeprom(struct ftdi_context *ftdi, unsigned char *eeprom);
     int ftdi_write_eeprom(struct ftdi_context *ftdi, unsigned char *eeprom);
     int ftdi_erase_eeprom(struct ftdi_context *ftdi);