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-2018 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__) || defined(__HAIKU__)
58 #include <sys/time.h>
59 #endif
60 
61 #include <time.h>
62 #include <limits.h>
63 
64 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
65 #define ZERO_SIZED_ARRAY /* [] - valid C99 code */
66 #else
67 #define ZERO_SIZED_ARRAY 0 /* [0] - non-standard, but usually working code */
68 #endif
69 
70 /* 'interface' might be defined as a macro on Windows, so we need to
71  * undefine it so as not to break the current libusb API, because
72  * libusb_config_descriptor has an 'interface' member
73  * As this can be problematic if you include windows.h after libusb.h
74  * in your sources, we force windows.h to be included first. */
75 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
76 #include <windows.h>
77 #if defined(interface)
78 #undef interface
79 #endif
80 #if !defined(__CYGWIN__)
81 #include <winsock.h>
82 #endif
83 #endif
84 
85 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
86 #define LIBUSB_DEPRECATED_FOR(f) \
87  __attribute__((deprecated("Use " #f " instead")))
88 #elif __GNUC__ >= 3
89 #define LIBUSB_DEPRECATED_FOR(f) __attribute__((deprecated))
90 #else
91 #define LIBUSB_DEPRECATED_FOR(f)
92 #endif /* __GNUC__ */
93 
119 /* LIBUSB_CALL must be defined on both definition and declaration of libusb
120  * functions. You'd think that declaration would be enough, but cygwin will
121  * complain about conflicting types unless both are marked this way.
122  * The placement of this macro is important too; it must appear after the
123  * return type, before the function name. See internal documentation for
124  * API_EXPORTED.
125  */
126 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
127 #define LIBUSB_CALL WINAPI
128 #else
129 #define LIBUSB_CALL
130 #endif
131 
152 #define LIBUSB_API_VERSION 0x01000107
153 
154 /* The following is kept for compatibility, but will be deprecated in the future */
155 #define LIBUSBX_API_VERSION LIBUSB_API_VERSION
156 
157 #ifdef __cplusplus
158 extern "C" {
159 #endif
160 
169 static inline uint16_t libusb_cpu_to_le16(const uint16_t x)
170 {
171  union {
172  uint8_t b8[2];
173  uint16_t b16;
174  } _tmp;
175  _tmp.b8[1] = (uint8_t) (x >> 8);
176  _tmp.b8[0] = (uint8_t) (x & 0xff);
177  return _tmp.b16;
178 }
179 
188 #define libusb_le16_to_cpu libusb_cpu_to_le16
189 
190 /* standard USB stuff */
191 
200 
203 
206 
209 
212 
215 
217  LIBUSB_CLASS_PTP = 6, /* legacy name from libusb-0.1 usb.h */
218  LIBUSB_CLASS_IMAGE = 6,
219 
222 
225 
228 
231 
234 
237 
240 
243 
246 
249 
252 };
253 
259 
262 
265 
268 
271 
274 
277 
280 
283 
286 
289 
292 
295 };
296 
297 /* Descriptor sizes per descriptor type */
298 #define LIBUSB_DT_DEVICE_SIZE 18
299 #define LIBUSB_DT_CONFIG_SIZE 9
300 #define LIBUSB_DT_INTERFACE_SIZE 9
301 #define LIBUSB_DT_ENDPOINT_SIZE 7
302 #define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
303 #define LIBUSB_DT_HUB_NONVAR_SIZE 7
304 #define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6
305 #define LIBUSB_DT_BOS_SIZE 5
306 #define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3
307 
308 /* BOS descriptor sizes */
309 #define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7
310 #define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10
311 #define LIBUSB_BT_CONTAINER_ID_SIZE 20
312 
313 /* We unwrap the BOS => define its max size */
314 #define LIBUSB_DT_BOS_MAX_SIZE ((LIBUSB_DT_BOS_SIZE) +\
315  (LIBUSB_BT_USB_2_0_EXTENSION_SIZE) +\
316  (LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE) +\
317  (LIBUSB_BT_CONTAINER_ID_SIZE))
318 
319 #define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */
320 #define LIBUSB_ENDPOINT_DIR_MASK 0x80
321 
329 
332 };
333 
334 #define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */
335 
343 
346 
349 
352 
355 };
356 
362 
365 
366  /* 0x02 is reserved */
367 
370 
371  /* 0x04 is reserved */
372 
375 
378 
381 
384 
387 
390 
393 
396 
399 
403 };
404 
412 
415 
418 
421 };
422 
430 
433 
436 
439 };
440 
441 #define LIBUSB_ISO_SYNC_TYPE_MASK 0x0C
442 
451 
454 
457 
460 };
461 
462 #define LIBUSB_ISO_USAGE_TYPE_MASK 0x30
463 
472 
475 
478 };
479 
487  uint8_t bLength;
488 
493 
496  uint16_t bcdUSB;
497 
499  uint8_t bDeviceClass;
500 
504 
508 
511 
513  uint16_t idVendor;
514 
516  uint16_t idProduct;
517 
519  uint16_t bcdDevice;
520 
522  uint8_t iManufacturer;
523 
525  uint8_t iProduct;
526 
528  uint8_t iSerialNumber;
529 
532 };
533 
541  uint8_t bLength;
542 
547 
553 
561  uint8_t bmAttributes;
562 
564  uint16_t wMaxPacketSize;
565 
567  uint8_t bInterval;
568 
571  uint8_t bRefresh;
572 
574  uint8_t bSynchAddress;
575 
578  const unsigned char *extra;
579 
582 };
583 
591  uint8_t bLength;
592 
597 
600 
603 
606  uint8_t bNumEndpoints;
607 
610 
614 
618 
620  uint8_t iInterface;
621 
625 
628  const unsigned char *extra;
629 
632 };
633 
641 
645 };
646 
654  uint8_t bLength;
655 
660 
662  uint16_t wTotalLength;
663 
665  uint8_t bNumInterfaces;
666 
669 
671  uint8_t iConfiguration;
672 
674  uint8_t bmAttributes;
675 
680  uint8_t MaxPower;
681 
685 
688  const unsigned char *extra;
689 
692 };
693 
701 
703  uint8_t bLength;
704 
709 
710 
713  uint8_t bMaxBurst;
714 
719  uint8_t bmAttributes;
720 
724 };
725 
733  uint8_t bLength;
741  uint8_t dev_capability_data[ZERO_SIZED_ARRAY];
742 };
743 
751  uint8_t bLength;
752 
757 
759  uint16_t wTotalLength;
760 
763  uint8_t bNumDeviceCaps;
764 
767 };
768 
776  uint8_t bLength;
777 
782 
787 
792  uint32_t bmAttributes;
793 };
794 
802  uint8_t bLength;
803 
808 
813 
818  uint8_t bmAttributes;
819 
822  uint16_t wSpeedSupported;
823 
829 
831  uint8_t bU1DevExitLat;
832 
834  uint16_t bU2DevExitLat;
835 };
836 
844  uint8_t bLength;
845 
850 
855 
857  uint8_t bReserved;
858 
860  uint8_t ContainerID[16];
861 };
862 
871  uint8_t bmRequestType;
872 
878  uint8_t bRequest;
879 
881  uint16_t wValue;
882 
885  uint16_t wIndex;
886 
888  uint16_t wLength;
889 };
890 
891 #define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
892 
893 /* libusb */
894 
895 struct libusb_context;
896 struct libusb_device;
897 struct libusb_device_handle;
898 
904  const uint16_t major;
905 
907  const uint16_t minor;
908 
910  const uint16_t micro;
911 
913  const uint16_t nano;
914 
916  const char *rc;
917 
919  const char* describe;
920 };
921 
940 
957 
958 
968 
975 
978 
981 
984 
987 
990 };
991 
999 
1002 
1005 
1008 };
1009 
1018 };
1019 
1028 };
1029 
1036 
1039 
1042 
1045 };
1046 
1057 
1060 
1063 
1066 
1069 
1072 
1075 
1078 
1081 
1084 
1087 
1090 
1093 
1094  /* NB: Remember to update LIBUSB_ERROR_COUNT below as well as the
1095  message strings in strerror.c when adding new error codes here. */
1096 
1099 };
1100 
1101 /* Total number of error codes in enum libusb_error */
1102 #define LIBUSB_ERROR_COUNT 14
1103 
1110 
1113 
1116 
1119 
1123 
1126 
1129 
1130  /* NB! Remember to update libusb_error_name()
1131  when adding new status codes here. */
1132 };
1133 
1139 
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 };
1261 
1280 };
1281 
1291  LIBUSB_LOG_LEVEL_NONE = 0,
1292  LIBUSB_LOG_LEVEL_ERROR = 1,
1293  LIBUSB_LOG_LEVEL_WARNING = 2,
1294  LIBUSB_LOG_LEVEL_INFO = 3,
1295  LIBUSB_LOG_LEVEL_DEBUG = 4,
1296 };
1297 
1303 
1306 
1309 };
1310 
1320  enum libusb_log_level level, const char *str);
1321 
1324 LIBUSB_DEPRECATED_FOR(libusb_set_option)
1325 void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
1327 const struct libusb_version * LIBUSB_CALL libusb_get_version(void);
1328 int LIBUSB_CALL libusb_has_capability(uint32_t capability);
1329 const char * LIBUSB_CALL libusb_error_name(int errcode);
1330 int LIBUSB_CALL libusb_setlocale(const char *locale);
1331 const char * LIBUSB_CALL libusb_strerror(enum libusb_error errcode);
1332 
1334  libusb_device ***list);
1336  int unref_devices);
1339 
1341  int *config);
1343  struct libusb_device_descriptor *desc);
1345  struct libusb_config_descriptor **config);
1347  uint8_t config_index, struct libusb_config_descriptor **config);
1349  uint8_t bConfigurationValue, struct libusb_config_descriptor **config);
1351  struct libusb_config_descriptor *config);
1353  struct libusb_context *ctx,
1354  const struct libusb_endpoint_descriptor *endpoint,
1355  struct libusb_ss_endpoint_companion_descriptor **ep_comp);
1357  struct libusb_ss_endpoint_companion_descriptor *ep_comp);
1359  struct libusb_bos_descriptor **bos);
1362  struct libusb_context *ctx,
1363  struct libusb_bos_dev_capability_descriptor *dev_cap,
1364  struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension);
1366  struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension);
1368  struct libusb_context *ctx,
1369  struct libusb_bos_dev_capability_descriptor *dev_cap,
1370  struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap);
1372  struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap);
1374  struct libusb_bos_dev_capability_descriptor *dev_cap,
1375  struct libusb_container_id_descriptor **container_id);
1377  struct libusb_container_id_descriptor *container_id);
1380 int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t* port_numbers, int port_numbers_len);
1381 LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers)
1382 int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t* path, uint8_t path_length);
1387  unsigned char endpoint);
1389  unsigned char endpoint);
1390 
1391 int LIBUSB_CALL libusb_wrap_sys_device(libusb_context *ctx, intptr_t sys_dev, libusb_device_handle **dev_handle);
1395 
1397  int configuration);
1399  int interface_number);
1401  int interface_number);
1402 
1404  libusb_context *ctx, uint16_t vendor_id, uint16_t product_id);
1405 
1407  int interface_number, int alternate_setting);
1409  unsigned char endpoint);
1411 
1413  uint32_t num_streams, unsigned char *endpoints, int num_endpoints);
1415  unsigned char *endpoints, int num_endpoints);
1416 
1417 unsigned char * LIBUSB_CALL libusb_dev_mem_alloc(libusb_device_handle *dev_handle,
1418  size_t length);
1420  unsigned char *buffer, size_t length);
1421 
1423  int interface_number);
1425  int interface_number);
1427  int interface_number);
1429  libusb_device_handle *dev_handle, int enable);
1430 
1431 /* async I/O */
1432 
1445 static inline unsigned char *libusb_control_transfer_get_data(
1446  struct libusb_transfer *transfer)
1447 {
1448  return transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE;
1449 }
1450 
1464  struct libusb_transfer *transfer)
1465 {
1466  return (struct libusb_control_setup *)(void *) transfer->buffer;
1467 }
1468 
1492 static inline void libusb_fill_control_setup(unsigned char *buffer,
1493  uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
1494  uint16_t wLength)
1495 {
1496  struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *) buffer;
1497  setup->bmRequestType = bmRequestType;
1498  setup->bRequest = bRequest;
1499  setup->wValue = libusb_cpu_to_le16(wValue);
1500  setup->wIndex = libusb_cpu_to_le16(wIndex);
1501  setup->wLength = libusb_cpu_to_le16(wLength);
1502 }
1503 
1504 struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(int iso_packets);
1505 int LIBUSB_CALL libusb_submit_transfer(struct libusb_transfer *transfer);
1506 int LIBUSB_CALL libusb_cancel_transfer(struct libusb_transfer *transfer);
1507 void LIBUSB_CALL libusb_free_transfer(struct libusb_transfer *transfer);
1509  struct libusb_transfer *transfer, uint32_t stream_id);
1511  struct libusb_transfer *transfer);
1512 
1541 static inline void libusb_fill_control_transfer(
1542  struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
1543  unsigned char *buffer, libusb_transfer_cb_fn callback, void *user_data,
1544  unsigned int timeout)
1545 {
1546  struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *) buffer;
1547  transfer->dev_handle = dev_handle;
1548  transfer->endpoint = 0;
1549  transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL;
1550  transfer->timeout = timeout;
1551  transfer->buffer = buffer;
1552  if (setup)
1553  transfer->length = (int) (LIBUSB_CONTROL_SETUP_SIZE
1554  + libusb_le16_to_cpu(setup->wLength));
1555  transfer->user_data = user_data;
1556  transfer->callback = callback;
1557 }
1558 
1572 static inline void libusb_fill_bulk_transfer(struct libusb_transfer *transfer,
1573  libusb_device_handle *dev_handle, unsigned char endpoint,
1574  unsigned char *buffer, int length, libusb_transfer_cb_fn callback,
1575  void *user_data, unsigned int timeout)
1576 {
1577  transfer->dev_handle = dev_handle;
1578  transfer->endpoint = endpoint;
1579  transfer->type = LIBUSB_TRANSFER_TYPE_BULK;
1580  transfer->timeout = timeout;
1581  transfer->buffer = buffer;
1582  transfer->length = length;
1583  transfer->user_data = user_data;
1584  transfer->callback = callback;
1585 }
1586 
1604  struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
1605  unsigned char endpoint, uint32_t stream_id,
1606  unsigned char *buffer, int length, libusb_transfer_cb_fn callback,
1607  void *user_data, unsigned int timeout)
1608 {
1609  libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer,
1610  length, callback, user_data, timeout);
1612  libusb_transfer_set_stream_id(transfer, stream_id);
1613 }
1614 
1629  struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
1630  unsigned char endpoint, unsigned char *buffer, int length,
1631  libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
1632 {
1633  transfer->dev_handle = dev_handle;
1634  transfer->endpoint = endpoint;
1636  transfer->timeout = timeout;
1637  transfer->buffer = buffer;
1638  transfer->length = length;
1639  transfer->user_data = user_data;
1640  transfer->callback = callback;
1641 }
1642 
1657 static inline void libusb_fill_iso_transfer(struct libusb_transfer *transfer,
1658  libusb_device_handle *dev_handle, unsigned char endpoint,
1659  unsigned char *buffer, int length, int num_iso_packets,
1660  libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
1661 {
1662  transfer->dev_handle = dev_handle;
1663  transfer->endpoint = endpoint;
1665  transfer->timeout = timeout;
1666  transfer->buffer = buffer;
1667  transfer->length = length;
1668  transfer->num_iso_packets = num_iso_packets;
1669  transfer->user_data = user_data;
1670  transfer->callback = callback;
1671 }
1672 
1682  struct libusb_transfer *transfer, unsigned int length)
1683 {
1684  int i;
1685  for (i = 0; i < transfer->num_iso_packets; i++)
1686  transfer->iso_packet_desc[i].length = length;
1687 }
1688 
1705 static inline unsigned char *libusb_get_iso_packet_buffer(
1706  struct libusb_transfer *transfer, unsigned int packet)
1707 {
1708  int i;
1709  size_t offset = 0;
1710  int _packet;
1711 
1712  /* oops..slight bug in the API. packet is an unsigned int, but we use
1713  * signed integers almost everywhere else. range-check and convert to
1714  * signed to avoid compiler warnings. FIXME for libusb-2. */
1715  if (packet > INT_MAX)
1716  return NULL;
1717  _packet = (int) packet;
1718 
1719  if (_packet >= transfer->num_iso_packets)
1720  return NULL;
1721 
1722  for (i = 0; i < _packet; i++)
1723  offset += transfer->iso_packet_desc[i].length;
1724 
1725  return transfer->buffer + offset;
1726 }
1727 
1747 static inline unsigned char *libusb_get_iso_packet_buffer_simple(
1748  struct libusb_transfer *transfer, unsigned int packet)
1749 {
1750  int _packet;
1751 
1752  /* oops..slight bug in the API. packet is an unsigned int, but we use
1753  * signed integers almost everywhere else. range-check and convert to
1754  * signed to avoid compiler warnings. FIXME for libusb-2. */
1755  if (packet > INT_MAX)
1756  return NULL;
1757  _packet = (int) packet;
1758 
1759  if (_packet >= transfer->num_iso_packets)
1760  return NULL;
1761 
1762  return transfer->buffer + ((int) transfer->iso_packet_desc[0].length * _packet);
1763 }
1764 
1765 /* sync I/O */
1766 
1768  uint8_t request_type, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
1769  unsigned char *data, uint16_t wLength, unsigned int timeout);
1770 
1772  unsigned char endpoint, unsigned char *data, int length,
1773  int *actual_length, unsigned int timeout);
1774 
1776  unsigned char endpoint, unsigned char *data, int length,
1777  int *actual_length, unsigned int timeout);
1778 
1791 static inline int libusb_get_descriptor(libusb_device_handle *dev_handle,
1792  uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length)
1793 {
1794  return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN,
1795  LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t) ((desc_type << 8) | desc_index),
1796  0, data, (uint16_t) length, 1000);
1797 }
1798 
1814  uint8_t desc_index, uint16_t langid, unsigned char *data, int length)
1815 {
1816  return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN,
1817  LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t)((LIBUSB_DT_STRING << 8) | desc_index),
1818  langid, data, (uint16_t) length, 1000);
1819 }
1820 
1822  uint8_t desc_index, unsigned char *data, int length);
1823 
1824 /* polling and timeouts */
1825 
1834 int LIBUSB_CALL libusb_wait_for_event(libusb_context *ctx, struct timeval *tv);
1835 
1837  struct timeval *tv);
1839  struct timeval *tv, int *completed);
1843  struct timeval *tv);
1846  struct timeval *tv);
1847 
1853  int fd;
1854 
1859  short events;
1860 };
1861 
1872 typedef void (LIBUSB_CALL *libusb_pollfd_added_cb)(int fd, short events,
1873  void *user_data);
1874 
1884 typedef void (LIBUSB_CALL *libusb_pollfd_removed_cb)(int fd, void *user_data);
1885 
1887  libusb_context *ctx);
1888 void LIBUSB_CALL libusb_free_pollfds(const struct libusb_pollfd **pollfds);
1890  libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb,
1891  void *user_data);
1892 
1906 
1912 typedef enum {
1915 
1919 
1925 typedef enum {
1928 
1934 
1937 #define LIBUSB_HOTPLUG_MATCH_ANY -1
1938 
1962  libusb_device *device,
1963  libusb_hotplug_event event,
1964  void *user_data);
1965 
2001  libusb_hotplug_event events,
2002  libusb_hotplug_flag flags,
2003  int vendor_id, int product_id,
2004  int dev_class,
2006  void *user_data,
2007  libusb_hotplug_callback_handle *callback_handle);
2008 
2021  libusb_hotplug_callback_handle callback_handle);
2022 
2049 
2058 };
2059 
2060 int LIBUSB_CALL libusb_set_option(libusb_context *ctx, enum libusb_option option, ...);
2061 
2062 #ifdef __cplusplus
2063 }
2064 #endif
2065 
2066 #endif