A cross-platform user library to access USB devices
libusb.h
1 /*
2  * Public libusb header file
3  * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
4  * Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
5  * Copyright © 2012 Pete Batard <pete@akeo.ie>
6  * Copyright © 2012 Nathan Hjelm <hjelmn@cs.unm.edu>
7  * For more information, please visit: http://libusb.info
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23 
24 #ifndef LIBUSB_H
25 #define LIBUSB_H
26 
27 #ifdef _MSC_VER
28 /* on MS environments, the inline keyword is available in C++ only */
29 #if !defined(__cplusplus)
30 #define inline __inline
31 #endif
32 /* ssize_t is also not available (copy/paste from MinGW) */
33 #ifndef _SSIZE_T_DEFINED
34 #define _SSIZE_T_DEFINED
35 #undef ssize_t
36 #ifdef _WIN64
37  typedef __int64 ssize_t;
38 #else
39  typedef int ssize_t;
40 #endif /* _WIN64 */
41 #endif /* _SSIZE_T_DEFINED */
42 #endif /* _MSC_VER */
43 
44 /* stdint.h is not available on older MSVC */
45 #if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H))
46 typedef unsigned __int8 uint8_t;
47 typedef unsigned __int16 uint16_t;
48 typedef unsigned __int32 uint32_t;
49 #else
50 #include <stdint.h>
51 #endif
52 
53 #if !defined(_WIN32_WCE)
54 #include <sys/types.h>
55 #endif
56 
57 #if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
58 #include <sys/time.h>
59 #endif
60 
61 #include <time.h>
62 #include <limits.h>
63 
64 /* 'interface' might be defined as a macro on Windows, so we need to
65  * undefine it so as not to break the current libusb API, because
66  * libusb_config_descriptor has an 'interface' member
67  * As this can be problematic if you include windows.h after libusb.h
68  * in your sources, we force windows.h to be included first. */
69 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
70 #include <windows.h>
71 #if defined(interface)
72 #undef interface
73 #endif
74 #if !defined(__CYGWIN__)
75 #include <winsock.h>
76 #endif
77 #endif
78 
79 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
80 #define LIBUSB_DEPRECATED_FOR(f) \
81  __attribute__((deprecated("Use " #f " instead")))
82 #else
83 #define LIBUSB_DEPRECATED_FOR(f)
84 #endif /* __GNUC__ */
85 
111 /* LIBUSB_CALL must be defined on both definition and declaration of libusb
112  * functions. You'd think that declaration would be enough, but cygwin will
113  * complain about conflicting types unless both are marked this way.
114  * The placement of this macro is important too; it must appear after the
115  * return type, before the function name. See internal documentation for
116  * API_EXPORTED.
117  */
118 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
119 #define LIBUSB_CALL WINAPI
120 #else
121 #define LIBUSB_CALL
122 #endif
123 
147 #define LIBUSB_API_VERSION 0x01000103
148 
149 /* The following is kept for compatibility, but will be deprecated in the future */
150 #define LIBUSBX_API_VERSION LIBUSB_API_VERSION
151 
152 #ifdef __cplusplus
153 extern "C" {
154 #endif
155 
164 static inline uint16_t libusb_cpu_to_le16(const uint16_t x)
165 {
166  union {
167  uint8_t b8[2];
168  uint16_t b16;
169  } _tmp;
170  _tmp.b8[1] = (uint8_t) (x >> 8);
171  _tmp.b8[0] = (uint8_t) (x & 0xff);
172  return _tmp.b16;
173 }
174 
183 #define libusb_le16_to_cpu libusb_cpu_to_le16
184 
185 /* standard USB stuff */
186 
195 
198 
201 
204 
207 
210 
212  LIBUSB_CLASS_PTP = 6, /* legacy name from libusb-0.1 usb.h */
213  LIBUSB_CLASS_IMAGE = 6,
214 
217 
220 
223 
226 
229 
232 
235 
238 
241 
244 
247 };
248 
254 
257 
260 
263 
266 
269 
272 
275 
278 
281 
284 
287 
290 };
291 
292 /* Descriptor sizes per descriptor type */
293 #define LIBUSB_DT_DEVICE_SIZE 18
294 #define LIBUSB_DT_CONFIG_SIZE 9
295 #define LIBUSB_DT_INTERFACE_SIZE 9
296 #define LIBUSB_DT_ENDPOINT_SIZE 7
297 #define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
298 #define LIBUSB_DT_HUB_NONVAR_SIZE 7
299 #define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6
300 #define LIBUSB_DT_BOS_SIZE 5
301 #define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3
302 
303 /* BOS descriptor sizes */
304 #define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7
305 #define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10
306 #define LIBUSB_BT_CONTAINER_ID_SIZE 20
307 
308 /* We unwrap the BOS => define its max size */
309 #define LIBUSB_DT_BOS_MAX_SIZE ((LIBUSB_DT_BOS_SIZE) +\
310  (LIBUSB_BT_USB_2_0_EXTENSION_SIZE) +\
311  (LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE) +\
312  (LIBUSB_BT_CONTAINER_ID_SIZE))
313 
314 #define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */
315 #define LIBUSB_ENDPOINT_DIR_MASK 0x80
316 
324 
327 };
328 
329 #define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */
330 
338 
341 
344 
347 
350 };
351 
357 
360 
361  /* 0x02 is reserved */
362 
365 
366  /* 0x04 is reserved */
367 
370 
373 
376 
379 
382 
385 
388 
391 
394 
398 };
399 
407 
410 
413 
416 };
417 
425 
428 
431 
434 };
435 
436 #define LIBUSB_ISO_SYNC_TYPE_MASK 0x0C
437 
446 
449 
452 
455 };
456 
457 #define LIBUSB_ISO_USAGE_TYPE_MASK 0x30
458 
467 
470 
473 };
474 
482  uint8_t bLength;
483 
488 
491  uint16_t bcdUSB;
492 
494  uint8_t bDeviceClass;
495 
499 
503 
506 
508  uint16_t idVendor;
509 
511  uint16_t idProduct;
512 
514  uint16_t bcdDevice;
515 
517  uint8_t iManufacturer;
518 
520  uint8_t iProduct;
521 
523  uint8_t iSerialNumber;
524 
527 };
528 
536  uint8_t bLength;
537 
542 
548 
556  uint8_t bmAttributes;
557 
559  uint16_t wMaxPacketSize;
560 
562  uint8_t bInterval;
563 
566  uint8_t bRefresh;
567 
569  uint8_t bSynchAddress;
570 
573  const unsigned char *extra;
574 
577 };
578 
586  uint8_t bLength;
587 
592 
595 
598 
601  uint8_t bNumEndpoints;
602 
605 
609 
613 
615  uint8_t iInterface;
616 
620 
623  const unsigned char *extra;
624 
627 };
628 
636 
639 };
640 
648  uint8_t bLength;
649 
654 
656  uint16_t wTotalLength;
657 
659  uint8_t bNumInterfaces;
660 
663 
665  uint8_t iConfiguration;
666 
668  uint8_t bmAttributes;
669 
673  uint8_t MaxPower;
674 
678 
681  const unsigned char *extra;
682 
685 };
686 
694 
696  uint8_t bLength;
697 
702 
703 
706  uint8_t bMaxBurst;
707 
712  uint8_t bmAttributes;
713 
717 };
718 
726  uint8_t bLength;
734  uint8_t dev_capability_data
735 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
736  [] /* valid C99 code */
737 #else
738  [0] /* non-standard, but usually working code */
739 #endif
740  ;
741 };
742 
750  uint8_t bLength;
751 
756 
758  uint16_t wTotalLength;
759 
762  uint8_t bNumDeviceCaps;
763 
766 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
767  [] /* valid C99 code */
768 #else
769  [0] /* non-standard, but usually working code */
770 #endif
771  ;
772 };
773 
781  uint8_t bLength;
782 
787 
792 
797  uint32_t bmAttributes;
798 };
799 
807  uint8_t bLength;
808 
813 
818 
823  uint8_t bmAttributes;
824 
827  uint16_t wSpeedSupported;
828 
834 
836  uint8_t bU1DevExitLat;
837 
839  uint16_t bU2DevExitLat;
840 };
841 
849  uint8_t bLength;
850 
855 
860 
862  uint8_t bReserved;
863 
865  uint8_t ContainerID[16];
866 };
867 
876  uint8_t bmRequestType;
877 
883  uint8_t bRequest;
884 
886  uint16_t wValue;
887 
890  uint16_t wIndex;
891 
893  uint16_t wLength;
894 };
895 
896 #define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
897 
898 /* libusb */
899 
900 struct libusb_context;
901 struct libusb_device;
902 struct libusb_device_handle;
903 struct libusb_hotplug_callback;
904 
910  const uint16_t major;
911 
913  const uint16_t minor;
914 
916  const uint16_t micro;
917 
919  const uint16_t nano;
920 
922  const char *rc;
923 
925  const char* describe;
926 };
927 
946 
963 
964 
974 
981 
984 
987 
990 
993 };
994 
1002 
1005 
1008 
1011 };
1012 
1021 };
1022 
1031 };
1032 
1039 
1042 
1045 
1048 };
1049 
1060 
1063 
1066 
1069 
1072 
1075 
1078 
1081 
1084 
1087 
1090 
1093 
1096 
1097  /* NB: Remember to update LIBUSB_ERROR_COUNT below as well as the
1098  message strings in strerror.c when adding new error codes here. */
1099 
1102 };
1103 
1104 /* Total number of error codes in enum libusb_error */
1105 #define LIBUSB_ERROR_COUNT 14
1106 
1113 
1116 
1119 
1122 
1126 
1129 
1132 
1133  /* NB! Remember to update libusb_error_name()
1134  when adding new status codes here. */
1135 };
1136 
1142 
1145 
1151 
1176 };
1177 
1182  unsigned int length;
1183 
1185  unsigned int actual_length;
1186 
1189 };
1190 
1191 struct libusb_transfer;
1192 
1202 typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transfer);
1203 
1213 
1215  uint8_t flags;
1216 
1218  unsigned char endpoint;
1219 
1221  unsigned char type;
1222 
1225  unsigned int timeout;
1226 
1235 
1237  int length;
1238 
1243 
1247 
1249  void *user_data;
1250 
1252  unsigned char *buffer;
1253 
1257 
1260 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
1261  [] /* valid C99 code */
1262 #else
1263  [0] /* non-standard, but usually working code */
1264 #endif
1265  ;
1266 };
1267 
1286 };
1287 
1299  LIBUSB_LOG_LEVEL_NONE = 0,
1300  LIBUSB_LOG_LEVEL_ERROR,
1301  LIBUSB_LOG_LEVEL_WARNING,
1302  LIBUSB_LOG_LEVEL_INFO,
1303  LIBUSB_LOG_LEVEL_DEBUG,
1304 };
1305 
1308 void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
1309 const struct libusb_version * LIBUSB_CALL libusb_get_version(void);
1310 int LIBUSB_CALL libusb_has_capability(uint32_t capability);
1311 const char * LIBUSB_CALL libusb_error_name(int errcode);
1312 int LIBUSB_CALL libusb_setlocale(const char *locale);
1313 const char * LIBUSB_CALL libusb_strerror(enum libusb_error errcode);
1314 
1316  libusb_device ***list);
1318  int unref_devices);
1321 
1323  int *config);
1325  struct libusb_device_descriptor *desc);
1327  struct libusb_config_descriptor **config);
1329  uint8_t config_index, struct libusb_config_descriptor **config);
1331  uint8_t bConfigurationValue, struct libusb_config_descriptor **config);
1333  struct libusb_config_descriptor *config);
1335  struct libusb_context *ctx,
1336  const struct libusb_endpoint_descriptor *endpoint,
1337  struct libusb_ss_endpoint_companion_descriptor **ep_comp);
1339  struct libusb_ss_endpoint_companion_descriptor *ep_comp);
1341  struct libusb_bos_descriptor **bos);
1344  struct libusb_context *ctx,
1345  struct libusb_bos_dev_capability_descriptor *dev_cap,
1346  struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension);
1348  struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension);
1350  struct libusb_context *ctx,
1351  struct libusb_bos_dev_capability_descriptor *dev_cap,
1352  struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap);
1354  struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap);
1356  struct libusb_bos_dev_capability_descriptor *dev_cap,
1357  struct libusb_container_id_descriptor **container_id);
1359  struct libusb_container_id_descriptor *container_id);
1362 int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t* port_numbers, int port_numbers_len);
1363 LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers)
1364 int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t* path, uint8_t path_length);
1369  unsigned char endpoint);
1371  unsigned char endpoint);
1372 
1376 
1378  int configuration);
1380  int interface_number);
1382  int interface_number);
1383 
1385  libusb_context *ctx, uint16_t vendor_id, uint16_t product_id);
1386 
1388  int interface_number, int alternate_setting);
1390  unsigned char endpoint);
1392 
1394  uint32_t num_streams, unsigned char *endpoints, int num_endpoints);
1396  unsigned char *endpoints, int num_endpoints);
1397 
1399  int interface_number);
1401  int interface_number);
1403  int interface_number);
1405  libusb_device_handle *dev, int enable);
1406 
1407 /* async I/O */
1408 
1421 static inline unsigned char *libusb_control_transfer_get_data(
1422  struct libusb_transfer *transfer)
1423 {
1424  return transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE;
1425 }
1426 
1440  struct libusb_transfer *transfer)
1441 {
1442  return (struct libusb_control_setup *)(void *) transfer->buffer;
1443 }
1444 
1468 static inline void libusb_fill_control_setup(unsigned char *buffer,
1469  uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
1470  uint16_t wLength)
1471 {
1472  struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *) buffer;
1473  setup->bmRequestType = bmRequestType;
1474  setup->bRequest = bRequest;
1475  setup->wValue = libusb_cpu_to_le16(wValue);
1476  setup->wIndex = libusb_cpu_to_le16(wIndex);
1477  setup->wLength = libusb_cpu_to_le16(wLength);
1478 }
1479 
1480 struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(int iso_packets);
1481 int LIBUSB_CALL libusb_submit_transfer(struct libusb_transfer *transfer);
1482 int LIBUSB_CALL libusb_cancel_transfer(struct libusb_transfer *transfer);
1483 void LIBUSB_CALL libusb_free_transfer(struct libusb_transfer *transfer);
1485  struct libusb_transfer *transfer, uint32_t stream_id);
1487  struct libusb_transfer *transfer);
1488 
1517 static inline void libusb_fill_control_transfer(
1518  struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
1519  unsigned char *buffer, libusb_transfer_cb_fn callback, void *user_data,
1520  unsigned int timeout)
1521 {
1522  struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *) buffer;
1523  transfer->dev_handle = dev_handle;
1524  transfer->endpoint = 0;
1525  transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL;
1526  transfer->timeout = timeout;
1527  transfer->buffer = buffer;
1528  if (setup)
1529  transfer->length = (int) (LIBUSB_CONTROL_SETUP_SIZE
1530  + libusb_le16_to_cpu(setup->wLength));
1531  transfer->user_data = user_data;
1532  transfer->callback = callback;
1533 }
1534 
1548 static inline void libusb_fill_bulk_transfer(struct libusb_transfer *transfer,
1549  libusb_device_handle *dev_handle, unsigned char endpoint,
1550  unsigned char *buffer, int length, libusb_transfer_cb_fn callback,
1551  void *user_data, unsigned int timeout)
1552 {
1553  transfer->dev_handle = dev_handle;
1554  transfer->endpoint = endpoint;
1555  transfer->type = LIBUSB_TRANSFER_TYPE_BULK;
1556  transfer->timeout = timeout;
1557  transfer->buffer = buffer;
1558  transfer->length = length;
1559  transfer->user_data = user_data;
1560  transfer->callback = callback;
1561 }
1562 
1580  struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
1581  unsigned char endpoint, uint32_t stream_id,
1582  unsigned char *buffer, int length, libusb_transfer_cb_fn callback,
1583  void *user_data, unsigned int timeout)
1584 {
1585  libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer,
1586  length, callback, user_data, timeout);
1588  libusb_transfer_set_stream_id(transfer, stream_id);
1589 }
1590 
1605  struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
1606  unsigned char endpoint, unsigned char *buffer, int length,
1607  libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
1608 {
1609  transfer->dev_handle = dev_handle;
1610  transfer->endpoint = endpoint;
1612  transfer->timeout = timeout;
1613  transfer->buffer = buffer;
1614  transfer->length = length;
1615  transfer->user_data = user_data;
1616  transfer->callback = callback;
1617 }
1618 
1633 static inline void libusb_fill_iso_transfer(struct libusb_transfer *transfer,
1634  libusb_device_handle *dev_handle, unsigned char endpoint,
1635  unsigned char *buffer, int length, int num_iso_packets,
1636  libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
1637 {
1638  transfer->dev_handle = dev_handle;
1639  transfer->endpoint = endpoint;
1641  transfer->timeout = timeout;
1642  transfer->buffer = buffer;
1643  transfer->length = length;
1644  transfer->num_iso_packets = num_iso_packets;
1645  transfer->user_data = user_data;
1646  transfer->callback = callback;
1647 }
1648 
1658  struct libusb_transfer *transfer, unsigned int length)
1659 {
1660  int i;
1661  for (i = 0; i < transfer->num_iso_packets; i++)
1662  transfer->iso_packet_desc[i].length = length;
1663 }
1664 
1681 static inline unsigned char *libusb_get_iso_packet_buffer(
1682  struct libusb_transfer *transfer, unsigned int packet)
1683 {
1684  int i;
1685  size_t offset = 0;
1686  int _packet;
1687 
1688  /* oops..slight bug in the API. packet is an unsigned int, but we use
1689  * signed integers almost everywhere else. range-check and convert to
1690  * signed to avoid compiler warnings. FIXME for libusb-2. */
1691  if (packet > INT_MAX)
1692  return NULL;
1693  _packet = (int) packet;
1694 
1695  if (_packet >= transfer->num_iso_packets)
1696  return NULL;
1697 
1698  for (i = 0; i < _packet; i++)
1699  offset += transfer->iso_packet_desc[i].length;
1700 
1701  return transfer->buffer + offset;
1702 }
1703 
1723 static inline unsigned char *libusb_get_iso_packet_buffer_simple(
1724  struct libusb_transfer *transfer, unsigned int packet)
1725 {
1726  int _packet;
1727 
1728  /* oops..slight bug in the API. packet is an unsigned int, but we use
1729  * signed integers almost everywhere else. range-check and convert to
1730  * signed to avoid compiler warnings. FIXME for libusb-2. */
1731  if (packet > INT_MAX)
1732  return NULL;
1733  _packet = (int) packet;
1734 
1735  if (_packet >= transfer->num_iso_packets)
1736  return NULL;
1737 
1738  return transfer->buffer + ((int) transfer->iso_packet_desc[0].length * _packet);
1739 }
1740 
1741 /* sync I/O */
1742 
1744  uint8_t request_type, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
1745  unsigned char *data, uint16_t wLength, unsigned int timeout);
1746 
1748  unsigned char endpoint, unsigned char *data, int length,
1749  int *actual_length, unsigned int timeout);
1750 
1752  unsigned char endpoint, unsigned char *data, int length,
1753  int *actual_length, unsigned int timeout);
1754 
1768  uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length)
1769 {
1771  LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t) ((desc_type << 8) | desc_index),
1772  0, data, (uint16_t) length, 1000);
1773 }
1774 
1790  uint8_t desc_index, uint16_t langid, unsigned char *data, int length)
1791 {
1793  LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t)((LIBUSB_DT_STRING << 8) | desc_index),
1794  langid, data, (uint16_t) length, 1000);
1795 }
1796 
1798  uint8_t desc_index, unsigned char *data, int length);
1799 
1800 /* polling and timeouts */
1801 
1809 int LIBUSB_CALL libusb_wait_for_event(libusb_context *ctx, struct timeval *tv);
1810 
1812  struct timeval *tv);
1814  struct timeval *tv, int *completed);
1818  struct timeval *tv);
1821  struct timeval *tv);
1822 
1828  int fd;
1829 
1834  short events;
1835 };
1836 
1847 typedef void (LIBUSB_CALL *libusb_pollfd_added_cb)(int fd, short events,
1848  void *user_data);
1849 
1859 typedef void (LIBUSB_CALL *libusb_pollfd_removed_cb)(int fd, void *user_data);
1860 
1862  libusb_context *ctx);
1864  libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb,
1865  void *user_data);
1866 
1880 
1886 typedef enum {
1890 
1896 typedef enum {
1899 
1905 
1908 #define LIBUSB_HOTPLUG_MATCH_ANY -1
1909 
1933  libusb_device *device,
1934  libusb_hotplug_event event,
1935  void *user_data);
1936 
1972  libusb_hotplug_event events,
1973  libusb_hotplug_flag flags,
1974  int vendor_id, int product_id,
1975  int dev_class,
1977  void *user_data,
1978  libusb_hotplug_callback_handle *handle);
1979 
1992  libusb_hotplug_callback_handle handle);
1993 
1994 #ifdef __cplusplus
1995 }
1996 #endif
1997 
1998 #endif