libusb: libusb.h Source File

| libusb 1.0.26 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 * Copyright © 2014-2020 Chris Dickens <christopher.a.dickens@gmail.com>
8 * For more information, please visit: http://libusb.info
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25#ifndef LIBUSB_H
26#define LIBUSB_H
27
28#if defined(_MSC_VER)
29#pragma warning(push)
30/* Disable: warning C4200: nonstandard extension used : zero-sized array in struct/union */
31#pragma warning(disable:4200)
32/* on MS environments, the inline keyword is available in C++ only */
33#if !defined(__cplusplus)
34#define inline __inline
35#endif
36/* ssize_t is also not available */
37#ifndef _SSIZE_T_DEFINED
38#define _SSIZE_T_DEFINED
39#include <basetsd.h>
40typedef SSIZE_T ssize_t;
41#endif /* _SSIZE_T_DEFINED */
42#endif /* _MSC_VER */
43
44#include <limits.h>
45#include <stdint.h>
46#include <sys/types.h>
47#if !defined(_MSC_VER)
48#include <sys/time.h>
49#endif
50#include <time.h>
51
52#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
53#define ZERO_SIZED_ARRAY /* [] - valid C99 code */
54#else
55#define ZERO_SIZED_ARRAY 0 /* [0] - non-standard, but usually working code */
56#endif /* __STDC_VERSION__ */
57
58/* 'interface' might be defined as a macro on Windows, so we need to
59 * undefine it so as not to break the current libusb API, because
60 * libusb_config_descriptor has an 'interface' member
61 * As this can be problematic if you include windows.h after libusb.h
62 * in your sources, we force windows.h to be included first. */
63#if defined(_WIN32) || defined(__CYGWIN__)
64#include <windows.h>
65#if defined(interface)
66#undef interface
67#endif
68#if !defined(__CYGWIN__)
69#include <winsock.h>
70#endif
71#endif /* _WIN32 || __CYGWIN__ */
72
73#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
74#define LIBUSB_DEPRECATED_FOR(f) __attribute__ ((deprecated ("Use " #f " instead")))
75#elif defined(__GNUC__) && (__GNUC__ >= 3)
76#define LIBUSB_DEPRECATED_FOR(f) __attribute__ ((deprecated))
77#else
78#define LIBUSB_DEPRECATED_FOR(f)
79#endif /* __GNUC__ */
80
81#if defined(__GNUC__)
82#define LIBUSB_PACKED __attribute__ ((packed))
83#else
84#define LIBUSB_PACKED
85#endif /* __GNUC__ */
86
112/* LIBUSB_CALL must be defined on both definition and declaration of libusb
113 * functions. You'd think that declaration would be enough, but cygwin will
114 * complain about conflicting types unless both are marked this way.
115 * The placement of this macro is important too; it must appear after the
116 * return type, before the function name. See internal documentation for
117 * API_EXPORTED.
118 */
119#if defined(_WIN32) || defined(__CYGWIN__)
120#define LIBUSB_CALL WINAPI
121#else
122#define LIBUSB_CALL
123#endif /* _WIN32 || __CYGWIN__ */
124
145#define LIBUSB_API_VERSION 0x01000109
146
147/* The following is kept for compatibility, but will be deprecated in the future */
148#define LIBUSBX_API_VERSION LIBUSB_API_VERSION
149
150#if defined(__cplusplus)
151extern "C" {
152#endif
153
162 static inline uint16_t libusb_cpu_to_le16(const uint16_t x)
163{
164 union {
165 uint8_t b8[2];
166 uint16_t b16;
167 } _tmp;
168 _tmp.b8[1] = (uint8_t) (x >> 8);
169 _tmp.b8[0] = (uint8_t) (x & 0xff);
170 return _tmp.b16;
171}
172
181#define libusb_le16_to_cpu libusb_cpu_to_le16
182
183/* standard USB stuff */
184
187 enum libusb_class_code {
192 LIBUSB_CLASS_PER_INTERFACE = 0x00,
193
195 LIBUSB_CLASS_AUDIO = 0x01,
196
198 LIBUSB_CLASS_COMM = 0x02,
199
201 LIBUSB_CLASS_HID = 0x03,
202
204 LIBUSB_CLASS_PHYSICAL = 0x05,
205
207 LIBUSB_CLASS_IMAGE = 0x06,
208 LIBUSB_CLASS_PTP = 0x06, /* legacy name from libusb-0.1 usb.h */
209
211 LIBUSB_CLASS_PRINTER = 0x07,
212
214 LIBUSB_CLASS_MASS_STORAGE = 0x08,
215
217 LIBUSB_CLASS_HUB = 0x09,
218
220 LIBUSB_CLASS_DATA = 0x0a,
221
223 LIBUSB_CLASS_SMART_CARD = 0x0b,
224
226 LIBUSB_CLASS_CONTENT_SECURITY = 0x0d,
227
229 LIBUSB_CLASS_VIDEO = 0x0e,
230
232 LIBUSB_CLASS_PERSONAL_HEALTHCARE = 0x0f,
233
235 LIBUSB_CLASS_DIAGNOSTIC_DEVICE = 0xdc,
236
238 LIBUSB_CLASS_WIRELESS = 0xe0,
239
241 LIBUSB_CLASS_MISCELLANEOUS = 0xef,
242
244 LIBUSB_CLASS_APPLICATION = 0xfe,
245
247 LIBUSB_CLASS_VENDOR_SPEC = 0xff
248};
249
252 enum libusb_descriptor_type {
254 LIBUSB_DT_DEVICE = 0x01,
255
257 LIBUSB_DT_CONFIG = 0x02,
258
260 LIBUSB_DT_STRING = 0x03,
261
263 LIBUSB_DT_INTERFACE = 0x04,
264
266 LIBUSB_DT_ENDPOINT = 0x05,
267
269 LIBUSB_DT_BOS = 0x0f,
270
272 LIBUSB_DT_DEVICE_CAPABILITY = 0x10,
273
275 LIBUSB_DT_HID = 0x21,
276
278 LIBUSB_DT_REPORT = 0x22,
279
281 LIBUSB_DT_PHYSICAL = 0x23,
282
284 LIBUSB_DT_HUB = 0x29,
285
287 LIBUSB_DT_SUPERSPEED_HUB = 0x2a,
288
290 LIBUSB_DT_SS_ENDPOINT_COMPANION = 0x30
291};
292
293/* Descriptor sizes per descriptor type */
294#define LIBUSB_DT_DEVICE_SIZE 18
295#define LIBUSB_DT_CONFIG_SIZE 9
296#define LIBUSB_DT_INTERFACE_SIZE 9
297#define LIBUSB_DT_ENDPOINT_SIZE 7
298#define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
299#define LIBUSB_DT_HUB_NONVAR_SIZE 7
300#define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6
301#define LIBUSB_DT_BOS_SIZE 5
302#define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3
303
304/* BOS descriptor sizes */
305#define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7
306#define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10
307#define LIBUSB_BT_CONTAINER_ID_SIZE 20
308
309/* We unwrap the BOS => define its max size */
310#define LIBUSB_DT_BOS_MAX_SIZE \
311 (LIBUSB_DT_BOS_SIZE + \
312 LIBUSB_BT_USB_2_0_EXTENSION_SIZE + \
313 LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE + \
314 LIBUSB_BT_CONTAINER_ID_SIZE)
315
316#define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */
317#define LIBUSB_ENDPOINT_DIR_MASK 0x80
318
323 enum libusb_endpoint_direction {
325 LIBUSB_ENDPOINT_OUT = 0x00,
326
328 LIBUSB_ENDPOINT_IN = 0x80
329};
330
331#define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */
332
337 enum libusb_endpoint_transfer_type {
339 LIBUSB_ENDPOINT_TRANSFER_TYPE_CONTROL = 0x0,
340
342 LIBUSB_ENDPOINT_TRANSFER_TYPE_ISOCHRONOUS = 0x1,
343
345 LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK = 0x2,
346
348 LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT = 0x3
349};
350
353 enum libusb_standard_request {
355 LIBUSB_REQUEST_GET_STATUS = 0x00,
356
358 LIBUSB_REQUEST_CLEAR_FEATURE = 0x01,
359
360 /* 0x02 is reserved */
361
363 LIBUSB_REQUEST_SET_FEATURE = 0x03,
364
365 /* 0x04 is reserved */
366
368 LIBUSB_REQUEST_SET_ADDRESS = 0x05,
369
371 LIBUSB_REQUEST_GET_DESCRIPTOR = 0x06,
372
374 LIBUSB_REQUEST_SET_DESCRIPTOR = 0x07,
375
377 LIBUSB_REQUEST_GET_CONFIGURATION = 0x08,
378
380 LIBUSB_REQUEST_SET_CONFIGURATION = 0x09,
381
383 LIBUSB_REQUEST_GET_INTERFACE = 0x0a,
384
386 LIBUSB_REQUEST_SET_INTERFACE = 0x0b,
387
389 LIBUSB_REQUEST_SYNCH_FRAME = 0x0c,
390
392 LIBUSB_REQUEST_SET_SEL = 0x30,
393
396 LIBUSB_SET_ISOCH_DELAY = 0x31
397};
398
403 enum libusb_request_type {
405 LIBUSB_REQUEST_TYPE_STANDARD = (0x00 << 5),
406
408 LIBUSB_REQUEST_TYPE_CLASS = (0x01 << 5),
409
411 LIBUSB_REQUEST_TYPE_VENDOR = (0x02 << 5),
412
414 LIBUSB_REQUEST_TYPE_RESERVED = (0x03 << 5)
415};
416
421 enum libusb_request_recipient {
423 LIBUSB_RECIPIENT_DEVICE = 0x00,
424
426 LIBUSB_RECIPIENT_INTERFACE = 0x01,
427
429 LIBUSB_RECIPIENT_ENDPOINT = 0x02,
430
432 LIBUSB_RECIPIENT_OTHER = 0x03
433};
434
435#define LIBUSB_ISO_SYNC_TYPE_MASK 0x0c
436
442 enum libusb_iso_sync_type {
444 LIBUSB_ISO_SYNC_TYPE_NONE = 0x0,
445
447 LIBUSB_ISO_SYNC_TYPE_ASYNC = 0x1,
448
450 LIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 0x2,
451
453 LIBUSB_ISO_SYNC_TYPE_SYNC = 0x3
454};
455
456#define LIBUSB_ISO_USAGE_TYPE_MASK 0x30
457
463 enum libusb_iso_usage_type {
465 LIBUSB_ISO_USAGE_TYPE_DATA = 0x0,
466
468 LIBUSB_ISO_USAGE_TYPE_FEEDBACK = 0x1,
469
471 LIBUSB_ISO_USAGE_TYPE_IMPLICIT = 0x2
472};
473
478 enum libusb_supported_speed {
480 LIBUSB_LOW_SPEED_OPERATION = (1 << 0),
481
483 LIBUSB_FULL_SPEED_OPERATION = (1 << 1),
484
486 LIBUSB_HIGH_SPEED_OPERATION = (1 << 2),
487
489 LIBUSB_SUPER_SPEED_OPERATION = (1 << 3)
490};
491
497 enum libusb_usb_2_0_extension_attributes {
499 LIBUSB_BM_LPM_SUPPORT = (1 << 1)
500};
501
507 enum libusb_ss_usb_device_capability_attributes {
509 LIBUSB_BM_LTM_SUPPORT = (1 << 1)
510};
511
515 enum libusb_bos_type {
517 LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 0x01,
518
520 LIBUSB_BT_USB_2_0_EXTENSION = 0x02,
521
523 LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 0x03,
524
526 LIBUSB_BT_CONTAINER_ID = 0x04
527};
528
534 struct libusb_device_descriptor {
536 uint8_t bLength;
537
541 uint8_t bDescriptorType;
542
545 uint16_t bcdUSB;
546
548 uint8_t bDeviceClass;
549
552 uint8_t bDeviceSubClass;
553
556 uint8_t bDeviceProtocol;
557
559 uint8_t bMaxPacketSize0;
560
562 uint16_t idVendor;
563
565 uint16_t idProduct;
566
568 uint16_t bcdDevice;
569
571 uint8_t iManufacturer;
572
574 uint8_t iProduct;
575
577 uint8_t iSerialNumber;
578
580 uint8_t bNumConfigurations;
581};
582
588 struct libusb_endpoint_descriptor {
590 uint8_t bLength;
591
595 uint8_t bDescriptorType;
596
600 uint8_t bEndpointAddress;
601
608 uint8_t bmAttributes;
609
611 uint16_t wMaxPacketSize;
612
614 uint8_t bInterval;
615
618 uint8_t bRefresh;
619
621 uint8_t bSynchAddress;
622
625 const unsigned char *extra;
626
628 int extra_length;
629};
630
636 struct libusb_interface_descriptor {
638 uint8_t bLength;
639
643 uint8_t bDescriptorType;
644
646 uint8_t bInterfaceNumber;
647
649 uint8_t bAlternateSetting;
650
653 uint8_t bNumEndpoints;
654
656 uint8_t bInterfaceClass;
657
660 uint8_t bInterfaceSubClass;
661
664 uint8_t bInterfaceProtocol;
665
667 uint8_t iInterface;
668
671 const struct libusb_endpoint_descriptor *endpoint;
672
675 const unsigned char *extra;
676
678 int extra_length;
679};
680
684 struct libusb_interface {
687 const struct libusb_interface_descriptor *altsetting;
688
691 int num_altsetting;
692};
693
699 struct libusb_config_descriptor {
701 uint8_t bLength;
702
706 uint8_t bDescriptorType;
707
709 uint16_t wTotalLength;
710
712 uint8_t bNumInterfaces;
713
715 uint8_t bConfigurationValue;
716
718 uint8_t iConfiguration;
719
721 uint8_t bmAttributes;
722
727 uint8_t MaxPower;
728
731 const struct libusb_interface *interface;
732
735 const unsigned char *extra;
736
738 int extra_length;
739};
740
747 struct libusb_ss_endpoint_companion_descriptor {
749 uint8_t bLength;
750
754 uint8_t bDescriptorType;
755
758 uint8_t bMaxBurst;
759
764 uint8_t bmAttributes;
765
768 uint16_t wBytesPerInterval;
769};
770
776 struct libusb_bos_dev_capability_descriptor {
778 uint8_t bLength;
779
783 uint8_t bDescriptorType;
784
786 uint8_t bDevCapabilityType;
787
789 uint8_t dev_capability_data[ZERO_SIZED_ARRAY];
790};
791
797 struct libusb_bos_descriptor {
799 uint8_t bLength;
800
804 uint8_t bDescriptorType;
805
807 uint16_t wTotalLength;
808
811 uint8_t bNumDeviceCaps;
812
814 struct libusb_bos_dev_capability_descriptor *dev_capability[ZERO_SIZED_ARRAY];
815};
816
822 struct libusb_usb_2_0_extension_descriptor {
824 uint8_t bLength;
825
829 uint8_t bDescriptorType;
830
834 uint8_t bDevCapabilityType;
835
840 uint32_t bmAttributes;
841};
842
848 struct libusb_ss_usb_device_capability_descriptor {
850 uint8_t bLength;
851
855 uint8_t bDescriptorType;
856
860 uint8_t bDevCapabilityType;
861
866 uint8_t bmAttributes;
867
870 uint16_t wSpeedSupported;
871
876 uint8_t bFunctionalitySupport;
877
879 uint8_t bU1DevExitLat;
880
882 uint16_t bU2DevExitLat;
883};
884
890 struct libusb_container_id_descriptor {
892 uint8_t bLength;
893
897 uint8_t bDescriptorType;
898
902 uint8_t bDevCapabilityType;
903
905 uint8_t bReserved;
906
908 uint8_t ContainerID[16];
909};
910
913#if defined(_MSC_VER) || defined(__WATCOMC__)
914#pragma pack(push, 1)
915#endif
916 struct libusb_control_setup {
922 uint8_t bmRequestType;
923
929 uint8_t bRequest;
930
932 uint16_t wValue;
933
936 uint16_t wIndex;
937
939 uint16_t wLength;
940} LIBUSB_PACKED;
941#if defined(_MSC_VER) || defined(__WATCOMC__)
942#pragma pack(pop)
943#endif
944
945#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
946
947/* libusb */
948
949struct libusb_context;
950struct libusb_device;
951struct libusb_device_handle;
952
956 struct libusb_version {
958 const uint16_t major;
959
961 const uint16_t minor;
962
964 const uint16_t micro;
965
967 const uint16_t nano;
968
970 const char *rc;
971
973 const char *describe;
974};
975
994 typedef struct libusb_context libusb_context;
995
1011 typedef struct libusb_device libusb_device;
1012
1013
1022 typedef struct libusb_device_handle libusb_device_handle;
1023
1027 enum libusb_speed {
1029 LIBUSB_SPEED_UNKNOWN = 0,
1030
1032 LIBUSB_SPEED_LOW = 1,
1033
1035 LIBUSB_SPEED_FULL = 2,
1036
1038 LIBUSB_SPEED_HIGH = 3,
1039
1041 LIBUSB_SPEED_SUPER = 4,
1042
1044 LIBUSB_SPEED_SUPER_PLUS = 5
1045};
1046
1054 enum libusb_error {
1056 LIBUSB_SUCCESS = 0,
1057
1059 LIBUSB_ERROR_IO = -1,
1060
1062 LIBUSB_ERROR_INVALID_PARAM = -2,
1063
1065 LIBUSB_ERROR_ACCESS = -3,
1066
1068 LIBUSB_ERROR_NO_DEVICE = -4,
1069
1071 LIBUSB_ERROR_NOT_FOUND = -5,
1072
1074 LIBUSB_ERROR_BUSY = -6,
1075
1077 LIBUSB_ERROR_TIMEOUT = -7,
1078
1080 LIBUSB_ERROR_OVERFLOW = -8,
1081
1083 LIBUSB_ERROR_PIPE = -9,
1084
1086 LIBUSB_ERROR_INTERRUPTED = -10,
1087
1089 LIBUSB_ERROR_NO_MEM = -11,
1090
1092 LIBUSB_ERROR_NOT_SUPPORTED = -12,
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
1098 LIBUSB_ERROR_OTHER = -99
1099};
1100
1101/* Total number of error codes in enum libusb_error */
1102#define LIBUSB_ERROR_COUNT 14
1103
1106 enum libusb_transfer_type {
1108 LIBUSB_TRANSFER_TYPE_CONTROL = 0U,
1109
1111 LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1U,
1112
1114 LIBUSB_TRANSFER_TYPE_BULK = 2U,
1115
1117 LIBUSB_TRANSFER_TYPE_INTERRUPT = 3U,
1118
1120 LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4U
1121};
1122
1125 enum libusb_transfer_status {
1128 LIBUSB_TRANSFER_COMPLETED,
1129
1131 LIBUSB_TRANSFER_ERROR,
1132
1134 LIBUSB_TRANSFER_TIMED_OUT,
1135
1137 LIBUSB_TRANSFER_CANCELLED,
1138
1141 LIBUSB_TRANSFER_STALL,
1142
1144 LIBUSB_TRANSFER_NO_DEVICE,
1145
1147 LIBUSB_TRANSFER_OVERFLOW
1148
1149 /* NB! Remember to update libusb_error_name()
1150 when adding new status codes here. */
1151};
1152
1155 enum libusb_transfer_flags {
1157 LIBUSB_TRANSFER_SHORT_NOT_OK = (1U << 0),
1158
1163 LIBUSB_TRANSFER_FREE_BUFFER = (1U << 1),
1164
1169 LIBUSB_TRANSFER_FREE_TRANSFER = (1U << 2),
1170
1194 LIBUSB_TRANSFER_ADD_ZERO_PACKET = (1U << 3)
1195};
1196
1199 struct libusb_iso_packet_descriptor {
1201 unsigned int length;
1202
1204 unsigned int actual_length;
1205
1207 enum libusb_transfer_status status;
1208};
1209
1210struct libusb_transfer;
1211
1221 typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transfer);
1222
1229 struct libusb_transfer {
1231 libusb_device_handle *dev_handle;
1232
1234 uint8_t flags;
1235
1237 unsigned char endpoint;
1238
1240 unsigned char type;
1241
1244 unsigned int timeout;
1245
1253 enum libusb_transfer_status status;
1254
1256 int length;
1257
1261 int actual_length;
1262
1265 libusb_transfer_cb_fn callback;
1266
1277 void *user_data;
1278
1280 unsigned char *buffer;
1281
1284 int num_iso_packets;
1285
1287 struct libusb_iso_packet_descriptor iso_packet_desc[ZERO_SIZED_ARRAY];
1288};
1289
1295 enum libusb_capability {
1297 LIBUSB_CAP_HAS_CAPABILITY = 0x0000U,
1298
1300 LIBUSB_CAP_HAS_HOTPLUG = 0x0001U,
1301
1306 LIBUSB_CAP_HAS_HID_ACCESS = 0x0100U,
1307
1310 LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101U
1311};
1312
1316 enum libusb_log_level {
1318 LIBUSB_LOG_LEVEL_NONE = 0,
1319
1321 LIBUSB_LOG_LEVEL_ERROR = 1,
1322
1324 LIBUSB_LOG_LEVEL_WARNING = 2,
1325
1327 LIBUSB_LOG_LEVEL_INFO = 3,
1328
1330 LIBUSB_LOG_LEVEL_DEBUG = 4
1331};
1332
1340 enum libusb_log_cb_mode {
1342 LIBUSB_LOG_CB_GLOBAL = (1 << 0),
1343
1345 LIBUSB_LOG_CB_CONTEXT = (1 << 1)
1346};
1347
1359 typedef void (LIBUSB_CALL *libusb_log_cb)(libusb_context *ctx,
1360 enum libusb_log_level level, const char *str);
1361
1362int LIBUSB_CALL libusb_init(libusb_context **ctx);
1363void LIBUSB_CALL libusb_exit(libusb_context *ctx);
1364LIBUSB_DEPRECATED_FOR(libusb_set_option)
1365void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
1366void LIBUSB_CALL libusb_set_log_cb(libusb_context *ctx, libusb_log_cb cb, int mode);
1367const struct libusb_version * LIBUSB_CALL libusb_get_version(void);
1368int LIBUSB_CALL libusb_has_capability(uint32_t capability);
1369const char * LIBUSB_CALL libusb_error_name(int errcode);
1370int LIBUSB_CALL libusb_setlocale(const char *locale);
1371const char * LIBUSB_CALL libusb_strerror(int errcode);
1372
1373ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx,
1374 libusb_device ***list);
1375void LIBUSB_CALL libusb_free_device_list(libusb_device **list,
1376 int unref_devices);
1377 libusb_device * LIBUSB_CALL libusb_ref_device(libusb_device *dev);
1378void LIBUSB_CALL libusb_unref_device(libusb_device *dev);
1379
1380int LIBUSB_CALL libusb_get_configuration(libusb_device_handle *dev,
1381 int *config);
1382int LIBUSB_CALL libusb_get_device_descriptor(libusb_device *dev,
1383 struct libusb_device_descriptor *desc);
1384int LIBUSB_CALL libusb_get_active_config_descriptor(libusb_device *dev,
1385 struct libusb_config_descriptor **config);
1386int LIBUSB_CALL libusb_get_config_descriptor(libusb_device *dev,
1387 uint8_t config_index, struct libusb_config_descriptor **config);
1388int LIBUSB_CALL libusb_get_config_descriptor_by_value(libusb_device *dev,
1389 uint8_t bConfigurationValue, struct libusb_config_descriptor **config);
1390void LIBUSB_CALL libusb_free_config_descriptor(
1391 struct libusb_config_descriptor *config);
1392int LIBUSB_CALL libusb_get_ss_endpoint_companion_descriptor(
1393 libusb_context *ctx,
1394 const struct libusb_endpoint_descriptor *endpoint,
1395 struct libusb_ss_endpoint_companion_descriptor **ep_comp);
1396void LIBUSB_CALL libusb_free_ss_endpoint_companion_descriptor(
1397 struct libusb_ss_endpoint_companion_descriptor *ep_comp);
1398int LIBUSB_CALL libusb_get_bos_descriptor(libusb_device_handle *dev_handle,
1399 struct libusb_bos_descriptor **bos);
1400void LIBUSB_CALL libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos);
1401int LIBUSB_CALL libusb_get_usb_2_0_extension_descriptor(
1402 libusb_context *ctx,
1403 struct libusb_bos_dev_capability_descriptor *dev_cap,
1404 struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension);
1405void LIBUSB_CALL libusb_free_usb_2_0_extension_descriptor(
1406 struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension);
1407int LIBUSB_CALL libusb_get_ss_usb_device_capability_descriptor(
1408 libusb_context *ctx,
1409 struct libusb_bos_dev_capability_descriptor *dev_cap,
1410 struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap);
1411void LIBUSB_CALL libusb_free_ss_usb_device_capability_descriptor(
1412 struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap);
1413int LIBUSB_CALL libusb_get_container_id_descriptor(libusb_context *ctx,
1414 struct libusb_bos_dev_capability_descriptor *dev_cap,
1415 struct libusb_container_id_descriptor **container_id);
1416void LIBUSB_CALL libusb_free_container_id_descriptor(
1417 struct libusb_container_id_descriptor *container_id);
1418uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev);
1419uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev);
1420int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t *port_numbers, int port_numbers_len);
1421LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers)
1422int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *path, uint8_t path_length);
1423 libusb_device * LIBUSB_CALL libusb_get_parent(libusb_device *dev);
1424uint8_t LIBUSB_CALL libusb_get_device_address(libusb_device *dev);
1425int LIBUSB_CALL libusb_get_device_speed(libusb_device *dev);
1426int LIBUSB_CALL libusb_get_max_packet_size(libusb_device *dev,
1427 unsigned char endpoint);
1428int LIBUSB_CALL libusb_get_max_iso_packet_size(libusb_device *dev,
1429 unsigned char endpoint);
1430
1431int LIBUSB_CALL libusb_wrap_sys_device(libusb_context *ctx, intptr_t sys_dev, libusb_device_handle **dev_handle);
1432int LIBUSB_CALL libusb_open(libusb_device *dev, libusb_device_handle **dev_handle);
1433void LIBUSB_CALL libusb_close(libusb_device_handle *dev_handle);
1434 libusb_device * LIBUSB_CALL libusb_get_device(libusb_device_handle *dev_handle);
1435
1436int LIBUSB_CALL libusb_set_configuration(libusb_device_handle *dev_handle,
1437 int configuration);
1438int LIBUSB_CALL libusb_claim_interface(libusb_device_handle *dev_handle,
1439 int interface_number);
1440int LIBUSB_CALL libusb_release_interface(libusb_device_handle *dev_handle,
1441 int interface_number);
1442
1443 libusb_device_handle * LIBUSB_CALL libusb_open_device_with_vid_pid(
1444 libusb_context *ctx, uint16_t vendor_id, uint16_t product_id);
1445
1446int LIBUSB_CALL libusb_set_interface_alt_setting(libusb_device_handle *dev_handle,
1447 int interface_number, int alternate_setting);
1448int LIBUSB_CALL libusb_clear_halt(libusb_device_handle *dev_handle,
1449 unsigned char endpoint);
1450int LIBUSB_CALL libusb_reset_device(libusb_device_handle *dev_handle);
1451
1452int LIBUSB_CALL libusb_alloc_streams(libusb_device_handle *dev_handle,
1453 uint32_t num_streams, unsigned char *endpoints, int num_endpoints);
1454int LIBUSB_CALL libusb_free_streams(libusb_device_handle *dev_handle,
1455 unsigned char *endpoints, int num_endpoints);
1456
1457unsigned char * LIBUSB_CALL libusb_dev_mem_alloc(libusb_device_handle *dev_handle,
1458 size_t length);
1459int LIBUSB_CALL libusb_dev_mem_free(libusb_device_handle *dev_handle,
1460 unsigned char *buffer, size_t length);
1461
1462int LIBUSB_CALL libusb_kernel_driver_active(libusb_device_handle *dev_handle,
1463 int interface_number);
1464int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev_handle,
1465 int interface_number);
1466int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev_handle,
1467 int interface_number);
1468int LIBUSB_CALL libusb_set_auto_detach_kernel_driver(
1469 libusb_device_handle *dev_handle, int enable);
1470
1471/* async I/O */
1472
1485 static inline unsigned char *libusb_control_transfer_get_data(
1486 struct libusb_transfer *transfer)
1487{
1488 return transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE;
1489}
1490
1503 static inline struct libusb_control_setup *libusb_control_transfer_get_setup(
1504 struct libusb_transfer *transfer)
1505{
1506 return (struct libusb_control_setup *)(void *)transfer->buffer;
1507}
1508
1532 static inline void libusb_fill_control_setup(unsigned char *buffer,
1533 uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
1534 uint16_t wLength)
1535{
1536 struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)buffer;
1537 setup->bmRequestType = bmRequestType;
1538 setup->bRequest = bRequest;
1539 setup->wValue = libusb_cpu_to_le16(wValue);
1540 setup->wIndex = libusb_cpu_to_le16(wIndex);
1541 setup->wLength = libusb_cpu_to_le16(wLength);
1542}
1543
1544struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(int iso_packets);
1545int LIBUSB_CALL libusb_submit_transfer(struct libusb_transfer *transfer);
1546int LIBUSB_CALL libusb_cancel_transfer(struct libusb_transfer *transfer);
1547void LIBUSB_CALL libusb_free_transfer(struct libusb_transfer *transfer);
1548void LIBUSB_CALL libusb_transfer_set_stream_id(
1549 struct libusb_transfer *transfer, uint32_t stream_id);
1550uint32_t LIBUSB_CALL libusb_transfer_get_stream_id(
1551 struct libusb_transfer *transfer);
1552
1581 static inline void libusb_fill_control_transfer(
1582 struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
1583 unsigned char *buffer, libusb_transfer_cb_fn callback, void *user_data,
1584 unsigned int timeout)
1585{
1586 struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)buffer;
1587 transfer->dev_handle = dev_handle;
1588 transfer->endpoint = 0;
1589 transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL;
1590 transfer->timeout = timeout;
1591 transfer->buffer = buffer;
1592 if (setup)
1593 transfer->length = (int) (LIBUSB_CONTROL_SETUP_SIZE
1594 + libusb_le16_to_cpu(setup->wLength));
1595 transfer->user_data = user_data;
1596 transfer->callback = callback;
1597}
1598
1612 static inline void libusb_fill_bulk_transfer(struct libusb_transfer *transfer,
1613 libusb_device_handle *dev_handle, unsigned char endpoint,
1614 unsigned char *buffer, int length, libusb_transfer_cb_fn callback,
1615 void *user_data, unsigned int timeout)
1616{
1617 transfer->dev_handle = dev_handle;
1618 transfer->endpoint = endpoint;
1619 transfer->type = LIBUSB_TRANSFER_TYPE_BULK;
1620 transfer->timeout = timeout;
1621 transfer->buffer = buffer;
1622 transfer->length = length;
1623 transfer->user_data = user_data;
1624 transfer->callback = callback;
1625}
1626
1643 static inline void libusb_fill_bulk_stream_transfer(
1644 struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
1645 unsigned char endpoint, uint32_t stream_id,
1646 unsigned char *buffer, int length, libusb_transfer_cb_fn callback,
1647 void *user_data, unsigned int timeout)
1648{
1649 libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer,
1650 length, callback, user_data, timeout);
1651 transfer->type = LIBUSB_TRANSFER_TYPE_BULK_STREAM;
1652 libusb_transfer_set_stream_id(transfer, stream_id);
1653}
1654
1668 static inline void libusb_fill_interrupt_transfer(
1669 struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
1670 unsigned char endpoint, unsigned char *buffer, int length,
1671 libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
1672{
1673 transfer->dev_handle = dev_handle;
1674 transfer->endpoint = endpoint;
1675 transfer->type = LIBUSB_TRANSFER_TYPE_INTERRUPT;
1676 transfer->timeout = timeout;
1677 transfer->buffer = buffer;
1678 transfer->length = length;
1679 transfer->user_data = user_data;
1680 transfer->callback = callback;
1681}
1682
1697 static inline void libusb_fill_iso_transfer(struct libusb_transfer *transfer,
1698 libusb_device_handle *dev_handle, unsigned char endpoint,
1699 unsigned char *buffer, int length, int num_iso_packets,
1700 libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
1701{
1702 transfer->dev_handle = dev_handle;
1703 transfer->endpoint = endpoint;
1704 transfer->type = LIBUSB_TRANSFER_TYPE_ISOCHRONOUS;
1705 transfer->timeout = timeout;
1706 transfer->buffer = buffer;
1707 transfer->length = length;
1708 transfer->num_iso_packets = num_iso_packets;
1709 transfer->user_data = user_data;
1710 transfer->callback = callback;
1711}
1712
1721 static inline void libusb_set_iso_packet_lengths(
1722 struct libusb_transfer *transfer, unsigned int length)
1723{
1724 int i;
1725
1726 for (i = 0; i < transfer->num_iso_packets; i++)
1727 transfer->iso_packet_desc[i].length = length;
1728}
1729
1746 static inline unsigned char *libusb_get_iso_packet_buffer(
1747 struct libusb_transfer *transfer, unsigned int packet)
1748{
1749 int i;
1750 size_t offset = 0;
1751 int _packet;
1752
1753 /* oops..slight bug in the API. packet is an unsigned int, but we use
1754 * signed integers almost everywhere else. range-check and convert to
1755 * signed to avoid compiler warnings. FIXME for libusb-2. */
1756 if (packet > INT_MAX)
1757 return NULL;
1758 _packet = (int) packet;
1759
1760 if (_packet >= transfer->num_iso_packets)
1761 return NULL;
1762
1763 for (i = 0; i < _packet; i++)
1764 offset += transfer->iso_packet_desc[i].length;
1765
1766 return transfer->buffer + offset;
1767}
1768
1788 static inline unsigned char *libusb_get_iso_packet_buffer_simple(
1789 struct libusb_transfer *transfer, unsigned int packet)
1790{
1791 int _packet;
1792
1793 /* oops..slight bug in the API. packet is an unsigned int, but we use
1794 * signed integers almost everywhere else. range-check and convert to
1795 * signed to avoid compiler warnings. FIXME for libusb-2. */
1796 if (packet > INT_MAX)
1797 return NULL;
1798 _packet = (int) packet;
1799
1800 if (_packet >= transfer->num_iso_packets)
1801 return NULL;
1802
1803 return transfer->buffer + ((int) transfer->iso_packet_desc[0].length * _packet);
1804}
1805
1806/* sync I/O */
1807
1808int LIBUSB_CALL libusb_control_transfer(libusb_device_handle *dev_handle,
1809 uint8_t request_type, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
1810 unsigned char *data, uint16_t wLength, unsigned int timeout);
1811
1812int LIBUSB_CALL libusb_bulk_transfer(libusb_device_handle *dev_handle,
1813 unsigned char endpoint, unsigned char *data, int length,
1814 int *actual_length, unsigned int timeout);
1815
1816int LIBUSB_CALL libusb_interrupt_transfer(libusb_device_handle *dev_handle,
1817 unsigned char endpoint, unsigned char *data, int length,
1818 int *actual_length, unsigned int timeout);
1819
1832 static inline int libusb_get_descriptor(libusb_device_handle *dev_handle,
1833 uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length)
1834{
1835 return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN,
1836 LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t) ((desc_type << 8) | desc_index),
1837 0, data, (uint16_t) length, 1000);
1838}
1839
1854 static inline int libusb_get_string_descriptor(libusb_device_handle *dev_handle,
1855 uint8_t desc_index, uint16_t langid, unsigned char *data, int length)
1856{
1857 return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN,
1858 LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t)((LIBUSB_DT_STRING << 8) | desc_index),
1859 langid, data, (uint16_t) length, 1000);
1860}
1861
1862int LIBUSB_CALL libusb_get_string_descriptor_ascii(libusb_device_handle *dev_handle,
1863 uint8_t desc_index, unsigned char *data, int length);
1864
1865/* polling and timeouts */
1866
1867int LIBUSB_CALL libusb_try_lock_events(libusb_context *ctx);
1868void LIBUSB_CALL libusb_lock_events(libusb_context *ctx);
1869void LIBUSB_CALL libusb_unlock_events(libusb_context *ctx);
1870int LIBUSB_CALL libusb_event_handling_ok(libusb_context *ctx);
1871int LIBUSB_CALL libusb_event_handler_active(libusb_context *ctx);
1872void LIBUSB_CALL libusb_interrupt_event_handler(libusb_context *ctx);
1873void LIBUSB_CALL libusb_lock_event_waiters(libusb_context *ctx);
1874void LIBUSB_CALL libusb_unlock_event_waiters(libusb_context *ctx);
1875int LIBUSB_CALL libusb_wait_for_event(libusb_context *ctx, struct timeval *tv);
1876
1877int LIBUSB_CALL libusb_handle_events_timeout(libusb_context *ctx,
1878 struct timeval *tv);
1879int LIBUSB_CALL libusb_handle_events_timeout_completed(libusb_context *ctx,
1880 struct timeval *tv, int *completed);
1881int LIBUSB_CALL libusb_handle_events(libusb_context *ctx);
1882int LIBUSB_CALL libusb_handle_events_completed(libusb_context *ctx, int *completed);
1883int LIBUSB_CALL libusb_handle_events_locked(libusb_context *ctx,
1884 struct timeval *tv);
1885int LIBUSB_CALL libusb_pollfds_handle_timeouts(libusb_context *ctx);
1886int LIBUSB_CALL libusb_get_next_timeout(libusb_context *ctx,
1887 struct timeval *tv);
1888
1892 struct libusb_pollfd {
1894 int fd;
1895
1900 short events;
1901};
1902
1913 typedef void (LIBUSB_CALL *libusb_pollfd_added_cb)(int fd, short events,
1914 void *user_data);
1915
1925 typedef void (LIBUSB_CALL *libusb_pollfd_removed_cb)(int fd, void *user_data);
1926
1927const struct libusb_pollfd ** LIBUSB_CALL libusb_get_pollfds(
1928 libusb_context *ctx);
1929void LIBUSB_CALL libusb_free_pollfds(const struct libusb_pollfd **pollfds);
1930void LIBUSB_CALL libusb_set_pollfd_notifiers(libusb_context *ctx,
1931 libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb,
1932 void *user_data);
1933
1946 typedef int libusb_hotplug_callback_handle;
1947
1953 typedef enum {
1955 LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = (1 << 0),
1956
1960 LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = (1 << 1)
1961} libusb_hotplug_event;
1962
1968 typedef enum {
1970 LIBUSB_HOTPLUG_ENUMERATE = (1 << 0)
1971} libusb_hotplug_flag;
1972
1975#define LIBUSB_HOTPLUG_NO_FLAGS 0
1976
1979#define LIBUSB_HOTPLUG_MATCH_ANY -1
1980
2003 typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
2004 libusb_device *device, libusb_hotplug_event event, void *user_data);
2005
2041int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx,
2042 int events, int flags,
2043 int vendor_id, int product_id, int dev_class,
2044 libusb_hotplug_callback_fn cb_fn, void *user_data,
2045 libusb_hotplug_callback_handle *callback_handle);
2046
2058void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx,
2059 libusb_hotplug_callback_handle callback_handle);
2060
2069void * LIBUSB_CALL libusb_hotplug_get_user_data(libusb_context *ctx,
2070 libusb_hotplug_callback_handle callback_handle);
2071
2075 enum libusb_option {
2097 LIBUSB_OPTION_LOG_LEVEL = 0,
2098
2106 LIBUSB_OPTION_USE_USBDK = 1,
2107
2125 LIBUSB_OPTION_NO_DEVICE_DISCOVERY = 2,
2126
2127#define LIBUSB_OPTION_WEAK_AUTHORITY LIBUSB_OPTION_NO_DEVICE_DISCOVERY
2128
2129 LIBUSB_OPTION_MAX = 3
2130};
2131
2132int LIBUSB_CALL libusb_set_option(libusb_context *ctx, enum libusb_option option, ...);
2133
2134#ifdef _MSC_VER
2135#pragma warning(pop)
2136#endif
2137
2138#if defined(__cplusplus)
2139}
2140#endif
2141
2142#endif
libusb_transfer_cb_fn
void(* libusb_transfer_cb_fn)(struct libusb_transfer *transfer)
Asynchronous transfer callback function type.
Definition: libusb.h:1221
libusb_transfer_flags
libusb_transfer_flags
libusb_transfer.flags values
Definition: libusb.h:1155
libusb_dev_mem_alloc
unsigned char * libusb_dev_mem_alloc(libusb_device_handle *dev_handle, size_t length)
Attempts to allocate a block of persistent DMA memory suitable for transfers against the given device...
Definition: core.c:1929
libusb_fill_iso_transfer
static void libusb_fill_iso_transfer(struct libusb_transfer *transfer, libusb_device_handle *dev_handle, unsigned char endpoint, unsigned char *buffer, int length, int num_iso_packets, libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
Helper function to populate the required libusb_transfer fields for an isochronous transfer.
Definition: libusb.h:1697
libusb_fill_control_transfer
static void libusb_fill_control_transfer(struct libusb_transfer *transfer, libusb_device_handle *dev_handle, unsigned char *buffer, libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
Helper function to populate the required libusb_transfer fields for a control transfer.
Definition: libusb.h:1581
libusb_control_transfer_get_data
static unsigned char * libusb_control_transfer_get_data(struct libusb_transfer *transfer)
Get the data section of a control transfer.
Definition: libusb.h:1485
libusb_get_iso_packet_buffer_simple
static unsigned char * libusb_get_iso_packet_buffer_simple(struct libusb_transfer *transfer, unsigned int packet)
Convenience function to locate the position of an isochronous packet within the buffer of an isochron...
Definition: libusb.h:1788
libusb_fill_control_setup
static void libusb_fill_control_setup(unsigned char *buffer, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength)
Helper function to populate the setup packet (first 8 bytes of the data buffer) for a control transfe...
Definition: libusb.h:1532
libusb_transfer_get_stream_id
uint32_t libusb_transfer_get_stream_id(struct libusb_transfer *transfer)
Get a transfers bulk stream id.
Definition: io.c:1666
libusb_cancel_transfer
int libusb_cancel_transfer(struct libusb_transfer *transfer)
Asynchronously cancel a previously submitted transfer.
Definition: io.c:1605
libusb_free_transfer
void libusb_free_transfer(struct libusb_transfer *transfer)
Free a transfer structure.
Definition: io.c:1332
libusb_fill_interrupt_transfer
static void libusb_fill_interrupt_transfer(struct libusb_transfer *transfer, libusb_device_handle *dev_handle, unsigned char endpoint, unsigned char *buffer, int length, libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
Helper function to populate the required libusb_transfer fields for an interrupt transfer.
Definition: libusb.h:1668
libusb_transfer_status
libusb_transfer_status
Transfer status codes.
Definition: libusb.h:1125
libusb_alloc_transfer
struct libusb_transfer * libusb_alloc_transfer(int iso_packets)
Allocate a libusb transfer with a specified number of isochronous packet descriptors.
Definition: io.c:1285
libusb_control_transfer_get_setup
static struct libusb_control_setup * libusb_control_transfer_get_setup(struct libusb_transfer *transfer)
Get the control setup packet of a control transfer.
Definition: libusb.h:1503
libusb_free_streams
int libusb_free_streams(libusb_device_handle *dev_handle, unsigned char *endpoints, int num_endpoints)
Free usb bulk streams allocated with libusb_alloc_streams().
Definition: core.c:1886
libusb_submit_transfer
int libusb_submit_transfer(struct libusb_transfer *transfer)
Submit a transfer.
Definition: io.c:1490
libusb_fill_bulk_stream_transfer
static void libusb_fill_bulk_stream_transfer(struct libusb_transfer *transfer, libusb_device_handle *dev_handle, unsigned char endpoint, uint32_t stream_id, unsigned char *buffer, int length, libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
Helper function to populate the required libusb_transfer fields for a bulk transfer using bulk stream...
Definition: libusb.h:1643
libusb_transfer_type
libusb_transfer_type
Transfer type.
Definition: libusb.h:1106
libusb_set_iso_packet_lengths
static void libusb_set_iso_packet_lengths(struct libusb_transfer *transfer, unsigned int length)
Convenience function to set the length of all packets in an isochronous transfer, based on the num_is...
Definition: libusb.h:1721
libusb_fill_bulk_transfer
static void libusb_fill_bulk_transfer(struct libusb_transfer *transfer, libusb_device_handle *dev_handle, unsigned char endpoint, unsigned char *buffer, int length, libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
Helper function to populate the required libusb_transfer fields for a bulk transfer.
Definition: libusb.h:1612
libusb_dev_mem_free
int libusb_dev_mem_free(libusb_device_handle *dev_handle, unsigned char *buffer, size_t length)
Free device memory allocated with libusb_dev_mem_alloc().
Definition: core.c:1949
libusb_alloc_streams
int libusb_alloc_streams(libusb_device_handle *dev_handle, uint32_t num_streams, unsigned char *endpoints, int num_endpoints)
Allocate up to num_streams usb bulk streams on the specified endpoints.
Definition: core.c:1856
libusb_get_iso_packet_buffer
static unsigned char * libusb_get_iso_packet_buffer(struct libusb_transfer *transfer, unsigned int packet)
Convenience function to locate the position of an isochronous packet within the buffer of an isochron...
Definition: libusb.h:1746
libusb_transfer_set_stream_id
void libusb_transfer_set_stream_id(struct libusb_transfer *transfer, uint32_t stream_id)
Set a transfers bulk stream id.
Definition: io.c:1649
LIBUSB_TRANSFER_ADD_ZERO_PACKET
@ LIBUSB_TRANSFER_ADD_ZERO_PACKET
Terminate transfers that are a multiple of the endpoint's wMaxPacketSize with an extra zero length pa...
Definition: libusb.h:1194
LIBUSB_TRANSFER_FREE_TRANSFER
@ LIBUSB_TRANSFER_FREE_TRANSFER
Automatically call libusb_free_transfer() after callback returns.
Definition: libusb.h:1169
LIBUSB_TRANSFER_SHORT_NOT_OK
@ LIBUSB_TRANSFER_SHORT_NOT_OK
Report short frames as errors.
Definition: libusb.h:1157
LIBUSB_TRANSFER_FREE_BUFFER
@ LIBUSB_TRANSFER_FREE_BUFFER
Automatically free() transfer buffer during libusb_free_transfer().
Definition: libusb.h:1163
LIBUSB_TRANSFER_STALL
@ LIBUSB_TRANSFER_STALL
For bulk/interrupt endpoints: halt condition detected (endpoint stalled).
Definition: libusb.h:1141
LIBUSB_TRANSFER_COMPLETED
@ LIBUSB_TRANSFER_COMPLETED
Transfer completed without error.
Definition: libusb.h:1128
LIBUSB_TRANSFER_CANCELLED
@ LIBUSB_TRANSFER_CANCELLED
Transfer was cancelled.
Definition: libusb.h:1137
LIBUSB_TRANSFER_ERROR
@ LIBUSB_TRANSFER_ERROR
Transfer failed.
Definition: libusb.h:1131
LIBUSB_TRANSFER_OVERFLOW
@ LIBUSB_TRANSFER_OVERFLOW
Device sent more data than requested.
Definition: libusb.h:1147
LIBUSB_TRANSFER_NO_DEVICE
@ LIBUSB_TRANSFER_NO_DEVICE
Device was disconnected.
Definition: libusb.h:1144
LIBUSB_TRANSFER_TIMED_OUT
@ LIBUSB_TRANSFER_TIMED_OUT
Transfer timed out.
Definition: libusb.h:1134
LIBUSB_TRANSFER_TYPE_BULK_STREAM
@ LIBUSB_TRANSFER_TYPE_BULK_STREAM
Bulk stream transfer.
Definition: libusb.h:1120
LIBUSB_TRANSFER_TYPE_ISOCHRONOUS
@ LIBUSB_TRANSFER_TYPE_ISOCHRONOUS
Isochronous transfer.
Definition: libusb.h:1111
LIBUSB_TRANSFER_TYPE_CONTROL
@ LIBUSB_TRANSFER_TYPE_CONTROL
Control transfer.
Definition: libusb.h:1108
LIBUSB_TRANSFER_TYPE_BULK
@ LIBUSB_TRANSFER_TYPE_BULK
Bulk transfer.
Definition: libusb.h:1114
LIBUSB_TRANSFER_TYPE_INTERRUPT
@ LIBUSB_TRANSFER_TYPE_INTERRUPT
Interrupt transfer.
Definition: libusb.h:1117
libusb_get_string_descriptor
static int libusb_get_string_descriptor(libusb_device_handle *dev_handle, uint8_t desc_index, uint16_t langid, unsigned char *data, int length)
Retrieve a descriptor from a device.
Definition: libusb.h:1854
libusb_descriptor_type
libusb_descriptor_type
Descriptor types as defined by the USB specification.
Definition: libusb.h:252
libusb_supported_speed
libusb_supported_speed
Supported speeds (wSpeedSupported) bitfield.
Definition: libusb.h:478
libusb_free_config_descriptor
void libusb_free_config_descriptor(struct libusb_config_descriptor *config)
Free a configuration descriptor obtained from libusb_get_active_config_descriptor() or libusb_get_con...
Definition: descriptor.c:682
libusb_get_string_descriptor_ascii
int libusb_get_string_descriptor_ascii(libusb_device_handle *dev_handle, uint8_t desc_index, unsigned char *data, int length)
Retrieve a string descriptor in C style ASCII.
Definition: descriptor.c:1085
libusb_get_config_descriptor_by_value
int libusb_get_config_descriptor_by_value(libusb_device *dev, uint8_t bConfigurationValue, struct libusb_config_descriptor **config)
Get a USB configuration descriptor with a specific bConfigurationValue.
Definition: descriptor.c:642
libusb_get_active_config_descriptor
int libusb_get_active_config_descriptor(libusb_device *dev, struct libusb_config_descriptor **config)
Get the USB configuration descriptor for the currently active configuration.
Definition: descriptor.c:555
libusb_free_ss_endpoint_companion_descriptor
void libusb_free_ss_endpoint_companion_descriptor(struct libusb_ss_endpoint_companion_descriptor *ep_comp)
Free a superspeed endpoint companion descriptor obtained from libusb_get_ss_endpoint_companion_descri...
Definition: descriptor.c:754
libusb_get_device_descriptor
int libusb_get_device_descriptor(libusb_device *dev, struct libusb_device_descriptor *desc)
Get the USB device descriptor for a given device.
Definition: descriptor.c:531
libusb_free_usb_2_0_extension_descriptor
void libusb_free_usb_2_0_extension_descriptor(struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension)
Free a USB 2.0 Extension descriptor obtained from libusb_get_usb_2_0_extension_descriptor().
Definition: descriptor.c:957
libusb_get_bos_descriptor
int libusb_get_bos_descriptor(libusb_device_handle *dev_handle, struct libusb_bos_descriptor **bos)
Get a Binary Object Store (BOS) descriptor This is a BLOCKING function, which will send requests to t...
Definition: descriptor.c:846
libusb_bos_type
libusb_bos_type
USB capability types.
Definition: libusb.h:515
libusb_get_container_id_descriptor
int libusb_get_container_id_descriptor(libusb_context *ctx, struct libusb_bos_dev_capability_descriptor *dev_cap, struct libusb_container_id_descriptor **container_id)
Get a Container ID descriptor.
Definition: descriptor.c:1032
libusb_endpoint_direction
libusb_endpoint_direction
Endpoint direction.
Definition: libusb.h:323
libusb_endpoint_transfer_type
libusb_endpoint_transfer_type
Endpoint transfer type.
Definition: libusb.h:337
libusb_free_ss_usb_device_capability_descriptor
void libusb_free_ss_usb_device_capability_descriptor(struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap)
Free a SuperSpeed USB Device Capability descriptor obtained from libusb_get_ss_usb_device_capability_...
Definition: descriptor.c:1013
libusb_get_descriptor
static int libusb_get_descriptor(libusb_device_handle *dev_handle, uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length)
Retrieve a descriptor from the default control pipe.
Definition: libusb.h:1832
libusb_iso_sync_type
libusb_iso_sync_type
Synchronization type for isochronous endpoints.
Definition: libusb.h:442
libusb_get_config_descriptor
int libusb_get_config_descriptor(libusb_device *dev, uint8_t config_index, struct libusb_config_descriptor **config)
Get a USB configuration descriptor based on its index.
Definition: descriptor.c:596
libusb_ss_usb_device_capability_attributes
libusb_ss_usb_device_capability_attributes
Masks for the bits of the bmAttributes field field of the SuperSpeed USB Device Capability descriptor...
Definition: libusb.h:507
libusb_get_ss_endpoint_companion_descriptor
int libusb_get_ss_endpoint_companion_descriptor(libusb_context *ctx, const struct libusb_endpoint_descriptor *endpoint, struct libusb_ss_endpoint_companion_descriptor **ep_comp)
Get an endpoints superspeed endpoint companion descriptor (if any)
Definition: descriptor.c:705
libusb_iso_usage_type
libusb_iso_usage_type
Usage type for isochronous endpoints.
Definition: libusb.h:463
libusb_class_code
libusb_class_code
Device and/or Interface Class codes.
Definition: libusb.h:187
libusb_get_ss_usb_device_capability_descriptor
int libusb_get_ss_usb_device_capability_descriptor(libusb_context *ctx, struct libusb_bos_dev_capability_descriptor *dev_cap, struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap)
Get a SuperSpeed USB Device Capability descriptor.
Definition: descriptor.c:976
libusb_free_bos_descriptor
void libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos)
Free a BOS descriptor obtained from libusb_get_bos_descriptor().
Definition: descriptor.c:896
libusb_usb_2_0_extension_attributes
libusb_usb_2_0_extension_attributes
Masks for the bits of the bmAttributes field of the USB 2.0 Extension descriptor.
Definition: libusb.h:497
libusb_get_usb_2_0_extension_descriptor
int libusb_get_usb_2_0_extension_descriptor(libusb_context *ctx, struct libusb_bos_dev_capability_descriptor *dev_cap, struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension)
Get an USB 2.0 Extension descriptor.
Definition: descriptor.c:921
libusb_free_container_id_descriptor
void libusb_free_container_id_descriptor(struct libusb_container_id_descriptor *container_id)
Free a Container ID descriptor obtained from libusb_get_container_id_descriptor().
Definition: descriptor.c:1067
LIBUSB_DT_HUB
@ LIBUSB_DT_HUB
Hub descriptor.
Definition: libusb.h:284
LIBUSB_DT_CONFIG
@ LIBUSB_DT_CONFIG
Configuration descriptor.
Definition: libusb.h:257
LIBUSB_DT_STRING
@ LIBUSB_DT_STRING
String descriptor.
Definition: libusb.h:260
LIBUSB_DT_HID
@ LIBUSB_DT_HID
HID descriptor.
Definition: libusb.h:275
LIBUSB_DT_REPORT
@ LIBUSB_DT_REPORT
HID report descriptor.
Definition: libusb.h:278
LIBUSB_DT_DEVICE
@ LIBUSB_DT_DEVICE
Device descriptor.
Definition: libusb.h:254
LIBUSB_DT_DEVICE_CAPABILITY
@ LIBUSB_DT_DEVICE_CAPABILITY
Device Capability descriptor.
Definition: libusb.h:272
LIBUSB_DT_SUPERSPEED_HUB
@ LIBUSB_DT_SUPERSPEED_HUB
SuperSpeed Hub descriptor.
Definition: libusb.h:287
LIBUSB_DT_PHYSICAL
@ LIBUSB_DT_PHYSICAL
Physical descriptor.
Definition: libusb.h:281
LIBUSB_DT_INTERFACE
@ LIBUSB_DT_INTERFACE
Interface descriptor.
Definition: libusb.h:263
LIBUSB_DT_ENDPOINT
@ LIBUSB_DT_ENDPOINT
Endpoint descriptor.
Definition: libusb.h:266
LIBUSB_DT_SS_ENDPOINT_COMPANION
@ LIBUSB_DT_SS_ENDPOINT_COMPANION
SuperSpeed Endpoint Companion descriptor.
Definition: libusb.h:290
LIBUSB_DT_BOS
@ LIBUSB_DT_BOS
BOS descriptor.
Definition: libusb.h:269
LIBUSB_HIGH_SPEED_OPERATION
@ LIBUSB_HIGH_SPEED_OPERATION
High speed operation supported (480MBit/s).
Definition: libusb.h:486
LIBUSB_LOW_SPEED_OPERATION
@ LIBUSB_LOW_SPEED_OPERATION
Low speed operation supported (1.5MBit/s).
Definition: libusb.h:480
LIBUSB_SUPER_SPEED_OPERATION
@ LIBUSB_SUPER_SPEED_OPERATION
Superspeed operation supported (5000MBit/s).
Definition: libusb.h:489
LIBUSB_FULL_SPEED_OPERATION
@ LIBUSB_FULL_SPEED_OPERATION
Full speed operation supported (12MBit/s).
Definition: libusb.h:483
LIBUSB_BT_USB_2_0_EXTENSION
@ LIBUSB_BT_USB_2_0_EXTENSION
USB 2.0 extensions.
Definition: libusb.h:520
LIBUSB_BT_SS_USB_DEVICE_CAPABILITY
@ LIBUSB_BT_SS_USB_DEVICE_CAPABILITY
SuperSpeed USB device capability.
Definition: libusb.h:523
LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY
@ LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY
Wireless USB device capability.
Definition: libusb.h:517
LIBUSB_BT_CONTAINER_ID
@ LIBUSB_BT_CONTAINER_ID
Container ID type.
Definition: libusb.h:526
LIBUSB_ENDPOINT_IN
@ LIBUSB_ENDPOINT_IN
In: device-to-host.
Definition: libusb.h:328
LIBUSB_ENDPOINT_OUT
@ LIBUSB_ENDPOINT_OUT
Out: host-to-device.
Definition: libusb.h:325
LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT
@ LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT
Interrupt endpoint.
Definition: libusb.h:348
LIBUSB_ENDPOINT_TRANSFER_TYPE_ISOCHRONOUS
@ LIBUSB_ENDPOINT_TRANSFER_TYPE_ISOCHRONOUS
Isochronous endpoint.
Definition: libusb.h:342
LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK
@ LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK
Bulk endpoint.
Definition: libusb.h:345
LIBUSB_ENDPOINT_TRANSFER_TYPE_CONTROL
@ LIBUSB_ENDPOINT_TRANSFER_TYPE_CONTROL
Control endpoint.
Definition: libusb.h:339
LIBUSB_ISO_SYNC_TYPE_SYNC
@ LIBUSB_ISO_SYNC_TYPE_SYNC
Synchronous.
Definition: libusb.h:453
LIBUSB_ISO_SYNC_TYPE_NONE
@ LIBUSB_ISO_SYNC_TYPE_NONE
No synchronization.
Definition: libusb.h:444
LIBUSB_ISO_SYNC_TYPE_ADAPTIVE
@ LIBUSB_ISO_SYNC_TYPE_ADAPTIVE
Adaptive.
Definition: libusb.h:450
LIBUSB_ISO_SYNC_TYPE_ASYNC
@ LIBUSB_ISO_SYNC_TYPE_ASYNC
Asynchronous.
Definition: libusb.h:447
LIBUSB_BM_LTM_SUPPORT
@ LIBUSB_BM_LTM_SUPPORT
Supports Latency Tolerance Messages (LTM)
Definition: libusb.h:509
LIBUSB_ISO_USAGE_TYPE_DATA
@ LIBUSB_ISO_USAGE_TYPE_DATA
Data endpoint.
Definition: libusb.h:465
LIBUSB_ISO_USAGE_TYPE_FEEDBACK
@ LIBUSB_ISO_USAGE_TYPE_FEEDBACK
Feedback endpoint.
Definition: libusb.h:468
LIBUSB_ISO_USAGE_TYPE_IMPLICIT
@ LIBUSB_ISO_USAGE_TYPE_IMPLICIT
Implicit feedback Data endpoint.
Definition: libusb.h:471
LIBUSB_CLASS_AUDIO
@ LIBUSB_CLASS_AUDIO
Audio class.
Definition: libusb.h:195
LIBUSB_CLASS_HUB
@ LIBUSB_CLASS_HUB
Hub class.
Definition: libusb.h:217
LIBUSB_CLASS_MISCELLANEOUS
@ LIBUSB_CLASS_MISCELLANEOUS
Miscellaneous class.
Definition: libusb.h:241
LIBUSB_CLASS_APPLICATION
@ LIBUSB_CLASS_APPLICATION
Application class.
Definition: libusb.h:244
LIBUSB_CLASS_CONTENT_SECURITY
@ LIBUSB_CLASS_CONTENT_SECURITY
Content Security.
Definition: libusb.h:226
LIBUSB_CLASS_DIAGNOSTIC_DEVICE
@ LIBUSB_CLASS_DIAGNOSTIC_DEVICE
Diagnostic Device.
Definition: libusb.h:235
LIBUSB_CLASS_PHYSICAL
@ LIBUSB_CLASS_PHYSICAL
Physical.
Definition: libusb.h:204
LIBUSB_CLASS_COMM
@ LIBUSB_CLASS_COMM
Communications class.
Definition: libusb.h:198
LIBUSB_CLASS_VIDEO
@ LIBUSB_CLASS_VIDEO
Video.
Definition: libusb.h:229
LIBUSB_CLASS_DATA
@ LIBUSB_CLASS_DATA
Data class.
Definition: libusb.h:220
LIBUSB_CLASS_WIRELESS
@ LIBUSB_CLASS_WIRELESS
Wireless class.
Definition: libusb.h:238
LIBUSB_CLASS_PRINTER
@ LIBUSB_CLASS_PRINTER
Printer class.
Definition: libusb.h:211
LIBUSB_CLASS_PERSONAL_HEALTHCARE
@ LIBUSB_CLASS_PERSONAL_HEALTHCARE
Personal Healthcare.
Definition: libusb.h:232
LIBUSB_CLASS_PER_INTERFACE
@ LIBUSB_CLASS_PER_INTERFACE
In the context of a device descriptor, this bDeviceClass value indicates that each interface specifie...
Definition: libusb.h:192
LIBUSB_CLASS_MASS_STORAGE
@ LIBUSB_CLASS_MASS_STORAGE
Mass storage class.
Definition: libusb.h:214
LIBUSB_CLASS_HID
@ LIBUSB_CLASS_HID
Human Interface Device class.
Definition: libusb.h:201
LIBUSB_CLASS_VENDOR_SPEC
@ LIBUSB_CLASS_VENDOR_SPEC
Class is vendor-specific.
Definition: libusb.h:247
LIBUSB_CLASS_IMAGE
@ LIBUSB_CLASS_IMAGE
Image class.
Definition: libusb.h:207
LIBUSB_CLASS_SMART_CARD
@ LIBUSB_CLASS_SMART_CARD
Smart Card.
Definition: libusb.h:223
LIBUSB_BM_LPM_SUPPORT
@ LIBUSB_BM_LPM_SUPPORT
Supports Link Power Management (LPM)
Definition: libusb.h:499
libusb_open_device_with_vid_pid
libusb_device_handle * libusb_open_device_with_vid_pid(libusb_context *ctx, uint16_t vendor_id, uint16_t product_id)
Convenience function for finding a device with a particular idVendor/idProduct combination.
Definition: core.c:1352
libusb_get_port_number
uint8_t libusb_get_port_number(libusb_device *dev)
Get the number of the port that a device is connected to.
Definition: core.c:926
libusb_get_parent
libusb_device * libusb_get_parent(libusb_device *dev)
Get the the parent from the specified device.
Definition: core.c:988
libusb_kernel_driver_active
int libusb_kernel_driver_active(libusb_device_handle *dev_handle, int interface_number)
Determine if a kernel driver is active on an interface.
Definition: core.c:1975
libusb_ref_device
libusb_device * libusb_ref_device(libusb_device *dev)
Increment the reference count of a device.
Definition: core.c:1165
libusb_speed
libusb_speed
Speed codes.
Definition: libusb.h:1027
libusb_get_device
libusb_device * libusb_get_device(libusb_device_handle *dev_handle)
Get the underlying device for a device handle.
Definition: core.c:1514
libusb_unref_device
void libusb_unref_device(libusb_device *dev)
Decrement the reference count of a device.
Definition: core.c:1180
libusb_open
int libusb_open(libusb_device *dev, libusb_device_handle **dev_handle)
Open a device and obtain a device handle.
Definition: core.c:1297
libusb_set_interface_alt_setting
int libusb_set_interface_alt_setting(libusb_device_handle *dev_handle, int interface_number, int alternate_setting)
Activate an alternate setting for an interface.
Definition: core.c:1752
libusb_release_interface
int libusb_release_interface(libusb_device_handle *dev_handle, int interface_number)
Release an interface previously claimed with libusb_claim_interface().
Definition: core.c:1707
libusb_get_device_speed
int libusb_get_device_speed(libusb_device *dev)
Get the negotiated connection speed for a device.
Definition: core.c:1009
libusb_detach_kernel_driver
int libusb_detach_kernel_driver(libusb_device_handle *dev_handle, int interface_number)
Detach a kernel driver from an interface.
Definition: core.c:2013
libusb_close
void libusb_close(libusb_device_handle *dev_handle)
Close a device handle.
Definition: core.c:1452
libusb_device
struct libusb_device libusb_device
Structure representing a USB device detected on the system.
Definition: libusb.h:1011
libusb_set_configuration
int libusb_set_configuration(libusb_device_handle *dev_handle, int configuration)
Set the active configuration for a device.
Definition: core.c:1626
libusb_device_handle
struct libusb_device_handle libusb_device_handle
Structure representing a handle on a USB device.
Definition: libusb.h:1022
libusb_wrap_sys_device
int libusb_wrap_sys_device(libusb_context *ctx, intptr_t sys_dev, libusb_device_handle **dev_handle)
Wrap a platform-specific system device handle and obtain a libusb device handle for the underlying de...
Definition: core.c:1242
libusb_get_port_path
int libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *path, uint8_t path_length)
Definition: core.c:968
libusb_get_port_numbers
int libusb_get_port_numbers(libusb_device *dev, uint8_t *port_numbers, int port_numbers_len)
Get the list of all port numbers from root for the specified device.
Definition: core.c:942
libusb_get_device_address
uint8_t libusb_get_device_address(libusb_device *dev)
Get the address of the device on the bus it is connected to.
Definition: core.c:998
libusb_clear_halt
int libusb_clear_halt(libusb_device_handle *dev_handle, unsigned char endpoint)
Clear the halt/stall condition for an endpoint.
Definition: core.c:1794
libusb_get_device_list
ssize_t libusb_get_device_list(libusb_context *ctx, libusb_device ***list)
Returns a list of USB devices currently attached to the system.
Definition: core.c:816
libusb_set_auto_detach_kernel_driver
int libusb_set_auto_detach_kernel_driver(libusb_device_handle *dev_handle, int enable)
Enable/disable libusb's automatic kernel driver detachment.
Definition: core.c:2088
libusb_get_max_packet_size
int libusb_get_max_packet_size(libusb_device *dev, unsigned char endpoint)
Convenience function to retrieve the wMaxPacketSize value for a particular endpoint in the active dev...
Definition: core.c:1055
libusb_free_device_list
void libusb_free_device_list(libusb_device **list, int unref_devices)
Frees a list of devices previously discovered using libusb_get_device_list().
Definition: core.c:886
libusb_attach_kernel_driver
int libusb_attach_kernel_driver(libusb_device_handle *dev_handle, int interface_number)
Re-attach an interface's kernel driver, which was previously detached using libusb_detach_kernel_driv...
Definition: core.c:2049
libusb_get_configuration
int libusb_get_configuration(libusb_device_handle *dev, int *config)
Determine the bConfigurationValue of the currently active configuration.
Definition: core.c:1539
libusb_get_max_iso_packet_size
int libusb_get_max_iso_packet_size(libusb_device *dev, unsigned char endpoint)
Calculate the maximum packet size which a specific endpoint is capable is sending or receiving in the...
Definition: core.c:1110
libusb_claim_interface
int libusb_claim_interface(libusb_device_handle *dev_handle, int interface_number)
Claim an interface on a given device handle.
Definition: core.c:1663
libusb_get_bus_number
uint8_t libusb_get_bus_number(libusb_device *dev)
Get the number of the bus that a device is connected to.
Definition: core.c:907
libusb_reset_device
int libusb_reset_device(libusb_device_handle *dev_handle)
Perform a USB port reset to reinitialize a device.
Definition: core.c:1823
LIBUSB_SPEED_FULL
@ LIBUSB_SPEED_FULL
The device is operating at full speed (12MBit/s).
Definition: libusb.h:1035
LIBUSB_SPEED_HIGH
@ LIBUSB_SPEED_HIGH
The device is operating at high speed (480MBit/s).
Definition: libusb.h:1038
LIBUSB_SPEED_LOW
@ LIBUSB_SPEED_LOW
The device is operating at low speed (1.5MBit/s).
Definition: libusb.h:1032
LIBUSB_SPEED_SUPER_PLUS
@ LIBUSB_SPEED_SUPER_PLUS
The device is operating at super speed plus (10000MBit/s).
Definition: libusb.h:1044
LIBUSB_SPEED_SUPER
@ LIBUSB_SPEED_SUPER
The device is operating at super speed (5000MBit/s).
Definition: libusb.h:1041
LIBUSB_SPEED_UNKNOWN
@ LIBUSB_SPEED_UNKNOWN
The OS doesn't report or know the device speed.
Definition: libusb.h:1029
libusb_hotplug_callback_handle
int libusb_hotplug_callback_handle
Callback handle.
Definition: libusb.h:1946
libusb_hotplug_event
libusb_hotplug_event
Since version 1.0.16, LIBUSB_API_VERSION >= 0x01000102.
Definition: libusb.h:1953
libusb_hotplug_register_callback
int libusb_hotplug_register_callback(libusb_context *ctx, int events, int flags, int vendor_id, int product_id, int dev_class, libusb_hotplug_callback_fn cb_fn, void *user_data, libusb_hotplug_callback_handle *callback_handle)
Register a hotplug callback function.
Definition: hotplug.c:323
libusb_hotplug_callback_fn
int(* libusb_hotplug_callback_fn)(libusb_context *ctx, libusb_device *device, libusb_hotplug_event event, void *user_data)
Hotplug callback function type.
Definition: libusb.h:2003
libusb_hotplug_deregister_callback
void libusb_hotplug_deregister_callback(libusb_context *ctx, libusb_hotplug_callback_handle callback_handle)
Deregisters a hotplug callback.
Definition: hotplug.c:407
libusb_hotplug_flag
libusb_hotplug_flag
Since version 1.0.16, LIBUSB_API_VERSION >= 0x01000102.
Definition: libusb.h:1968
libusb_hotplug_get_user_data
void * libusb_hotplug_get_user_data(libusb_context *ctx, libusb_hotplug_callback_handle callback_handle)
Gets the user_data associated with a hotplug callback.
Definition: hotplug.c:445
LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED
@ LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED
A device has been plugged in and is ready to use.
Definition: libusb.h:1955
LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT
@ LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT
A device has left and is no longer available.
Definition: libusb.h:1960
LIBUSB_HOTPLUG_ENUMERATE
@ LIBUSB_HOTPLUG_ENUMERATE
Arm the callback and fire it for all matching currently attached devices.
Definition: libusb.h:1970
libusb_option
libusb_option
Available option values for libusb_set_option().
Definition: libusb.h:2075
libusb_log_cb_mode
libusb_log_cb_mode
Log callback mode.
Definition: libusb.h:1340
libusb_log_level
libusb_log_level
Log message levels.
Definition: libusb.h:1316
libusb_set_log_cb
void libusb_set_log_cb(libusb_context *ctx, libusb_log_cb cb, int mode)
Set log handler.
Definition: core.c:2139
libusb_context
struct libusb_context libusb_context
Structure representing a libusb session.
Definition: libusb.h:994
libusb_set_debug
void libusb_set_debug(libusb_context *ctx, int level)
Definition: core.c:2102
libusb_log_cb
void(* libusb_log_cb)(libusb_context *ctx, enum libusb_log_level level, const char *str)
Callback function for handling log messages.
Definition: libusb.h:1359
libusb_init
int libusb_init(libusb_context **ctx)
Initialize libusb.
Definition: core.c:2280
libusb_exit
void libusb_exit(libusb_context *ctx)
Deinitialize libusb.
Definition: core.c:2402
libusb_set_option
int libusb_set_option(libusb_context *ctx, enum libusb_option option,...)
Set an option in the library.
Definition: core.c:2185
LIBUSB_OPTION_NO_DEVICE_DISCOVERY
@ LIBUSB_OPTION_NO_DEVICE_DISCOVERY
Do not scan for devices.
Definition: libusb.h:2125
LIBUSB_OPTION_LOG_LEVEL
@ LIBUSB_OPTION_LOG_LEVEL
Set the log message verbosity.
Definition: libusb.h:2097
LIBUSB_OPTION_USE_USBDK
@ LIBUSB_OPTION_USE_USBDK
Use the UsbDk backend for a specific context, if available.
Definition: libusb.h:2106
LIBUSB_LOG_CB_GLOBAL
@ LIBUSB_LOG_CB_GLOBAL
Callback function handling all log messages.
Definition: libusb.h:1342
LIBUSB_LOG_CB_CONTEXT
@ LIBUSB_LOG_CB_CONTEXT
Callback function handling context related log messages.
Definition: libusb.h:1345
LIBUSB_LOG_LEVEL_WARNING
@ LIBUSB_LOG_LEVEL_WARNING
(2) : Warning and error messages are emitted
Definition: libusb.h:1324
LIBUSB_LOG_LEVEL_INFO
@ LIBUSB_LOG_LEVEL_INFO
(3) : Informational, warning and error messages are emitted
Definition: libusb.h:1327
LIBUSB_LOG_LEVEL_ERROR
@ LIBUSB_LOG_LEVEL_ERROR
(1) : Error messages are emitted
Definition: libusb.h:1321
LIBUSB_LOG_LEVEL_NONE
@ LIBUSB_LOG_LEVEL_NONE
(0) : No messages ever emitted by the library (default)
Definition: libusb.h:1318
LIBUSB_LOG_LEVEL_DEBUG
@ LIBUSB_LOG_LEVEL_DEBUG
(4) : All messages are emitted
Definition: libusb.h:1330
libusb_request_type
libusb_request_type
Request type bits of the bmRequestType field in control transfers.
Definition: libusb.h:403
libusb_setlocale
int libusb_setlocale(const char *locale)
Set the language, and only the language, not the encoding! used for translatable libusb messages.
Definition: strerror.c:178
libusb_get_version
const struct libusb_version * libusb_get_version(void)
Returns a pointer to const struct libusb_version with the version (major, minor, micro,...
Definition: core.c:2746
libusb_request_recipient
libusb_request_recipient
Recipient bits of the bmRequestType field in control transfers.
Definition: libusb.h:421
libusb_le16_to_cpu
#define libusb_le16_to_cpu
Convert a 16-bit value from little-endian to host-endian format.
Definition: libusb.h:181
libusb_strerror
const char * libusb_strerror(int errcode)
Returns a constant string with a short description of the given error code, this description is inten...
Definition: strerror.c:213
libusb_standard_request
libusb_standard_request
Standard requests, as defined in table 9-5 of the USB 3.0 specifications.
Definition: libusb.h:353
libusb_has_capability
int libusb_has_capability(uint32_t capability)
Check at runtime if the loaded library has a given capability.
Definition: core.c:2474
LIBUSB_CALL
#define LIBUSB_CALL
libusb's Windows calling convention.
Definition: libusb.h:122
libusb_capability
libusb_capability
Capabilities supported by an instance of libusb on the current running platform.
Definition: libusb.h:1295
libusb_error
libusb_error
Error codes.
Definition: libusb.h:1054
libusb_cpu_to_le16
static uint16_t libusb_cpu_to_le16(const uint16_t x)
Convert a 16-bit value from host-endian to little-endian format.
Definition: libusb.h:162
libusb_error_name
const char * libusb_error_name(int errcode)
Returns a constant NULL-terminated string with the ASCII name of a libusb error or transfer status co...
Definition: core.c:2691
LIBUSB_REQUEST_TYPE_VENDOR
@ LIBUSB_REQUEST_TYPE_VENDOR
Vendor.
Definition: libusb.h:411
LIBUSB_REQUEST_TYPE_STANDARD
@ LIBUSB_REQUEST_TYPE_STANDARD
Standard.
Definition: libusb.h:405
LIBUSB_REQUEST_TYPE_CLASS
@ LIBUSB_REQUEST_TYPE_CLASS
Class.
Definition: libusb.h:408
LIBUSB_REQUEST_TYPE_RESERVED
@ LIBUSB_REQUEST_TYPE_RESERVED
Reserved.
Definition: libusb.h:414
LIBUSB_RECIPIENT_ENDPOINT
@ LIBUSB_RECIPIENT_ENDPOINT
Endpoint.
Definition: libusb.h:429
LIBUSB_RECIPIENT_INTERFACE
@ LIBUSB_RECIPIENT_INTERFACE
Interface.
Definition: libusb.h:426
LIBUSB_RECIPIENT_OTHER
@ LIBUSB_RECIPIENT_OTHER
Other.
Definition: libusb.h:432
LIBUSB_RECIPIENT_DEVICE
@ LIBUSB_RECIPIENT_DEVICE
Device.
Definition: libusb.h:423
LIBUSB_REQUEST_CLEAR_FEATURE
@ LIBUSB_REQUEST_CLEAR_FEATURE
Clear or disable a specific feature.
Definition: libusb.h:358
LIBUSB_REQUEST_GET_INTERFACE
@ LIBUSB_REQUEST_GET_INTERFACE
Return the selected alternate setting for the specified interface.
Definition: libusb.h:383
LIBUSB_REQUEST_GET_DESCRIPTOR
@ LIBUSB_REQUEST_GET_DESCRIPTOR
Get the specified descriptor.
Definition: libusb.h:371
LIBUSB_REQUEST_SET_DESCRIPTOR
@ LIBUSB_REQUEST_SET_DESCRIPTOR
Used to update existing descriptors or add new descriptors.
Definition: libusb.h:374
LIBUSB_REQUEST_GET_STATUS
@ LIBUSB_REQUEST_GET_STATUS
Request status of the specific recipient.
Definition: libusb.h:355
LIBUSB_REQUEST_SET_FEATURE
@ LIBUSB_REQUEST_SET_FEATURE
Set or enable a specific feature.
Definition: libusb.h:363
LIBUSB_REQUEST_SET_INTERFACE
@ LIBUSB_REQUEST_SET_INTERFACE
Select an alternate interface for the specified interface.
Definition: libusb.h:386
LIBUSB_REQUEST_SET_ADDRESS
@ LIBUSB_REQUEST_SET_ADDRESS
Set device address for all future accesses.
Definition: libusb.h:368
LIBUSB_REQUEST_GET_CONFIGURATION
@ LIBUSB_REQUEST_GET_CONFIGURATION
Get the current device configuration value.
Definition: libusb.h:377
LIBUSB_REQUEST_SET_SEL
@ LIBUSB_REQUEST_SET_SEL
Sets both the U1 and U2 Exit Latency.
Definition: libusb.h:392
LIBUSB_SET_ISOCH_DELAY
@ LIBUSB_SET_ISOCH_DELAY
Delay from the time a host transmits a packet to the time it is received by the device.
Definition: libusb.h:396
LIBUSB_REQUEST_SYNCH_FRAME
@ LIBUSB_REQUEST_SYNCH_FRAME
Set then report an endpoint's synchronization frame.
Definition: libusb.h:389
LIBUSB_REQUEST_SET_CONFIGURATION
@ LIBUSB_REQUEST_SET_CONFIGURATION
Set device configuration.
Definition: libusb.h:380
LIBUSB_CAP_HAS_CAPABILITY
@ LIBUSB_CAP_HAS_CAPABILITY
The libusb_has_capability() API is available.
Definition: libusb.h:1297
LIBUSB_CAP_HAS_HOTPLUG
@ LIBUSB_CAP_HAS_HOTPLUG
Hotplug support is available on this platform.
Definition: libusb.h:1300
LIBUSB_CAP_HAS_HID_ACCESS
@ LIBUSB_CAP_HAS_HID_ACCESS
The library can access HID devices without requiring user intervention.
Definition: libusb.h:1306
LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER
@ LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER
The library supports detaching of the default USB driver, using libusb_detach_kernel_driver(),...
Definition: libusb.h:1310
LIBUSB_ERROR_NOT_SUPPORTED
@ LIBUSB_ERROR_NOT_SUPPORTED
Operation not supported or unimplemented on this platform.
Definition: libusb.h:1092
LIBUSB_ERROR_ACCESS
@ LIBUSB_ERROR_ACCESS
Access denied (insufficient permissions)
Definition: libusb.h:1065
LIBUSB_ERROR_PIPE
@ LIBUSB_ERROR_PIPE
Pipe error.
Definition: libusb.h:1083
LIBUSB_ERROR_NOT_FOUND
@ LIBUSB_ERROR_NOT_FOUND
Entity not found.
Definition: libusb.h:1071
LIBUSB_ERROR_BUSY
@ LIBUSB_ERROR_BUSY
Resource busy.
Definition: libusb.h:1074
LIBUSB_ERROR_INTERRUPTED
@ LIBUSB_ERROR_INTERRUPTED
System call interrupted (perhaps due to signal)
Definition: libusb.h:1086
LIBUSB_SUCCESS
@ LIBUSB_SUCCESS
Success (no error)
Definition: libusb.h:1056
LIBUSB_ERROR_INVALID_PARAM
@ LIBUSB_ERROR_INVALID_PARAM
Invalid parameter.
Definition: libusb.h:1062
LIBUSB_ERROR_IO
@ LIBUSB_ERROR_IO
Input/output error.
Definition: libusb.h:1059
LIBUSB_ERROR_OTHER
@ LIBUSB_ERROR_OTHER
Other error.
Definition: libusb.h:1098
LIBUSB_ERROR_TIMEOUT
@ LIBUSB_ERROR_TIMEOUT
Operation timed out.
Definition: libusb.h:1077
LIBUSB_ERROR_OVERFLOW
@ LIBUSB_ERROR_OVERFLOW
Overflow.
Definition: libusb.h:1080
LIBUSB_ERROR_NO_DEVICE
@ LIBUSB_ERROR_NO_DEVICE
No such device (it may have been disconnected)
Definition: libusb.h:1068
LIBUSB_ERROR_NO_MEM
@ LIBUSB_ERROR_NO_MEM
Insufficient memory.
Definition: libusb.h:1089
libusb_handle_events_completed
int libusb_handle_events_completed(libusb_context *ctx, int *completed)
Handle any pending events in blocking mode.
Definition: io.c:2453
libusb_lock_event_waiters
void libusb_lock_event_waiters(libusb_context *ctx)
Acquire the event waiters lock.
Definition: io.c:1976
libusb_interrupt_event_handler
void libusb_interrupt_event_handler(libusb_context *ctx)
Interrupt any active thread that is handling events.
Definition: io.c:1940
libusb_set_pollfd_notifiers
void libusb_set_pollfd_notifiers(libusb_context *ctx, libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb, void *user_data)
Register notification functions for file descriptor additions/removals.
Definition: io.c:2635
libusb_event_handler_active
int libusb_event_handler_active(libusb_context *ctx)
Determine if an active thread is handling events (i.e.
Definition: io.c:1911
libusb_unlock_event_waiters
void libusb_unlock_event_waiters(libusb_context *ctx)
Release the event waiters lock.
Definition: io.c:1987
libusb_handle_events_timeout_completed
int libusb_handle_events_timeout_completed(libusb_context *ctx, struct timeval *tv, int *completed)
Handle any pending events.
Definition: io.c:2339
libusb_handle_events
int libusb_handle_events(libusb_context *ctx)
Handle any pending events in blocking mode.
Definition: io.c:2431
libusb_get_next_timeout
int libusb_get_next_timeout(libusb_context *ctx, struct timeval *tv)
Determine the next internal timeout that libusb needs to handle.
Definition: io.c:2563
libusb_event_handling_ok
int libusb_event_handling_ok(libusb_context *ctx)
Determine if it is still OK for this thread to be doing event handling.
Definition: io.c:1882
libusb_handle_events_timeout
int libusb_handle_events_timeout(libusb_context *ctx, struct timeval *tv)
Handle any pending events.
Definition: io.c:2411
libusb_try_lock_events
int libusb_try_lock_events(libusb_context *ctx)
Attempt to acquire the event handling lock.
Definition: io.c:1789
libusb_handle_events_locked
int libusb_handle_events_locked(libusb_context *ctx, struct timeval *tv)
Handle any pending events by polling file descriptors, without checking if any other threads are alre...
Definition: io.c:2481
libusb_pollfd_removed_cb
void(* libusb_pollfd_removed_cb)(int fd, void *user_data)
Callback function, invoked when a file descriptor should be removed from the set of file descriptors ...
Definition: libusb.h:1925
libusb_pollfd_added_cb
void(* libusb_pollfd_added_cb)(int fd, short events, void *user_data)
Callback function, invoked when a new file descriptor should be added to the set of file descriptors ...
Definition: libusb.h:1913
libusb_lock_events
void libusb_lock_events(libusb_context *ctx)
Acquire the event handling lock, blocking until successful acquisition if it is contended.
Definition: io.c:1832
libusb_get_pollfds
const struct libusb_pollfd ** libusb_get_pollfds(libusb_context *ctx)
Retrieve a list of file descriptors that should be polled by your main loop as libusb event sources.
Definition: io.c:2743
libusb_unlock_events
void libusb_unlock_events(libusb_context *ctx)
Release the lock previously acquired with libusb_try_lock_events() or libusb_lock_events().
Definition: io.c:1847
libusb_free_pollfds
void libusb_free_pollfds(const struct libusb_pollfd **pollfds)
Free a list of libusb_pollfd structures.
Definition: io.c:2791
libusb_wait_for_event
int libusb_wait_for_event(libusb_context *ctx, struct timeval *tv)
Wait for another thread to signal completion of an event.
Definition: io.c:2019
libusb_pollfds_handle_timeouts
int libusb_pollfds_handle_timeouts(libusb_context *ctx)
Determines whether your application must apply special timing considerations when monitoring libusb's...
Definition: io.c:2529
libusb_interrupt_transfer
int libusb_interrupt_transfer(libusb_device_handle *dev_handle, unsigned char endpoint, unsigned char *data, int length, int *actual_length, unsigned int timeout)
Perform a USB interrupt transfer.
Definition: sync.c:328
libusb_bulk_transfer
int libusb_bulk_transfer(libusb_device_handle *dev_handle, unsigned char endpoint, unsigned char *data, int length, int *actual_length, unsigned int timeout)
Perform a USB bulk transfer.
Definition: sync.c:274
libusb_control_transfer
int libusb_control_transfer(libusb_device_handle *dev_handle, uint8_t request_type, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, unsigned char *data, uint16_t wLength, unsigned int timeout)
Perform a USB control transfer.
Definition: sync.c:97
libusb_bos_descriptor
A structure representing the Binary Device Object Store (BOS) descriptor.
Definition: libusb.h:797
libusb_bos_descriptor::wTotalLength
uint16_t wTotalLength
Length of this descriptor and all of its sub descriptors.
Definition: libusb.h:807
libusb_bos_descriptor::dev_capability
struct libusb_bos_dev_capability_descriptor * dev_capability[ZERO_SIZED_ARRAY]
bNumDeviceCap Device Capability Descriptors
Definition: libusb.h:814
libusb_bos_descriptor::bNumDeviceCaps
uint8_t bNumDeviceCaps
The number of separate device capability descriptors in the BOS.
Definition: libusb.h:811
libusb_bos_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:799
libusb_bos_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:804
libusb_bos_dev_capability_descriptor
A generic representation of a BOS Device Capability descriptor.
Definition: libusb.h:776
libusb_bos_dev_capability_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:778
libusb_bos_dev_capability_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:783
libusb_bos_dev_capability_descriptor::dev_capability_data
uint8_t dev_capability_data[ZERO_SIZED_ARRAY]
Device Capability data (bLength - 3 bytes)
Definition: libusb.h:789
libusb_bos_dev_capability_descriptor::bDevCapabilityType
uint8_t bDevCapabilityType
Device Capability type.
Definition: libusb.h:786
libusb_config_descriptor
A structure representing the standard USB configuration descriptor.
Definition: libusb.h:699
libusb_config_descriptor::bConfigurationValue
uint8_t bConfigurationValue
Identifier value for this configuration.
Definition: libusb.h:715
libusb_config_descriptor::iConfiguration
uint8_t iConfiguration
Index of string descriptor describing this configuration.
Definition: libusb.h:718
libusb_config_descriptor::extra_length
int extra_length
Length of the extra descriptors, in bytes.
Definition: libusb.h:738
libusb_config_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:701
libusb_config_descriptor::bNumInterfaces
uint8_t bNumInterfaces
Number of interfaces supported by this configuration.
Definition: libusb.h:712
libusb_config_descriptor::MaxPower
uint8_t MaxPower
Maximum power consumption of the USB device from this bus in this configuration when the device is fu...
Definition: libusb.h:727
libusb_config_descriptor::wTotalLength
uint16_t wTotalLength
Total length of data returned for this configuration.
Definition: libusb.h:709
libusb_config_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:706
libusb_config_descriptor::extra
const unsigned char * extra
Extra descriptors.
Definition: libusb.h:735
libusb_config_descriptor::bmAttributes
uint8_t bmAttributes
Configuration characteristics.
Definition: libusb.h:721
libusb_config_descriptor::interface
const struct libusb_interface * interface
Array of interfaces supported by this configuration.
Definition: libusb.h:731
libusb_container_id_descriptor
A structure representing the Container ID descriptor.
Definition: libusb.h:890
libusb_container_id_descriptor::ContainerID
uint8_t ContainerID[16]
128 bit UUID
Definition: libusb.h:908
libusb_container_id_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:897
libusb_container_id_descriptor::bDevCapabilityType
uint8_t bDevCapabilityType
Capability type.
Definition: libusb.h:902
libusb_container_id_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:892
libusb_container_id_descriptor::bReserved
uint8_t bReserved
Reserved field.
Definition: libusb.h:905
libusb_control_setup
Setup packet for control transfers.
Definition: libusb.h:916
libusb_control_setup::bRequest
uint8_t bRequest
Request.
Definition: libusb.h:929
libusb_control_setup::bmRequestType
uint8_t bmRequestType
Request type.
Definition: libusb.h:922
libusb_control_setup::wLength
uint16_t wLength
Number of bytes to transfer.
Definition: libusb.h:939
libusb_control_setup::wIndex
uint16_t wIndex
Index.
Definition: libusb.h:936
libusb_control_setup::wValue
uint16_t wValue
Value.
Definition: libusb.h:932
libusb_device_descriptor
A structure representing the standard USB device descriptor.
Definition: libusb.h:534
libusb_device_descriptor::bNumConfigurations
uint8_t bNumConfigurations
Number of possible configurations.
Definition: libusb.h:580
libusb_device_descriptor::iProduct
uint8_t iProduct
Index of string descriptor describing product.
Definition: libusb.h:574
libusb_device_descriptor::iSerialNumber
uint8_t iSerialNumber
Index of string descriptor containing device serial number.
Definition: libusb.h:577
libusb_device_descriptor::bMaxPacketSize0
uint8_t bMaxPacketSize0
Maximum packet size for endpoint 0.
Definition: libusb.h:559
libusb_device_descriptor::bDeviceProtocol
uint8_t bDeviceProtocol
USB-IF protocol code for the device, qualified by the bDeviceClass and bDeviceSubClass values.
Definition: libusb.h:556
libusb_device_descriptor::idProduct
uint16_t idProduct
USB-IF product ID.
Definition: libusb.h:565
libusb_device_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:541
libusb_device_descriptor::bDeviceSubClass
uint8_t bDeviceSubClass
USB-IF subclass code for the device, qualified by the bDeviceClass value.
Definition: libusb.h:552
libusb_device_descriptor::bDeviceClass
uint8_t bDeviceClass
USB-IF class code for the device.
Definition: libusb.h:548
libusb_device_descriptor::iManufacturer
uint8_t iManufacturer
Index of string descriptor describing manufacturer.
Definition: libusb.h:571
libusb_device_descriptor::idVendor
uint16_t idVendor
USB-IF vendor ID.
Definition: libusb.h:562
libusb_device_descriptor::bcdUSB
uint16_t bcdUSB
USB specification release number in binary-coded decimal.
Definition: libusb.h:545
libusb_device_descriptor::bcdDevice
uint16_t bcdDevice
Device release number in binary-coded decimal.
Definition: libusb.h:568
libusb_device_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:536
libusb_endpoint_descriptor
A structure representing the standard USB endpoint descriptor.
Definition: libusb.h:588
libusb_endpoint_descriptor::extra_length
int extra_length
Length of the extra descriptors, in bytes.
Definition: libusb.h:628
libusb_endpoint_descriptor::bEndpointAddress
uint8_t bEndpointAddress
The address of the endpoint described by this descriptor.
Definition: libusb.h:600
libusb_endpoint_descriptor::extra
const unsigned char * extra
Extra descriptors.
Definition: libusb.h:625
libusb_endpoint_descriptor::bInterval
uint8_t bInterval
Interval for polling endpoint for data transfers.
Definition: libusb.h:614
libusb_endpoint_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:595
libusb_endpoint_descriptor::bRefresh
uint8_t bRefresh
For audio devices only: the rate at which synchronization feedback is provided.
Definition: libusb.h:618
libusb_endpoint_descriptor::bmAttributes
uint8_t bmAttributes
Attributes which apply to the endpoint when it is configured using the bConfigurationValue.
Definition: libusb.h:608
libusb_endpoint_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:590
libusb_endpoint_descriptor::bSynchAddress
uint8_t bSynchAddress
For audio devices only: the address if the synch endpoint.
Definition: libusb.h:621
libusb_endpoint_descriptor::wMaxPacketSize
uint16_t wMaxPacketSize
Maximum packet size this endpoint is capable of sending/receiving.
Definition: libusb.h:611
libusb_interface_descriptor
A structure representing the standard USB interface descriptor.
Definition: libusb.h:636
libusb_interface_descriptor::bInterfaceSubClass
uint8_t bInterfaceSubClass
USB-IF subclass code for this interface, qualified by the bInterfaceClass value.
Definition: libusb.h:660
libusb_interface_descriptor::iInterface
uint8_t iInterface
Index of string descriptor describing this interface.
Definition: libusb.h:667
libusb_interface_descriptor::bInterfaceClass
uint8_t bInterfaceClass
USB-IF class code for this interface.
Definition: libusb.h:656
libusb_interface_descriptor::bAlternateSetting
uint8_t bAlternateSetting
Value used to select this alternate setting for this interface.
Definition: libusb.h:649
libusb_interface_descriptor::endpoint
const struct libusb_endpoint_descriptor * endpoint
Array of endpoint descriptors.
Definition: libusb.h:671
libusb_interface_descriptor::bNumEndpoints
uint8_t bNumEndpoints
Number of endpoints used by this interface (excluding the control endpoint).
Definition: libusb.h:653
libusb_interface_descriptor::bInterfaceProtocol
uint8_t bInterfaceProtocol
USB-IF protocol code for this interface, qualified by the bInterfaceClass and bInterfaceSubClass valu...
Definition: libusb.h:664
libusb_interface_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:638
libusb_interface_descriptor::bInterfaceNumber
uint8_t bInterfaceNumber
Number of this interface.
Definition: libusb.h:646
libusb_interface_descriptor::extra
const unsigned char * extra
Extra descriptors.
Definition: libusb.h:675
libusb_interface_descriptor::extra_length
int extra_length
Length of the extra descriptors, in bytes.
Definition: libusb.h:678
libusb_interface_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:643
libusb_interface
A collection of alternate settings for a particular USB interface.
Definition: libusb.h:684
libusb_interface::altsetting
const struct libusb_interface_descriptor * altsetting
Array of interface descriptors.
Definition: libusb.h:687
libusb_interface::num_altsetting
int num_altsetting
The number of alternate settings that belong to this interface.
Definition: libusb.h:691
libusb_iso_packet_descriptor
Isochronous packet descriptor.
Definition: libusb.h:1199
libusb_iso_packet_descriptor::actual_length
unsigned int actual_length
Amount of data that was actually transferred.
Definition: libusb.h:1204
libusb_iso_packet_descriptor::length
unsigned int length
Length of data to request in this packet.
Definition: libusb.h:1201
libusb_iso_packet_descriptor::status
enum libusb_transfer_status status
Status code for this packet.
Definition: libusb.h:1207
libusb_pollfd
File descriptor for polling.
Definition: libusb.h:1892
libusb_pollfd::events
short events
Event flags to poll for from <poll.h>.
Definition: libusb.h:1900
libusb_pollfd::fd
int fd
Numeric file descriptor.
Definition: libusb.h:1894
libusb_ss_endpoint_companion_descriptor
A structure representing the superspeed endpoint companion descriptor.
Definition: libusb.h:747
libusb_ss_endpoint_companion_descriptor::wBytesPerInterval
uint16_t wBytesPerInterval
The total number of bytes this EP will transfer every service interval.
Definition: libusb.h:768
libusb_ss_endpoint_companion_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:749
libusb_ss_endpoint_companion_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:754
libusb_ss_endpoint_companion_descriptor::bMaxBurst
uint8_t bMaxBurst
The maximum number of packets the endpoint can send or receive as part of a burst.
Definition: libusb.h:758
libusb_ss_endpoint_companion_descriptor::bmAttributes
uint8_t bmAttributes
In bulk EP: bits 4:0 represents the maximum number of streams the EP supports.
Definition: libusb.h:764
libusb_ss_usb_device_capability_descriptor
A structure representing the SuperSpeed USB Device Capability descriptor This descriptor is documente...
Definition: libusb.h:848
libusb_ss_usb_device_capability_descriptor::bDevCapabilityType
uint8_t bDevCapabilityType
Capability type.
Definition: libusb.h:860
libusb_ss_usb_device_capability_descriptor::wSpeedSupported
uint16_t wSpeedSupported
Bitmap encoding of the speed supported by this device when operating in SuperSpeed mode.
Definition: libusb.h:870
libusb_ss_usb_device_capability_descriptor::bFunctionalitySupport
uint8_t bFunctionalitySupport
The lowest speed at which all the functionality supported by the device is available to the user.
Definition: libusb.h:876
libusb_ss_usb_device_capability_descriptor::bU2DevExitLat
uint16_t bU2DevExitLat
U2 Device Exit Latency.
Definition: libusb.h:882
libusb_ss_usb_device_capability_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:850
libusb_ss_usb_device_capability_descriptor::bmAttributes
uint8_t bmAttributes
Bitmap encoding of supported device level features.
Definition: libusb.h:866
libusb_ss_usb_device_capability_descriptor::bU1DevExitLat
uint8_t bU1DevExitLat
U1 Device Exit Latency.
Definition: libusb.h:879
libusb_ss_usb_device_capability_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:855
libusb_transfer
The generic USB transfer structure.
Definition: libusb.h:1229
libusb_transfer::endpoint
unsigned char endpoint
Address of the endpoint where this transfer will be sent.
Definition: libusb.h:1237
libusb_transfer::iso_packet_desc
struct libusb_iso_packet_descriptor iso_packet_desc[ZERO_SIZED_ARRAY]
Isochronous packet descriptors, for isochronous transfers only.
Definition: libusb.h:1287
libusb_transfer::status
enum libusb_transfer_status status
The status of the transfer.
Definition: libusb.h:1253
libusb_transfer::length
int length
Length of the data buffer.
Definition: libusb.h:1256
libusb_transfer::callback
libusb_transfer_cb_fn callback
Callback function.
Definition: libusb.h:1265
libusb_transfer::type
unsigned char type
Type of the transfer from libusb_transfer_type.
Definition: libusb.h:1240
libusb_transfer::actual_length
int actual_length
Actual length of data that was transferred.
Definition: libusb.h:1261
libusb_transfer::buffer
unsigned char * buffer
Data buffer.
Definition: libusb.h:1280
libusb_transfer::num_iso_packets
int num_iso_packets
Number of isochronous packets.
Definition: libusb.h:1284
libusb_transfer::timeout
unsigned int timeout
Timeout for this transfer in milliseconds.
Definition: libusb.h:1244
libusb_transfer::user_data
void * user_data
User context data.
Definition: libusb.h:1277
libusb_transfer::dev_handle
libusb_device_handle * dev_handle
Handle of the device that this transfer will be submitted to.
Definition: libusb.h:1231
libusb_transfer::flags
uint8_t flags
A bitwise OR combination of libusb_transfer_flags.
Definition: libusb.h:1234
libusb_usb_2_0_extension_descriptor
A structure representing the USB 2.0 Extension descriptor This descriptor is documented in section 9....
Definition: libusb.h:822
libusb_usb_2_0_extension_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:824
libusb_usb_2_0_extension_descriptor::bDevCapabilityType
uint8_t bDevCapabilityType
Capability type.
Definition: libusb.h:834
libusb_usb_2_0_extension_descriptor::bmAttributes
uint32_t bmAttributes
Bitmap encoding of supported device level features.
Definition: libusb.h:840
libusb_usb_2_0_extension_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:829
libusb_version
Structure providing the version of the libusb runtime.
Definition: libusb.h:956
libusb_version::micro
const uint16_t micro
Library micro version.
Definition: libusb.h:964
libusb_version::major
const uint16_t major
Library major version.
Definition: libusb.h:958
libusb_version::rc
const char * rc
Library release candidate suffix string, e.g.
Definition: libusb.h:970
libusb_version::minor
const uint16_t minor
Library minor version.
Definition: libusb.h:961
libusb_version::describe
const char * describe
For ABI compatibility only.
Definition: libusb.h:973
libusb_version::nano
const uint16_t nano
Library nano version.
Definition: libusb.h:967