| libusb 1.0.24 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/* on MS environments, the inline keyword is available in C++ only */
30#if !defined(__cplusplus)
31#define inline __inline
32#endif
33/* ssize_t is also not available */
34#include <basetsd.h>
35 typedef SSIZE_T ssize_t;
36#endif /* _MSC_VER */
37
38#include <limits.h>
39#include <stdint.h>
40#include <sys/types.h>
41#if !defined(_MSC_VER)
42#include <sys/time.h>
43#endif
44#include <time.h>
45
46#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
47#define ZERO_SIZED_ARRAY /* [] - valid C99 code */
48#else
49#define ZERO_SIZED_ARRAY 0 /* [0] - non-standard, but usually working code */
50#endif /* __STDC_VERSION__ */
51
52/* 'interface' might be defined as a macro on Windows, so we need to
53 * undefine it so as not to break the current libusb API, because
54 * libusb_config_descriptor has an 'interface' member
55 * As this can be problematic if you include windows.h after libusb.h
56 * in your sources, we force windows.h to be included first. */
57#if defined(_WIN32) || defined(__CYGWIN__)
58#include <windows.h>
59#if defined(interface)
60#undef interface
61#endif
62#if !defined(__CYGWIN__)
63#include <winsock.h>
64#endif
65#endif /* _WIN32 || __CYGWIN__ */
66
67#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
68#define LIBUSB_DEPRECATED_FOR(f) __attribute__ ((deprecated ("Use " #f " instead")))
69#elif defined(__GNUC__) && (__GNUC__ >= 3)
70#define LIBUSB_DEPRECATED_FOR(f) __attribute__ ((deprecated))
71#else
72#define LIBUSB_DEPRECATED_FOR(f)
73#endif /* __GNUC__ */
74
75#if defined(__GNUC__)
76#define LIBUSB_PACKED __attribute__ ((packed))
77#else
78#define LIBUSB_PACKED
79#endif /* __GNUC__ */
80
106/* LIBUSB_CALL must be defined on both definition and declaration of libusb
107 * functions. You'd think that declaration would be enough, but cygwin will
108 * complain about conflicting types unless both are marked this way.
109 * The placement of this macro is important too; it must appear after the
110 * return type, before the function name. See internal documentation for
111 * API_EXPORTED.
112 */
113#if defined(_WIN32) || defined(__CYGWIN__)
114#define LIBUSB_CALL WINAPI
115#else
116#define LIBUSB_CALL
117#endif /* _WIN32 || __CYGWIN__ */
118
139#define LIBUSB_API_VERSION 0x01000108
140
141/* The following is kept for compatibility, but will be deprecated in the future */
142#define LIBUSBX_API_VERSION LIBUSB_API_VERSION
143
144#if defined(__cplusplus)
145 extern "C" {
146#endif
147
156 static inline uint16_t libusb_cpu_to_le16(const uint16_t x)
157{
158 union {
159 uint8_t b8[2];
160 uint16_t b16;
161 } _tmp;
162 _tmp.b8[1] = (uint8_t) (x >> 8);
163 _tmp.b8[0] = (uint8_t) (x & 0xff);
164 return _tmp.b16;
165}
166
175#define libusb_le16_to_cpu libusb_cpu_to_le16
176
177/* standard USB stuff */
178
181 enum libusb_class_code {
186 LIBUSB_CLASS_PER_INTERFACE = 0x00,
187
189 LIBUSB_CLASS_AUDIO = 0x01,
190
192 LIBUSB_CLASS_COMM = 0x02,
193
195 LIBUSB_CLASS_HID = 0x03,
196
198 LIBUSB_CLASS_PHYSICAL = 0x05,
199
201 LIBUSB_CLASS_IMAGE = 0x06,
202 LIBUSB_CLASS_PTP = 0x06, /* legacy name from libusb-0.1 usb.h */
203
205 LIBUSB_CLASS_PRINTER = 0x07,
206
208 LIBUSB_CLASS_MASS_STORAGE = 0x08,
209
211 LIBUSB_CLASS_HUB = 0x09,
212
214 LIBUSB_CLASS_DATA = 0x0a,
215
217 LIBUSB_CLASS_SMART_CARD = 0x0b,
218
220 LIBUSB_CLASS_CONTENT_SECURITY = 0x0d,
221
223 LIBUSB_CLASS_VIDEO = 0x0e,
224
226 LIBUSB_CLASS_PERSONAL_HEALTHCARE = 0x0f,
227
229 LIBUSB_CLASS_DIAGNOSTIC_DEVICE = 0xdc,
230
232 LIBUSB_CLASS_WIRELESS = 0xe0,
233
235 LIBUSB_CLASS_MISCELLANEOUS = 0xef,
236
238 LIBUSB_CLASS_APPLICATION = 0xfe,
239
241 LIBUSB_CLASS_VENDOR_SPEC = 0xff
242};
243
246 enum libusb_descriptor_type {
248 LIBUSB_DT_DEVICE = 0x01,
249
251 LIBUSB_DT_CONFIG = 0x02,
252
254 LIBUSB_DT_STRING = 0x03,
255
257 LIBUSB_DT_INTERFACE = 0x04,
258
260 LIBUSB_DT_ENDPOINT = 0x05,
261
263 LIBUSB_DT_BOS = 0x0f,
264
266 LIBUSB_DT_DEVICE_CAPABILITY = 0x10,
267
269 LIBUSB_DT_HID = 0x21,
270
272 LIBUSB_DT_REPORT = 0x22,
273
275 LIBUSB_DT_PHYSICAL = 0x23,
276
278 LIBUSB_DT_HUB = 0x29,
279
281 LIBUSB_DT_SUPERSPEED_HUB = 0x2a,
282
284 LIBUSB_DT_SS_ENDPOINT_COMPANION = 0x30
285};
286
287/* Descriptor sizes per descriptor type */
288#define LIBUSB_DT_DEVICE_SIZE 18
289#define LIBUSB_DT_CONFIG_SIZE 9
290#define LIBUSB_DT_INTERFACE_SIZE 9
291#define LIBUSB_DT_ENDPOINT_SIZE 7
292#define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
293#define LIBUSB_DT_HUB_NONVAR_SIZE 7
294#define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6
295#define LIBUSB_DT_BOS_SIZE 5
296#define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3
297
298/* BOS descriptor sizes */
299#define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7
300#define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10
301#define LIBUSB_BT_CONTAINER_ID_SIZE 20
302
303/* We unwrap the BOS => define its max size */
304#define LIBUSB_DT_BOS_MAX_SIZE \
305 (LIBUSB_DT_BOS_SIZE + \
306 LIBUSB_BT_USB_2_0_EXTENSION_SIZE + \
307 LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE + \
308 LIBUSB_BT_CONTAINER_ID_SIZE)
309
310#define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */
311#define LIBUSB_ENDPOINT_DIR_MASK 0x80
312
317 enum libusb_endpoint_direction {
319 LIBUSB_ENDPOINT_OUT = 0x00,
320
322 LIBUSB_ENDPOINT_IN = 0x80
323};
324
325#define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */
326
331 enum libusb_endpoint_transfer_type {
333 LIBUSB_ENDPOINT_TRANSFER_TYPE_CONTROL = 0x0,
334
336 LIBUSB_ENDPOINT_TRANSFER_TYPE_ISOCHRONOUS = 0x1,
337
339 LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK = 0x2,
340
342 LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT = 0x3
343};
344
347 enum libusb_standard_request {
349 LIBUSB_REQUEST_GET_STATUS = 0x00,
350
352 LIBUSB_REQUEST_CLEAR_FEATURE = 0x01,
353
354 /* 0x02 is reserved */
355
357 LIBUSB_REQUEST_SET_FEATURE = 0x03,
358
359 /* 0x04 is reserved */
360
362 LIBUSB_REQUEST_SET_ADDRESS = 0x05,
363
365 LIBUSB_REQUEST_GET_DESCRIPTOR = 0x06,
366
368 LIBUSB_REQUEST_SET_DESCRIPTOR = 0x07,
369
371 LIBUSB_REQUEST_GET_CONFIGURATION = 0x08,
372
374 LIBUSB_REQUEST_SET_CONFIGURATION = 0x09,
375
377 LIBUSB_REQUEST_GET_INTERFACE = 0x0a,
378
380 LIBUSB_REQUEST_SET_INTERFACE = 0x0b,
381
383 LIBUSB_REQUEST_SYNCH_FRAME = 0x0c,
384
386 LIBUSB_REQUEST_SET_SEL = 0x30,
387
390 LIBUSB_SET_ISOCH_DELAY = 0x31
391};
392
397 enum libusb_request_type {
399 LIBUSB_REQUEST_TYPE_STANDARD = (0x00 << 5),
400
402 LIBUSB_REQUEST_TYPE_CLASS = (0x01 << 5),
403
405 LIBUSB_REQUEST_TYPE_VENDOR = (0x02 << 5),
406
408 LIBUSB_REQUEST_TYPE_RESERVED = (0x03 << 5)
409};
410
415 enum libusb_request_recipient {
417 LIBUSB_RECIPIENT_DEVICE = 0x00,
418
420 LIBUSB_RECIPIENT_INTERFACE = 0x01,
421
423 LIBUSB_RECIPIENT_ENDPOINT = 0x02,
424
426 LIBUSB_RECIPIENT_OTHER = 0x03
427};
428
429#define LIBUSB_ISO_SYNC_TYPE_MASK 0x0c
430
436 enum libusb_iso_sync_type {
438 LIBUSB_ISO_SYNC_TYPE_NONE = 0x0,
439
441 LIBUSB_ISO_SYNC_TYPE_ASYNC = 0x1,
442
444 LIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 0x2,
445
447 LIBUSB_ISO_SYNC_TYPE_SYNC = 0x3
448};
449
450#define LIBUSB_ISO_USAGE_TYPE_MASK 0x30
451
457 enum libusb_iso_usage_type {
459 LIBUSB_ISO_USAGE_TYPE_DATA = 0x0,
460
462 LIBUSB_ISO_USAGE_TYPE_FEEDBACK = 0x1,
463
465 LIBUSB_ISO_USAGE_TYPE_IMPLICIT = 0x2
466};
467
472 enum libusb_supported_speed {
474 LIBUSB_LOW_SPEED_OPERATION = (1 << 0),
475
477 LIBUSB_FULL_SPEED_OPERATION = (1 << 1),
478
480 LIBUSB_HIGH_SPEED_OPERATION = (1 << 2),
481
483 LIBUSB_SUPER_SPEED_OPERATION = (1 << 3)
484};
485
491 enum libusb_usb_2_0_extension_attributes {
493 LIBUSB_BM_LPM_SUPPORT = (1 << 1)
494};
495
501 enum libusb_ss_usb_device_capability_attributes {
503 LIBUSB_BM_LTM_SUPPORT = (1 << 1)
504};
505
509 enum libusb_bos_type {
511 LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 0x01,
512
514 LIBUSB_BT_USB_2_0_EXTENSION = 0x02,
515
517 LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 0x03,
518
520 LIBUSB_BT_CONTAINER_ID = 0x04
521};
522
528 struct libusb_device_descriptor {
530 uint8_t bLength;
531
535 uint8_t bDescriptorType;
536
539 uint16_t bcdUSB;
540
542 uint8_t bDeviceClass;
543
546 uint8_t bDeviceSubClass;
547
550 uint8_t bDeviceProtocol;
551
553 uint8_t bMaxPacketSize0;
554
556 uint16_t idVendor;
557
559 uint16_t idProduct;
560
562 uint16_t bcdDevice;
563
565 uint8_t iManufacturer;
566
568 uint8_t iProduct;
569
571 uint8_t iSerialNumber;
572
574 uint8_t bNumConfigurations;
575};
576
582 struct libusb_endpoint_descriptor {
584 uint8_t bLength;
585
589 uint8_t bDescriptorType;
590
594 uint8_t bEndpointAddress;
595
602 uint8_t bmAttributes;
603
605 uint16_t wMaxPacketSize;
606
608 uint8_t bInterval;
609
612 uint8_t bRefresh;
613
615 uint8_t bSynchAddress;
616
619 const unsigned char *extra;
620
622 int extra_length;
623};
624
630 struct libusb_interface_descriptor {
632 uint8_t bLength;
633
637 uint8_t bDescriptorType;
638
640 uint8_t bInterfaceNumber;
641
643 uint8_t bAlternateSetting;
644
647 uint8_t bNumEndpoints;
648
650 uint8_t bInterfaceClass;
651
654 uint8_t bInterfaceSubClass;
655
658 uint8_t bInterfaceProtocol;
659
661 uint8_t iInterface;
662
665 const struct libusb_endpoint_descriptor *endpoint;
666
669 const unsigned char *extra;
670
672 int extra_length;
673};
674
678 struct libusb_interface {
681 const struct libusb_interface_descriptor *altsetting;
682
685 int num_altsetting;
686};
687
693 struct libusb_config_descriptor {
695 uint8_t bLength;
696
700 uint8_t bDescriptorType;
701
703 uint16_t wTotalLength;
704
706 uint8_t bNumInterfaces;
707
709 uint8_t bConfigurationValue;
710
712 uint8_t iConfiguration;
713
715 uint8_t bmAttributes;
716
721 uint8_t MaxPower;
722
725 const struct libusb_interface *interface;
726
729 const unsigned char *extra;
730
732 int extra_length;
733};
734
741 struct libusb_ss_endpoint_companion_descriptor {
743 uint8_t bLength;
744
748 uint8_t bDescriptorType;
749
752 uint8_t bMaxBurst;
753
758 uint8_t bmAttributes;
759
762 uint16_t wBytesPerInterval;
763};
764
770 struct libusb_bos_dev_capability_descriptor {
772 uint8_t bLength;
773
777 uint8_t bDescriptorType;
778
780 uint8_t bDevCapabilityType;
781
783 uint8_t dev_capability_data[ZERO_SIZED_ARRAY];
784};
785
791 struct libusb_bos_descriptor {
793 uint8_t bLength;
794
798 uint8_t bDescriptorType;
799
801 uint16_t wTotalLength;
802
805 uint8_t bNumDeviceCaps;
806
808 struct libusb_bos_dev_capability_descriptor *dev_capability[ZERO_SIZED_ARRAY];
809};
810
816 struct libusb_usb_2_0_extension_descriptor {
818 uint8_t bLength;
819
823 uint8_t bDescriptorType;
824
828 uint8_t bDevCapabilityType;
829
834 uint32_t bmAttributes;
835};
836
842 struct libusb_ss_usb_device_capability_descriptor {
844 uint8_t bLength;
845
849 uint8_t bDescriptorType;
850
854 uint8_t bDevCapabilityType;
855
860 uint8_t bmAttributes;
861
864 uint16_t wSpeedSupported;
865
870 uint8_t bFunctionalitySupport;
871
873 uint8_t bU1DevExitLat;
874
876 uint16_t bU2DevExitLat;
877};
878
884 struct libusb_container_id_descriptor {
886 uint8_t bLength;
887
891 uint8_t bDescriptorType;
892
896 uint8_t bDevCapabilityType;
897
899 uint8_t bReserved;
900
902 uint8_t ContainerID[16];
903};
904
907#if defined(_MSC_VER)
908#pragma pack(push, 1)
909#endif
910 struct libusb_control_setup {
916 uint8_t bmRequestType;
917
923 uint8_t bRequest;
924
926 uint16_t wValue;
927
930 uint16_t wIndex;
931
933 uint16_t wLength;
934} LIBUSB_PACKED;
935#if defined(_MSC_VER)
936#pragma pack(pop)
937#endif
938
939#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
940
941/* libusb */
942
943 struct libusb_context;
944 struct libusb_device;
945 struct libusb_device_handle;
946
950 struct libusb_version {
952 const uint16_t major;
953
955 const uint16_t minor;
956
958 const uint16_t micro;
959
961 const uint16_t nano;
962
964 const char *rc;
965
967 const char *describe;
968};
969
987 typedef struct libusb_context libusb_context;
988
1004 typedef struct libusb_device libusb_device;
1005
1006
1015 typedef struct libusb_device_handle libusb_device_handle;
1016
1020 enum libusb_speed {
1022 LIBUSB_SPEED_UNKNOWN = 0,
1023
1025 LIBUSB_SPEED_LOW = 1,
1026
1028 LIBUSB_SPEED_FULL = 2,
1029
1031 LIBUSB_SPEED_HIGH = 3,
1032
1034 LIBUSB_SPEED_SUPER = 4,
1035
1037 LIBUSB_SPEED_SUPER_PLUS = 5
1038};
1039
1047 enum libusb_error {
1049 LIBUSB_SUCCESS = 0,
1050
1052 LIBUSB_ERROR_IO = -1,
1053
1055 LIBUSB_ERROR_INVALID_PARAM = -2,
1056
1058 LIBUSB_ERROR_ACCESS = -3,
1059
1061 LIBUSB_ERROR_NO_DEVICE = -4,
1062
1064 LIBUSB_ERROR_NOT_FOUND = -5,
1065
1067 LIBUSB_ERROR_BUSY = -6,
1068
1070 LIBUSB_ERROR_TIMEOUT = -7,
1071
1073 LIBUSB_ERROR_OVERFLOW = -8,
1074
1076 LIBUSB_ERROR_PIPE = -9,
1077
1079 LIBUSB_ERROR_INTERRUPTED = -10,
1080
1082 LIBUSB_ERROR_NO_MEM = -11,
1083
1085 LIBUSB_ERROR_NOT_SUPPORTED = -12,
1086
1087 /* NB: Remember to update LIBUSB_ERROR_COUNT below as well as the
1088 message strings in strerror.c when adding new error codes here. */
1089
1091 LIBUSB_ERROR_OTHER = -99
1092};
1093
1094/* Total number of error codes in enum libusb_error */
1095#define LIBUSB_ERROR_COUNT 14
1096
1099 enum libusb_transfer_type {
1101 LIBUSB_TRANSFER_TYPE_CONTROL = 0U,
1102
1104 LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1U,
1105
1107 LIBUSB_TRANSFER_TYPE_BULK = 2U,
1108
1110 LIBUSB_TRANSFER_TYPE_INTERRUPT = 3U,
1111
1113 LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4U
1114};
1115
1118 enum libusb_transfer_status {
1121 LIBUSB_TRANSFER_COMPLETED,
1122
1124 LIBUSB_TRANSFER_ERROR,
1125
1127 LIBUSB_TRANSFER_TIMED_OUT,
1128
1130 LIBUSB_TRANSFER_CANCELLED,
1131
1134 LIBUSB_TRANSFER_STALL,
1135
1137 LIBUSB_TRANSFER_NO_DEVICE,
1138
1140 LIBUSB_TRANSFER_OVERFLOW
1141
1142 /* NB! Remember to update libusb_error_name()
1143 when adding new status codes here. */
1144};
1145
1148 enum libusb_transfer_flags {
1150 LIBUSB_TRANSFER_SHORT_NOT_OK = (1U << 0),
1151
1156 LIBUSB_TRANSFER_FREE_BUFFER = (1U << 1),
1157
1162 LIBUSB_TRANSFER_FREE_TRANSFER = (1U << 2),
1163
1187 LIBUSB_TRANSFER_ADD_ZERO_PACKET = (1U << 3)
1188};
1189
1192 struct libusb_iso_packet_descriptor {
1194 unsigned int length;
1195
1197 unsigned int actual_length;
1198
1200 enum libusb_transfer_status status;
1201};
1202
1203 struct libusb_transfer;
1204
1214 typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transfer);
1215
1222 struct libusb_transfer {
1224 libusb_device_handle *dev_handle;
1225
1227 uint8_t flags;
1228
1230 unsigned char endpoint;
1231
1233 unsigned char type;
1234
1237 unsigned int timeout;
1238
1246 enum libusb_transfer_status status;
1247
1249 int length;
1250
1254 int actual_length;
1255
1258 libusb_transfer_cb_fn callback;
1259
1270 void *user_data;
1271
1273 unsigned char *buffer;
1274
1277 int num_iso_packets;
1278
1280 struct libusb_iso_packet_descriptor iso_packet_desc[ZERO_SIZED_ARRAY];
1281};
1282
1288 enum libusb_capability {
1290 LIBUSB_CAP_HAS_CAPABILITY = 0x0000U,
1291
1293 LIBUSB_CAP_HAS_HOTPLUG = 0x0001U,
1294
1299 LIBUSB_CAP_HAS_HID_ACCESS = 0x0100U,
1300
1303 LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101U
1304};
1305
1309 enum libusb_log_level {
1311 LIBUSB_LOG_LEVEL_NONE = 0,
1312
1314 LIBUSB_LOG_LEVEL_ERROR = 1,
1315
1317 LIBUSB_LOG_LEVEL_WARNING = 2,
1318
1320 LIBUSB_LOG_LEVEL_INFO = 3,
1321
1323 LIBUSB_LOG_LEVEL_DEBUG = 4
1324};
1325
1330 enum libusb_log_cb_mode {
1332 LIBUSB_LOG_CB_GLOBAL = (1 << 0),
1333
1335 LIBUSB_LOG_CB_CONTEXT = (1 << 1)
1336};
1337
1346 typedef void (LIBUSB_CALL *libusb_log_cb)(libusb_context *ctx,
1347 enum libusb_log_level level, const char *str);
1348
1349 int LIBUSB_CALL libusb_init(libusb_context **ctx);
1350 void LIBUSB_CALL libusb_exit(libusb_context *ctx);
1351LIBUSB_DEPRECATED_FOR(libusb_set_option)
1352 void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
1353 void LIBUSB_CALL libusb_set_log_cb(libusb_context *ctx, libusb_log_cb cb, int mode);
1354 const struct libusb_version * LIBUSB_CALL libusb_get_version(void);
1355 int LIBUSB_CALL libusb_has_capability(uint32_t capability);
1356 const char * LIBUSB_CALL libusb_error_name(int errcode);
1357 int LIBUSB_CALL libusb_setlocale(const char *locale);
1358 const char * LIBUSB_CALL libusb_strerror(int errcode);
1359
1360ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx,
1361 libusb_device ***list);
1362 void LIBUSB_CALL libusb_free_device_list(libusb_device **list,
1363 int unref_devices);
1364 libusb_device * LIBUSB_CALL libusb_ref_device(libusb_device *dev);
1365 void LIBUSB_CALL libusb_unref_device(libusb_device *dev);
1366
1367 int LIBUSB_CALL libusb_get_configuration(libusb_device_handle *dev,
1368 int *config);
1369 int LIBUSB_CALL libusb_get_device_descriptor(libusb_device *dev,
1370 struct libusb_device_descriptor *desc);
1371 int LIBUSB_CALL libusb_get_active_config_descriptor(libusb_device *dev,
1372 struct libusb_config_descriptor **config);
1373 int LIBUSB_CALL libusb_get_config_descriptor(libusb_device *dev,
1374 uint8_t config_index, struct libusb_config_descriptor **config);
1375 int LIBUSB_CALL libusb_get_config_descriptor_by_value(libusb_device *dev,
1376 uint8_t bConfigurationValue, struct libusb_config_descriptor **config);
1377 void LIBUSB_CALL libusb_free_config_descriptor(
1378 struct libusb_config_descriptor *config);
1379 int LIBUSB_CALL libusb_get_ss_endpoint_companion_descriptor(
1380 libusb_context *ctx,
1381 const struct libusb_endpoint_descriptor *endpoint,
1382 struct libusb_ss_endpoint_companion_descriptor **ep_comp);
1383 void LIBUSB_CALL libusb_free_ss_endpoint_companion_descriptor(
1384 struct libusb_ss_endpoint_companion_descriptor *ep_comp);
1385 int LIBUSB_CALL libusb_get_bos_descriptor(libusb_device_handle *dev_handle,
1386 struct libusb_bos_descriptor **bos);
1387 void LIBUSB_CALL libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos);
1388 int LIBUSB_CALL libusb_get_usb_2_0_extension_descriptor(
1389 libusb_context *ctx,
1390 struct libusb_bos_dev_capability_descriptor *dev_cap,
1391 struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension);
1392 void LIBUSB_CALL libusb_free_usb_2_0_extension_descriptor(
1393 struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension);
1394 int LIBUSB_CALL libusb_get_ss_usb_device_capability_descriptor(
1395 libusb_context *ctx,
1396 struct libusb_bos_dev_capability_descriptor *dev_cap,
1397 struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap);
1398 void LIBUSB_CALL libusb_free_ss_usb_device_capability_descriptor(
1399 struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap);
1400 int LIBUSB_CALL libusb_get_container_id_descriptor(libusb_context *ctx,
1401 struct libusb_bos_dev_capability_descriptor *dev_cap,
1402 struct libusb_container_id_descriptor **container_id);
1403 void LIBUSB_CALL libusb_free_container_id_descriptor(
1404 struct libusb_container_id_descriptor *container_id);
1405uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev);
1406uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev);
1407 int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t *port_numbers, int port_numbers_len);
1408LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers)
1409 int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *path, uint8_t path_length);
1410 libusb_device * LIBUSB_CALL libusb_get_parent(libusb_device *dev);
1411uint8_t LIBUSB_CALL libusb_get_device_address(libusb_device *dev);
1412 int LIBUSB_CALL libusb_get_device_speed(libusb_device *dev);
1413 int LIBUSB_CALL libusb_get_max_packet_size(libusb_device *dev,
1414 unsigned char endpoint);
1415 int LIBUSB_CALL libusb_get_max_iso_packet_size(libusb_device *dev,
1416 unsigned char endpoint);
1417
1418 int LIBUSB_CALL libusb_wrap_sys_device(libusb_context *ctx, intptr_t sys_dev, libusb_device_handle **dev_handle);
1419 int LIBUSB_CALL libusb_open(libusb_device *dev, libusb_device_handle **dev_handle);
1420 void LIBUSB_CALL libusb_close(libusb_device_handle *dev_handle);
1421 libusb_device * LIBUSB_CALL libusb_get_device(libusb_device_handle *dev_handle);
1422
1423 int LIBUSB_CALL libusb_set_configuration(libusb_device_handle *dev_handle,
1424 int configuration);
1425 int LIBUSB_CALL libusb_claim_interface(libusb_device_handle *dev_handle,
1426 int interface_number);
1427 int LIBUSB_CALL libusb_release_interface(libusb_device_handle *dev_handle,
1428 int interface_number);
1429
1430 libusb_device_handle * LIBUSB_CALL libusb_open_device_with_vid_pid(
1431 libusb_context *ctx, uint16_t vendor_id, uint16_t product_id);
1432
1433 int LIBUSB_CALL libusb_set_interface_alt_setting(libusb_device_handle *dev_handle,
1434 int interface_number, int alternate_setting);
1435 int LIBUSB_CALL libusb_clear_halt(libusb_device_handle *dev_handle,
1436 unsigned char endpoint);
1437 int LIBUSB_CALL libusb_reset_device(libusb_device_handle *dev_handle);
1438
1439 int LIBUSB_CALL libusb_alloc_streams(libusb_device_handle *dev_handle,
1440 uint32_t num_streams, unsigned char *endpoints, int num_endpoints);
1441 int LIBUSB_CALL libusb_free_streams(libusb_device_handle *dev_handle,
1442 unsigned char *endpoints, int num_endpoints);
1443
1444 unsigned char * LIBUSB_CALL libusb_dev_mem_alloc(libusb_device_handle *dev_handle,
1445 size_t length);
1446 int LIBUSB_CALL libusb_dev_mem_free(libusb_device_handle *dev_handle,
1447 unsigned char *buffer, size_t length);
1448
1449 int LIBUSB_CALL libusb_kernel_driver_active(libusb_device_handle *dev_handle,
1450 int interface_number);
1451 int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev_handle,
1452 int interface_number);
1453 int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev_handle,
1454 int interface_number);
1455 int LIBUSB_CALL libusb_set_auto_detach_kernel_driver(
1456 libusb_device_handle *dev_handle, int enable);
1457
1458/* async I/O */
1459
1472 static inline unsigned char *libusb_control_transfer_get_data(
1473 struct libusb_transfer *transfer)
1474{
1475 return transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE;
1476}
1477
1490 static inline struct libusb_control_setup *libusb_control_transfer_get_setup(
1491 struct libusb_transfer *transfer)
1492{
1493 return (struct libusb_control_setup *)(void *)transfer->buffer;
1494}
1495
1519 static inline void libusb_fill_control_setup(unsigned char *buffer,
1520 uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
1521 uint16_t wLength)
1522{
1523 struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)buffer;
1524 setup->bmRequestType = bmRequestType;
1525 setup->bRequest = bRequest;
1526 setup->wValue = libusb_cpu_to_le16(wValue);
1527 setup->wIndex = libusb_cpu_to_le16(wIndex);
1528 setup->wLength = libusb_cpu_to_le16(wLength);
1529}
1530
1531 struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(int iso_packets);
1532 int LIBUSB_CALL libusb_submit_transfer(struct libusb_transfer *transfer);
1533 int LIBUSB_CALL libusb_cancel_transfer(struct libusb_transfer *transfer);
1534 void LIBUSB_CALL libusb_free_transfer(struct libusb_transfer *transfer);
1535 void LIBUSB_CALL libusb_transfer_set_stream_id(
1536 struct libusb_transfer *transfer, uint32_t stream_id);
1537uint32_t LIBUSB_CALL libusb_transfer_get_stream_id(
1538 struct libusb_transfer *transfer);
1539
1568 static inline void libusb_fill_control_transfer(
1569 struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
1570 unsigned char *buffer, libusb_transfer_cb_fn callback, void *user_data,
1571 unsigned int timeout)
1572{
1573 struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)buffer;
1574 transfer->dev_handle = dev_handle;
1575 transfer->endpoint = 0;
1576 transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL;
1577 transfer->timeout = timeout;
1578 transfer->buffer = buffer;
1579 if (setup)
1580 transfer->length = (int) (LIBUSB_CONTROL_SETUP_SIZE
1581 + libusb_le16_to_cpu(setup->wLength));
1582 transfer->user_data = user_data;
1583 transfer->callback = callback;
1584}
1585
1599 static inline void libusb_fill_bulk_transfer(struct libusb_transfer *transfer,
1600 libusb_device_handle *dev_handle, unsigned char endpoint,
1601 unsigned char *buffer, int length, libusb_transfer_cb_fn callback,
1602 void *user_data, unsigned int timeout)
1603{
1604 transfer->dev_handle = dev_handle;
1605 transfer->endpoint = endpoint;
1606 transfer->type = LIBUSB_TRANSFER_TYPE_BULK;
1607 transfer->timeout = timeout;
1608 transfer->buffer = buffer;
1609 transfer->length = length;
1610 transfer->user_data = user_data;
1611 transfer->callback = callback;
1612}
1613
1630 static inline void libusb_fill_bulk_stream_transfer(
1631 struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
1632 unsigned char endpoint, uint32_t stream_id,
1633 unsigned char *buffer, int length, libusb_transfer_cb_fn callback,
1634 void *user_data, unsigned int timeout)
1635{
1636 libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer,
1637 length, callback, user_data, timeout);
1638 transfer->type = LIBUSB_TRANSFER_TYPE_BULK_STREAM;
1639 libusb_transfer_set_stream_id(transfer, stream_id);
1640}
1641
1655 static inline void libusb_fill_interrupt_transfer(
1656 struct libusb_transfer *transfer, libusb_device_handle *dev_handle,
1657 unsigned char endpoint, unsigned char *buffer, int length,
1658 libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
1659{
1660 transfer->dev_handle = dev_handle;
1661 transfer->endpoint = endpoint;
1662 transfer->type = LIBUSB_TRANSFER_TYPE_INTERRUPT;
1663 transfer->timeout = timeout;
1664 transfer->buffer = buffer;
1665 transfer->length = length;
1666 transfer->user_data = user_data;
1667 transfer->callback = callback;
1668}
1669
1684 static inline void libusb_fill_iso_transfer(struct libusb_transfer *transfer,
1685 libusb_device_handle *dev_handle, unsigned char endpoint,
1686 unsigned char *buffer, int length, int num_iso_packets,
1687 libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
1688{
1689 transfer->dev_handle = dev_handle;
1690 transfer->endpoint = endpoint;
1691 transfer->type = LIBUSB_TRANSFER_TYPE_ISOCHRONOUS;
1692 transfer->timeout = timeout;
1693 transfer->buffer = buffer;
1694 transfer->length = length;
1695 transfer->num_iso_packets = num_iso_packets;
1696 transfer->user_data = user_data;
1697 transfer->callback = callback;
1698}
1699
1708 static inline void libusb_set_iso_packet_lengths(
1709 struct libusb_transfer *transfer, unsigned int length)
1710{
1711 int i;
1712
1713 for (i = 0; i < transfer->num_iso_packets; i++)
1714 transfer->iso_packet_desc[i].length = length;
1715}
1716
1733 static inline unsigned char *libusb_get_iso_packet_buffer(
1734 struct libusb_transfer *transfer, unsigned int packet)
1735{
1736 int i;
1737 size_t offset = 0;
1738 int _packet;
1739
1740 /* oops..slight bug in the API. packet is an unsigned int, but we use
1741 * signed integers almost everywhere else. range-check and convert to
1742 * signed to avoid compiler warnings. FIXME for libusb-2. */
1743 if (packet > INT_MAX)
1744 return NULL;
1745 _packet = (int) packet;
1746
1747 if (_packet >= transfer->num_iso_packets)
1748 return NULL;
1749
1750 for (i = 0; i < _packet; i++)
1751 offset += transfer->iso_packet_desc[i].length;
1752
1753 return transfer->buffer + offset;
1754}
1755
1775 static inline unsigned char *libusb_get_iso_packet_buffer_simple(
1776 struct libusb_transfer *transfer, unsigned int packet)
1777{
1778 int _packet;
1779
1780 /* oops..slight bug in the API. packet is an unsigned int, but we use
1781 * signed integers almost everywhere else. range-check and convert to
1782 * signed to avoid compiler warnings. FIXME for libusb-2. */
1783 if (packet > INT_MAX)
1784 return NULL;
1785 _packet = (int) packet;
1786
1787 if (_packet >= transfer->num_iso_packets)
1788 return NULL;
1789
1790 return transfer->buffer + ((int) transfer->iso_packet_desc[0].length * _packet);
1791}
1792
1793/* sync I/O */
1794
1795 int LIBUSB_CALL libusb_control_transfer(libusb_device_handle *dev_handle,
1796 uint8_t request_type, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
1797 unsigned char *data, uint16_t wLength, unsigned int timeout);
1798
1799 int LIBUSB_CALL libusb_bulk_transfer(libusb_device_handle *dev_handle,
1800 unsigned char endpoint, unsigned char *data, int length,
1801 int *actual_length, unsigned int timeout);
1802
1803 int LIBUSB_CALL libusb_interrupt_transfer(libusb_device_handle *dev_handle,
1804 unsigned char endpoint, unsigned char *data, int length,
1805 int *actual_length, unsigned int timeout);
1806
1819 static inline int libusb_get_descriptor(libusb_device_handle *dev_handle,
1820 uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length)
1821{
1822 return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN,
1823 LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t) ((desc_type << 8) | desc_index),
1824 0, data, (uint16_t) length, 1000);
1825}
1826
1841 static inline int libusb_get_string_descriptor(libusb_device_handle *dev_handle,
1842 uint8_t desc_index, uint16_t langid, unsigned char *data, int length)
1843{
1844 return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN,
1845 LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t)((LIBUSB_DT_STRING << 8) | desc_index),
1846 langid, data, (uint16_t) length, 1000);
1847}
1848
1849 int LIBUSB_CALL libusb_get_string_descriptor_ascii(libusb_device_handle *dev_handle,
1850 uint8_t desc_index, unsigned char *data, int length);
1851
1852/* polling and timeouts */
1853
1854 int LIBUSB_CALL libusb_try_lock_events(libusb_context *ctx);
1855 void LIBUSB_CALL libusb_lock_events(libusb_context *ctx);
1856 void LIBUSB_CALL libusb_unlock_events(libusb_context *ctx);
1857 int LIBUSB_CALL libusb_event_handling_ok(libusb_context *ctx);
1858 int LIBUSB_CALL libusb_event_handler_active(libusb_context *ctx);
1859 void LIBUSB_CALL libusb_interrupt_event_handler(libusb_context *ctx);
1860 void LIBUSB_CALL libusb_lock_event_waiters(libusb_context *ctx);
1861 void LIBUSB_CALL libusb_unlock_event_waiters(libusb_context *ctx);
1862 int LIBUSB_CALL libusb_wait_for_event(libusb_context *ctx, struct timeval *tv);
1863
1864 int LIBUSB_CALL libusb_handle_events_timeout(libusb_context *ctx,
1865 struct timeval *tv);
1866 int LIBUSB_CALL libusb_handle_events_timeout_completed(libusb_context *ctx,
1867 struct timeval *tv, int *completed);
1868 int LIBUSB_CALL libusb_handle_events(libusb_context *ctx);
1869 int LIBUSB_CALL libusb_handle_events_completed(libusb_context *ctx, int *completed);
1870 int LIBUSB_CALL libusb_handle_events_locked(libusb_context *ctx,
1871 struct timeval *tv);
1872 int LIBUSB_CALL libusb_pollfds_handle_timeouts(libusb_context *ctx);
1873 int LIBUSB_CALL libusb_get_next_timeout(libusb_context *ctx,
1874 struct timeval *tv);
1875
1879 struct libusb_pollfd {
1881 int fd;
1882
1887 short events;
1888};
1889
1900 typedef void (LIBUSB_CALL *libusb_pollfd_added_cb)(int fd, short events,
1901 void *user_data);
1902
1912 typedef void (LIBUSB_CALL *libusb_pollfd_removed_cb)(int fd, void *user_data);
1913
1914 const struct libusb_pollfd ** LIBUSB_CALL libusb_get_pollfds(
1915 libusb_context *ctx);
1916 void LIBUSB_CALL libusb_free_pollfds(const struct libusb_pollfd **pollfds);
1917 void LIBUSB_CALL libusb_set_pollfd_notifiers(libusb_context *ctx,
1918 libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb,
1919 void *user_data);
1920
1933 typedef int libusb_hotplug_callback_handle;
1934
1940 typedef enum {
1942 LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = (1 << 0),
1943
1947 LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = (1 << 1)
1948} libusb_hotplug_event;
1949
1955 typedef enum {
1957 LIBUSB_HOTPLUG_ENUMERATE = (1 << 0)
1958} libusb_hotplug_flag;
1959
1962#define LIBUSB_HOTPLUG_NO_FLAGS 0
1963
1966#define LIBUSB_HOTPLUG_MATCH_ANY -1
1967
1990 typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx,
1991 libusb_device *device, libusb_hotplug_event event, void *user_data);
1992
2028 int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx,
2029 int events, int flags,
2030 int vendor_id, int product_id, int dev_class,
2031 libusb_hotplug_callback_fn cb_fn, void *user_data,
2032 libusb_hotplug_callback_handle *callback_handle);
2033
2045 void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx,
2046 libusb_hotplug_callback_handle callback_handle);
2047
2056 void * LIBUSB_CALL libusb_hotplug_get_user_data(libusb_context *ctx,
2057 libusb_hotplug_callback_handle callback_handle);
2058
2062 enum libusb_option {
2084 LIBUSB_OPTION_LOG_LEVEL = 0,
2085
2093 LIBUSB_OPTION_USE_USBDK = 1,
2094
2104 LIBUSB_OPTION_WEAK_AUTHORITY = 2
2105};
2106
2107 int LIBUSB_CALL libusb_set_option(libusb_context *ctx, enum libusb_option option, ...);
2108
2109#if defined(__cplusplus)
2110}
2111#endif
2112
2113#endif
libusb_transfer_cb_fn
void(* libusb_transfer_cb_fn)(struct libusb_transfer *transfer)
Asynchronous transfer callback function type.
Definition: libusb.h:1214
libusb_transfer_flags
libusb_transfer_flags
libusb_transfer.flags values
Definition: libusb.h:1148
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:1933
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:1684
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:1568
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:1472
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:1775
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:1519
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:1642
libusb_cancel_transfer
int libusb_cancel_transfer(struct libusb_transfer *transfer)
Asynchronously cancel a previously submitted transfer.
Definition: io.c:1581
libusb_free_transfer
void libusb_free_transfer(struct libusb_transfer *transfer)
Free a transfer structure.
Definition: io.c:1334
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:1655
libusb_transfer_status
libusb_transfer_status
Transfer status codes.
Definition: libusb.h:1118
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:1286
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:1490
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:1890
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:1630
libusb_transfer_type
libusb_transfer_type
Transfer type.
Definition: libusb.h:1099
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:1708
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:1599
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:1953
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:1860
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:1733
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:1625
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:1187
LIBUSB_TRANSFER_FREE_TRANSFER
@ LIBUSB_TRANSFER_FREE_TRANSFER
Automatically call libusb_free_transfer() after callback returns.
Definition: libusb.h:1162
LIBUSB_TRANSFER_SHORT_NOT_OK
@ LIBUSB_TRANSFER_SHORT_NOT_OK
Report short frames as errors.
Definition: libusb.h:1150
LIBUSB_TRANSFER_FREE_BUFFER
@ LIBUSB_TRANSFER_FREE_BUFFER
Automatically free() transfer buffer during libusb_free_transfer().
Definition: libusb.h:1156
LIBUSB_TRANSFER_STALL
@ LIBUSB_TRANSFER_STALL
For bulk/interrupt endpoints: halt condition detected (endpoint stalled).
Definition: libusb.h:1134
LIBUSB_TRANSFER_COMPLETED
@ LIBUSB_TRANSFER_COMPLETED
Transfer completed without error.
Definition: libusb.h:1121
LIBUSB_TRANSFER_CANCELLED
@ LIBUSB_TRANSFER_CANCELLED
Transfer was cancelled.
Definition: libusb.h:1130
LIBUSB_TRANSFER_ERROR
@ LIBUSB_TRANSFER_ERROR
Transfer failed.
Definition: libusb.h:1124
LIBUSB_TRANSFER_OVERFLOW
@ LIBUSB_TRANSFER_OVERFLOW
Device sent more data than requested.
Definition: libusb.h:1140
LIBUSB_TRANSFER_NO_DEVICE
@ LIBUSB_TRANSFER_NO_DEVICE
Device was disconnected.
Definition: libusb.h:1137
LIBUSB_TRANSFER_TIMED_OUT
@ LIBUSB_TRANSFER_TIMED_OUT
Transfer timed out.
Definition: libusb.h:1127
LIBUSB_TRANSFER_TYPE_BULK_STREAM
@ LIBUSB_TRANSFER_TYPE_BULK_STREAM
Bulk stream transfer.
Definition: libusb.h:1113
LIBUSB_TRANSFER_TYPE_ISOCHRONOUS
@ LIBUSB_TRANSFER_TYPE_ISOCHRONOUS
Isochronous transfer.
Definition: libusb.h:1104
LIBUSB_TRANSFER_TYPE_CONTROL
@ LIBUSB_TRANSFER_TYPE_CONTROL
Control transfer.
Definition: libusb.h:1101
LIBUSB_TRANSFER_TYPE_BULK
@ LIBUSB_TRANSFER_TYPE_BULK
Bulk transfer.
Definition: libusb.h:1107
LIBUSB_TRANSFER_TYPE_INTERRUPT
@ LIBUSB_TRANSFER_TYPE_INTERRUPT
Interrupt transfer.
Definition: libusb.h:1110
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:1841
libusb_descriptor_type
libusb_descriptor_type
Descriptor types as defined by the USB specification.
Definition: libusb.h:246
libusb_supported_speed
libusb_supported_speed
Supported speeds (wSpeedSupported) bitfield.
Definition: libusb.h:472
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:509
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:317
libusb_endpoint_transfer_type
libusb_endpoint_transfer_type
Endpoint transfer type.
Definition: libusb.h:331
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:1819
libusb_iso_sync_type
libusb_iso_sync_type
Synchronization type for isochronous endpoints.
Definition: libusb.h:436
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:501
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:457
libusb_class_code
libusb_class_code
Device and/or Interface Class codes.
Definition: libusb.h:181
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:491
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:278
LIBUSB_DT_CONFIG
@ LIBUSB_DT_CONFIG
Configuration descriptor.
Definition: libusb.h:251
LIBUSB_DT_STRING
@ LIBUSB_DT_STRING
String descriptor.
Definition: libusb.h:254
LIBUSB_DT_HID
@ LIBUSB_DT_HID
HID descriptor.
Definition: libusb.h:269
LIBUSB_DT_REPORT
@ LIBUSB_DT_REPORT
HID report descriptor.
Definition: libusb.h:272
LIBUSB_DT_DEVICE
@ LIBUSB_DT_DEVICE
Device descriptor.
Definition: libusb.h:248
LIBUSB_DT_DEVICE_CAPABILITY
@ LIBUSB_DT_DEVICE_CAPABILITY
Device Capability descriptor.
Definition: libusb.h:266
LIBUSB_DT_SUPERSPEED_HUB
@ LIBUSB_DT_SUPERSPEED_HUB
SuperSpeed Hub descriptor.
Definition: libusb.h:281
LIBUSB_DT_PHYSICAL
@ LIBUSB_DT_PHYSICAL
Physical descriptor.
Definition: libusb.h:275
LIBUSB_DT_INTERFACE
@ LIBUSB_DT_INTERFACE
Interface descriptor.
Definition: libusb.h:257
LIBUSB_DT_ENDPOINT
@ LIBUSB_DT_ENDPOINT
Endpoint descriptor.
Definition: libusb.h:260
LIBUSB_DT_SS_ENDPOINT_COMPANION
@ LIBUSB_DT_SS_ENDPOINT_COMPANION
SuperSpeed Endpoint Companion descriptor.
Definition: libusb.h:284
LIBUSB_DT_BOS
@ LIBUSB_DT_BOS
BOS descriptor.
Definition: libusb.h:263
LIBUSB_HIGH_SPEED_OPERATION
@ LIBUSB_HIGH_SPEED_OPERATION
High speed operation supported (480MBit/s).
Definition: libusb.h:480
LIBUSB_LOW_SPEED_OPERATION
@ LIBUSB_LOW_SPEED_OPERATION
Low speed operation supported (1.5MBit/s).
Definition: libusb.h:474
LIBUSB_SUPER_SPEED_OPERATION
@ LIBUSB_SUPER_SPEED_OPERATION
Superspeed operation supported (5000MBit/s).
Definition: libusb.h:483
LIBUSB_FULL_SPEED_OPERATION
@ LIBUSB_FULL_SPEED_OPERATION
Full speed operation supported (12MBit/s).
Definition: libusb.h:477
LIBUSB_BT_USB_2_0_EXTENSION
@ LIBUSB_BT_USB_2_0_EXTENSION
USB 2.0 extensions.
Definition: libusb.h:514
LIBUSB_BT_SS_USB_DEVICE_CAPABILITY
@ LIBUSB_BT_SS_USB_DEVICE_CAPABILITY
SuperSpeed USB device capability.
Definition: libusb.h:517
LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY
@ LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY
Wireless USB device capability.
Definition: libusb.h:511
LIBUSB_BT_CONTAINER_ID
@ LIBUSB_BT_CONTAINER_ID
Container ID type.
Definition: libusb.h:520
LIBUSB_ENDPOINT_IN
@ LIBUSB_ENDPOINT_IN
In: device-to-host.
Definition: libusb.h:322
LIBUSB_ENDPOINT_OUT
@ LIBUSB_ENDPOINT_OUT
Out: host-to-device.
Definition: libusb.h:319
LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT
@ LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT
Interrupt endpoint.
Definition: libusb.h:342
LIBUSB_ENDPOINT_TRANSFER_TYPE_ISOCHRONOUS
@ LIBUSB_ENDPOINT_TRANSFER_TYPE_ISOCHRONOUS
Isochronous endpoint.
Definition: libusb.h:336
LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK
@ LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK
Bulk endpoint.
Definition: libusb.h:339
LIBUSB_ENDPOINT_TRANSFER_TYPE_CONTROL
@ LIBUSB_ENDPOINT_TRANSFER_TYPE_CONTROL
Control endpoint.
Definition: libusb.h:333
LIBUSB_ISO_SYNC_TYPE_SYNC
@ LIBUSB_ISO_SYNC_TYPE_SYNC
Synchronous.
Definition: libusb.h:447
LIBUSB_ISO_SYNC_TYPE_NONE
@ LIBUSB_ISO_SYNC_TYPE_NONE
No synchronization.
Definition: libusb.h:438
LIBUSB_ISO_SYNC_TYPE_ADAPTIVE
@ LIBUSB_ISO_SYNC_TYPE_ADAPTIVE
Adaptive.
Definition: libusb.h:444
LIBUSB_ISO_SYNC_TYPE_ASYNC
@ LIBUSB_ISO_SYNC_TYPE_ASYNC
Asynchronous.
Definition: libusb.h:441
LIBUSB_BM_LTM_SUPPORT
@ LIBUSB_BM_LTM_SUPPORT
Supports Latency Tolerance Messages (LTM)
Definition: libusb.h:503
LIBUSB_ISO_USAGE_TYPE_DATA
@ LIBUSB_ISO_USAGE_TYPE_DATA
Data endpoint.
Definition: libusb.h:459
LIBUSB_ISO_USAGE_TYPE_FEEDBACK
@ LIBUSB_ISO_USAGE_TYPE_FEEDBACK
Feedback endpoint.
Definition: libusb.h:462
LIBUSB_ISO_USAGE_TYPE_IMPLICIT
@ LIBUSB_ISO_USAGE_TYPE_IMPLICIT
Implicit feedback Data endpoint.
Definition: libusb.h:465
LIBUSB_CLASS_AUDIO
@ LIBUSB_CLASS_AUDIO
Audio class.
Definition: libusb.h:189
LIBUSB_CLASS_HUB
@ LIBUSB_CLASS_HUB
Hub class.
Definition: libusb.h:211
LIBUSB_CLASS_MISCELLANEOUS
@ LIBUSB_CLASS_MISCELLANEOUS
Miscellaneous class.
Definition: libusb.h:235
LIBUSB_CLASS_APPLICATION
@ LIBUSB_CLASS_APPLICATION
Application class.
Definition: libusb.h:238
LIBUSB_CLASS_CONTENT_SECURITY
@ LIBUSB_CLASS_CONTENT_SECURITY
Content Security.
Definition: libusb.h:220
LIBUSB_CLASS_DIAGNOSTIC_DEVICE
@ LIBUSB_CLASS_DIAGNOSTIC_DEVICE
Diagnostic Device.
Definition: libusb.h:229
LIBUSB_CLASS_PHYSICAL
@ LIBUSB_CLASS_PHYSICAL
Physical.
Definition: libusb.h:198
LIBUSB_CLASS_COMM
@ LIBUSB_CLASS_COMM
Communications class.
Definition: libusb.h:192
LIBUSB_CLASS_VIDEO
@ LIBUSB_CLASS_VIDEO
Video.
Definition: libusb.h:223
LIBUSB_CLASS_DATA
@ LIBUSB_CLASS_DATA
Data class.
Definition: libusb.h:214
LIBUSB_CLASS_WIRELESS
@ LIBUSB_CLASS_WIRELESS
Wireless class.
Definition: libusb.h:232
LIBUSB_CLASS_PRINTER
@ LIBUSB_CLASS_PRINTER
Printer class.
Definition: libusb.h:205
LIBUSB_CLASS_PERSONAL_HEALTHCARE
@ LIBUSB_CLASS_PERSONAL_HEALTHCARE
Personal Healthcare.
Definition: libusb.h:226
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:186
LIBUSB_CLASS_MASS_STORAGE
@ LIBUSB_CLASS_MASS_STORAGE
Mass storage class.
Definition: libusb.h:208
LIBUSB_CLASS_HID
@ LIBUSB_CLASS_HID
Human Interface Device class.
Definition: libusb.h:195
LIBUSB_CLASS_VENDOR_SPEC
@ LIBUSB_CLASS_VENDOR_SPEC
Class is vendor-specific.
Definition: libusb.h:241
LIBUSB_CLASS_IMAGE
@ LIBUSB_CLASS_IMAGE
Image class.
Definition: libusb.h:201
LIBUSB_CLASS_SMART_CARD
@ LIBUSB_CLASS_SMART_CARD
Smart Card.
Definition: libusb.h:217
LIBUSB_BM_LPM_SUPPORT
@ LIBUSB_BM_LPM_SUPPORT
Supports Link Power Management (LPM)
Definition: libusb.h:493
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:1357
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:935
libusb_get_parent
libusb_device * libusb_get_parent(libusb_device *dev)
Get the the parent from the specified device.
Definition: core.c:997
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:1979
libusb_ref_device
libusb_device * libusb_ref_device(libusb_device *dev)
Increment the reference count of a device.
Definition: core.c:1174
libusb_speed
libusb_speed
Speed codes.
Definition: libusb.h:1020
libusb_get_device
libusb_device * libusb_get_device(libusb_device_handle *dev_handle)
Get the underlying device for a device handle.
Definition: core.c:1519
libusb_unref_device
void libusb_unref_device(libusb_device *dev)
Decrement the reference count of a device.
Definition: core.c:1187
libusb_open
int libusb_open(libusb_device *dev, libusb_device_handle **dev_handle)
Open a device and obtain a device handle.
Definition: core.c:1302
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:1756
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:1711
libusb_get_device_speed
int libusb_get_device_speed(libusb_device *dev)
Get the negotiated connection speed for a device.
Definition: core.c:1018
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:2017
libusb_close
void libusb_close(libusb_device_handle *dev_handle)
Close a device handle.
Definition: core.c:1457
libusb_device
struct libusb_device libusb_device
Structure representing a USB device detected on the system.
Definition: libusb.h:1004
libusb_set_configuration
int libusb_set_configuration(libusb_device_handle *dev_handle, int configuration)
Set the active configuration for a device.
Definition: core.c:1630
libusb_device_handle
struct libusb_device_handle libusb_device_handle
Structure representing a handle on a USB device.
Definition: libusb.h:1015
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:1247
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:977
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:951
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:1007
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:1798
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:825
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:2093
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:1064
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:895
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:2054
libusb_get_configuration
int libusb_get_configuration(libusb_device_handle *dev, int *config)
Determine the bConfigurationValue of the currently active configuration.
Definition: core.c:1544
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:1119
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:1667
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:916
libusb_reset_device
int libusb_reset_device(libusb_device_handle *dev_handle)
Perform a USB port reset to reinitialize a device.
Definition: core.c:1827
LIBUSB_SPEED_FULL
@ LIBUSB_SPEED_FULL
The device is operating at full speed (12MBit/s).
Definition: libusb.h:1028
LIBUSB_SPEED_HIGH
@ LIBUSB_SPEED_HIGH
The device is operating at high speed (480MBit/s).
Definition: libusb.h:1031
LIBUSB_SPEED_LOW
@ LIBUSB_SPEED_LOW
The device is operating at low speed (1.5MBit/s).
Definition: libusb.h:1025
LIBUSB_SPEED_SUPER_PLUS
@ LIBUSB_SPEED_SUPER_PLUS
The device is operating at super speed plus (10000MBit/s).
Definition: libusb.h:1037
LIBUSB_SPEED_SUPER
@ LIBUSB_SPEED_SUPER
The device is operating at super speed (5000MBit/s).
Definition: libusb.h:1034
LIBUSB_SPEED_UNKNOWN
@ LIBUSB_SPEED_UNKNOWN
The OS doesn't report or know the device speed.
Definition: libusb.h:1022
libusb_hotplug_callback_handle
int libusb_hotplug_callback_handle
Callback handle.
Definition: libusb.h:1933
libusb_hotplug_event
libusb_hotplug_event
Since version 1.0.16, LIBUSB_API_VERSION >= 0x01000102.
Definition: libusb.h:1940
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:231
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:1990
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:319
libusb_hotplug_flag
libusb_hotplug_flag
Since version 1.0.16, LIBUSB_API_VERSION >= 0x01000102.
Definition: libusb.h:1955
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:357
LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED
@ LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED
A device has been plugged in and is ready to use.
Definition: libusb.h:1942
LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT
@ LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT
A device has left and is no longer available.
Definition: libusb.h:1947
LIBUSB_HOTPLUG_ENUMERATE
@ LIBUSB_HOTPLUG_ENUMERATE
Arm the callback and fire it for all matching currently attached devices.
Definition: libusb.h:1957
libusb_option
libusb_option
Available option values for libusb_set_option().
Definition: libusb.h:2062
libusb_log_cb_mode
libusb_log_cb_mode
Log callback mode.
Definition: libusb.h:1330
libusb_log_level
libusb_log_level
Log message levels.
Definition: libusb.h:1309
libusb_set_log_cb
void libusb_set_log_cb(libusb_context *ctx, libusb_log_cb cb, int mode)
Set log handler.
Definition: core.c:2142
libusb_context
struct libusb_context libusb_context
Structure representing a libusb session.
Definition: libusb.h:987
libusb_set_debug
void libusb_set_debug(libusb_context *ctx, int level)
Definition: core.c:2107
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:1346
libusb_init
int libusb_init(libusb_context **ctx)
Initialize libusb.
Definition: core.c:2257
libusb_exit
void libusb_exit(libusb_context *ctx)
Deinitialize libusb.
Definition: core.c:2367
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_LOG_LEVEL
@ LIBUSB_OPTION_LOG_LEVEL
Set the log message verbosity.
Definition: libusb.h:2084
LIBUSB_OPTION_USE_USBDK
@ LIBUSB_OPTION_USE_USBDK
Use the UsbDk backend for a specific context, if available.
Definition: libusb.h:2093
LIBUSB_OPTION_WEAK_AUTHORITY
@ LIBUSB_OPTION_WEAK_AUTHORITY
Set libusb has weak authority.
Definition: libusb.h:2104
LIBUSB_LOG_CB_GLOBAL
@ LIBUSB_LOG_CB_GLOBAL
Callback function handling all log messages.
Definition: libusb.h:1332
LIBUSB_LOG_CB_CONTEXT
@ LIBUSB_LOG_CB_CONTEXT
Callback function handling context related log messages.
Definition: libusb.h:1335
LIBUSB_LOG_LEVEL_WARNING
@ LIBUSB_LOG_LEVEL_WARNING
(2) : Warning and error messages are emitted
Definition: libusb.h:1317
LIBUSB_LOG_LEVEL_INFO
@ LIBUSB_LOG_LEVEL_INFO
(3) : Informational, warning and error messages are emitted
Definition: libusb.h:1320
LIBUSB_LOG_LEVEL_ERROR
@ LIBUSB_LOG_LEVEL_ERROR
(1) : Error messages are emitted
Definition: libusb.h:1314
LIBUSB_LOG_LEVEL_NONE
@ LIBUSB_LOG_LEVEL_NONE
(0) : No messages ever emitted by the library (default)
Definition: libusb.h:1311
LIBUSB_LOG_LEVEL_DEBUG
@ LIBUSB_LOG_LEVEL_DEBUG
(4) : All messages are emitted
Definition: libusb.h:1323
libusb_request_type
libusb_request_type
Request type bits of the bmRequestType field in control transfers.
Definition: libusb.h:397
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:2734
libusb_request_recipient
libusb_request_recipient
Recipient bits of the bmRequestType field in control transfers.
Definition: libusb.h:415
libusb_le16_to_cpu
#define libusb_le16_to_cpu
Convert a 16-bit value from little-endian to host-endian format.
Definition: libusb.h:175
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:347
libusb_has_capability
int libusb_has_capability(uint32_t capability)
Check at runtime if the loaded library has a given capability.
Definition: core.c:2463
LIBUSB_CALL
#define LIBUSB_CALL
libusb's Windows calling convention.
Definition: libusb.h:116
libusb_capability
libusb_capability
Capabilities supported by an instance of libusb on the current running platform.
Definition: libusb.h:1288
libusb_error
libusb_error
Error codes.
Definition: libusb.h:1047
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:156
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:2679
LIBUSB_REQUEST_TYPE_VENDOR
@ LIBUSB_REQUEST_TYPE_VENDOR
Vendor.
Definition: libusb.h:405
LIBUSB_REQUEST_TYPE_STANDARD
@ LIBUSB_REQUEST_TYPE_STANDARD
Standard.
Definition: libusb.h:399
LIBUSB_REQUEST_TYPE_CLASS
@ LIBUSB_REQUEST_TYPE_CLASS
Class.
Definition: libusb.h:402
LIBUSB_REQUEST_TYPE_RESERVED
@ LIBUSB_REQUEST_TYPE_RESERVED
Reserved.
Definition: libusb.h:408
LIBUSB_RECIPIENT_ENDPOINT
@ LIBUSB_RECIPIENT_ENDPOINT
Endpoint.
Definition: libusb.h:423
LIBUSB_RECIPIENT_INTERFACE
@ LIBUSB_RECIPIENT_INTERFACE
Interface.
Definition: libusb.h:420
LIBUSB_RECIPIENT_OTHER
@ LIBUSB_RECIPIENT_OTHER
Other.
Definition: libusb.h:426
LIBUSB_RECIPIENT_DEVICE
@ LIBUSB_RECIPIENT_DEVICE
Device.
Definition: libusb.h:417
LIBUSB_REQUEST_CLEAR_FEATURE
@ LIBUSB_REQUEST_CLEAR_FEATURE
Clear or disable a specific feature.
Definition: libusb.h:352
LIBUSB_REQUEST_GET_INTERFACE
@ LIBUSB_REQUEST_GET_INTERFACE
Return the selected alternate setting for the specified interface.
Definition: libusb.h:377
LIBUSB_REQUEST_GET_DESCRIPTOR
@ LIBUSB_REQUEST_GET_DESCRIPTOR
Get the specified descriptor.
Definition: libusb.h:365
LIBUSB_REQUEST_SET_DESCRIPTOR
@ LIBUSB_REQUEST_SET_DESCRIPTOR
Used to update existing descriptors or add new descriptors.
Definition: libusb.h:368
LIBUSB_REQUEST_GET_STATUS
@ LIBUSB_REQUEST_GET_STATUS
Request status of the specific recipient.
Definition: libusb.h:349
LIBUSB_REQUEST_SET_FEATURE
@ LIBUSB_REQUEST_SET_FEATURE
Set or enable a specific feature.
Definition: libusb.h:357
LIBUSB_REQUEST_SET_INTERFACE
@ LIBUSB_REQUEST_SET_INTERFACE
Select an alternate interface for the specified interface.
Definition: libusb.h:380
LIBUSB_REQUEST_SET_ADDRESS
@ LIBUSB_REQUEST_SET_ADDRESS
Set device address for all future accesses.
Definition: libusb.h:362
LIBUSB_REQUEST_GET_CONFIGURATION
@ LIBUSB_REQUEST_GET_CONFIGURATION
Get the current device configuration value.
Definition: libusb.h:371
LIBUSB_REQUEST_SET_SEL
@ LIBUSB_REQUEST_SET_SEL
Sets both the U1 and U2 Exit Latency.
Definition: libusb.h:386
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:390
LIBUSB_REQUEST_SYNCH_FRAME
@ LIBUSB_REQUEST_SYNCH_FRAME
Set then report an endpoint's synchronization frame.
Definition: libusb.h:383
LIBUSB_REQUEST_SET_CONFIGURATION
@ LIBUSB_REQUEST_SET_CONFIGURATION
Set device configuration.
Definition: libusb.h:374
LIBUSB_CAP_HAS_CAPABILITY
@ LIBUSB_CAP_HAS_CAPABILITY
The libusb_has_capability() API is available.
Definition: libusb.h:1290
LIBUSB_CAP_HAS_HOTPLUG
@ LIBUSB_CAP_HAS_HOTPLUG
Hotplug support is available on this platform.
Definition: libusb.h:1293
LIBUSB_CAP_HAS_HID_ACCESS
@ LIBUSB_CAP_HAS_HID_ACCESS
The library can access HID devices without requiring user intervention.
Definition: libusb.h:1299
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:1303
LIBUSB_ERROR_NOT_SUPPORTED
@ LIBUSB_ERROR_NOT_SUPPORTED
Operation not supported or unimplemented on this platform.
Definition: libusb.h:1085
LIBUSB_ERROR_ACCESS
@ LIBUSB_ERROR_ACCESS
Access denied (insufficient permissions)
Definition: libusb.h:1058
LIBUSB_ERROR_PIPE
@ LIBUSB_ERROR_PIPE
Pipe error.
Definition: libusb.h:1076
LIBUSB_ERROR_NOT_FOUND
@ LIBUSB_ERROR_NOT_FOUND
Entity not found.
Definition: libusb.h:1064
LIBUSB_ERROR_BUSY
@ LIBUSB_ERROR_BUSY
Resource busy.
Definition: libusb.h:1067
LIBUSB_ERROR_INTERRUPTED
@ LIBUSB_ERROR_INTERRUPTED
System call interrupted (perhaps due to signal)
Definition: libusb.h:1079
LIBUSB_SUCCESS
@ LIBUSB_SUCCESS
Success (no error)
Definition: libusb.h:1049
LIBUSB_ERROR_INVALID_PARAM
@ LIBUSB_ERROR_INVALID_PARAM
Invalid parameter.
Definition: libusb.h:1055
LIBUSB_ERROR_IO
@ LIBUSB_ERROR_IO
Input/output error.
Definition: libusb.h:1052
LIBUSB_ERROR_OTHER
@ LIBUSB_ERROR_OTHER
Other error.
Definition: libusb.h:1091
LIBUSB_ERROR_TIMEOUT
@ LIBUSB_ERROR_TIMEOUT
Operation timed out.
Definition: libusb.h:1070
LIBUSB_ERROR_OVERFLOW
@ LIBUSB_ERROR_OVERFLOW
Overflow.
Definition: libusb.h:1073
LIBUSB_ERROR_NO_DEVICE
@ LIBUSB_ERROR_NO_DEVICE
No such device (it may have been disconnected)
Definition: libusb.h:1061
LIBUSB_ERROR_NO_MEM
@ LIBUSB_ERROR_NO_MEM
Insufficient memory.
Definition: libusb.h:1082
libusb_handle_events_completed
int libusb_handle_events_completed(libusb_context *ctx, int *completed)
Handle any pending events in blocking mode.
Definition: io.c:2433
libusb_lock_event_waiters
void libusb_lock_event_waiters(libusb_context *ctx)
Acquire the event waiters lock.
Definition: io.c:1953
libusb_interrupt_event_handler
void libusb_interrupt_event_handler(libusb_context *ctx)
Interrupt any active thread that is handling events.
Definition: io.c:1917
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:2615
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:1888
libusb_unlock_event_waiters
void libusb_unlock_event_waiters(libusb_context *ctx)
Release the event waiters lock.
Definition: io.c:1964
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:2319
libusb_handle_events
int libusb_handle_events(libusb_context *ctx)
Handle any pending events in blocking mode.
Definition: io.c:2411
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:2543
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:1859
libusb_handle_events_timeout
int libusb_handle_events_timeout(libusb_context *ctx, struct timeval *tv)
Handle any pending events.
Definition: io.c:2391
libusb_try_lock_events
int libusb_try_lock_events(libusb_context *ctx)
Attempt to acquire the event handling lock.
Definition: io.c:1766
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:2461
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:1912
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:1900
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:1809
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:2723
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:1824
libusb_free_pollfds
void libusb_free_pollfds(const struct libusb_pollfd **pollfds)
Free a list of libusb_pollfd structures.
Definition: io.c:2771
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:1996
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:2509
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:791
libusb_bos_descriptor::wTotalLength
uint16_t wTotalLength
Length of this descriptor and all of its sub descriptors.
Definition: libusb.h:801
libusb_bos_descriptor::dev_capability
struct libusb_bos_dev_capability_descriptor * dev_capability[ZERO_SIZED_ARRAY]
bNumDeviceCap Device Capability Descriptors
Definition: libusb.h:808
libusb_bos_descriptor::bNumDeviceCaps
uint8_t bNumDeviceCaps
The number of separate device capability descriptors in the BOS.
Definition: libusb.h:805
libusb_bos_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:793
libusb_bos_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:798
libusb_bos_dev_capability_descriptor
A generic representation of a BOS Device Capability descriptor.
Definition: libusb.h:770
libusb_bos_dev_capability_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:772
libusb_bos_dev_capability_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:777
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:783
libusb_bos_dev_capability_descriptor::bDevCapabilityType
uint8_t bDevCapabilityType
Device Capability type.
Definition: libusb.h:780
libusb_config_descriptor
A structure representing the standard USB configuration descriptor.
Definition: libusb.h:693
libusb_config_descriptor::bConfigurationValue
uint8_t bConfigurationValue
Identifier value for this configuration.
Definition: libusb.h:709
libusb_config_descriptor::iConfiguration
uint8_t iConfiguration
Index of string descriptor describing this configuration.
Definition: libusb.h:712
libusb_config_descriptor::extra_length
int extra_length
Length of the extra descriptors, in bytes.
Definition: libusb.h:732
libusb_config_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:695
libusb_config_descriptor::bNumInterfaces
uint8_t bNumInterfaces
Number of interfaces supported by this configuration.
Definition: libusb.h:706
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:721
libusb_config_descriptor::wTotalLength
uint16_t wTotalLength
Total length of data returned for this configuration.
Definition: libusb.h:703
libusb_config_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:700
libusb_config_descriptor::extra
const unsigned char * extra
Extra descriptors.
Definition: libusb.h:729
libusb_config_descriptor::bmAttributes
uint8_t bmAttributes
Configuration characteristics.
Definition: libusb.h:715
libusb_config_descriptor::interface
const struct libusb_interface * interface
Array of interfaces supported by this configuration.
Definition: libusb.h:725
libusb_container_id_descriptor
A structure representing the Container ID descriptor.
Definition: libusb.h:884
libusb_container_id_descriptor::ContainerID
uint8_t ContainerID[16]
128 bit UUID
Definition: libusb.h:902
libusb_container_id_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:891
libusb_container_id_descriptor::bDevCapabilityType
uint8_t bDevCapabilityType
Capability type.
Definition: libusb.h:896
libusb_container_id_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:886
libusb_container_id_descriptor::bReserved
uint8_t bReserved
Reserved field.
Definition: libusb.h:899
libusb_control_setup
Setup packet for control transfers.
Definition: libusb.h:910
libusb_control_setup::bRequest
uint8_t bRequest
Request.
Definition: libusb.h:923
libusb_control_setup::bmRequestType
uint8_t bmRequestType
Request type.
Definition: libusb.h:916
libusb_control_setup::wLength
uint16_t wLength
Number of bytes to transfer.
Definition: libusb.h:933
libusb_control_setup::wIndex
uint16_t wIndex
Index.
Definition: libusb.h:930
libusb_control_setup::wValue
uint16_t wValue
Value.
Definition: libusb.h:926
libusb_device_descriptor
A structure representing the standard USB device descriptor.
Definition: libusb.h:528
libusb_device_descriptor::bNumConfigurations
uint8_t bNumConfigurations
Number of possible configurations.
Definition: libusb.h:574
libusb_device_descriptor::iProduct
uint8_t iProduct
Index of string descriptor describing product.
Definition: libusb.h:568
libusb_device_descriptor::iSerialNumber
uint8_t iSerialNumber
Index of string descriptor containing device serial number.
Definition: libusb.h:571
libusb_device_descriptor::bMaxPacketSize0
uint8_t bMaxPacketSize0
Maximum packet size for endpoint 0.
Definition: libusb.h:553
libusb_device_descriptor::bDeviceProtocol
uint8_t bDeviceProtocol
USB-IF protocol code for the device, qualified by the bDeviceClass and bDeviceSubClass values.
Definition: libusb.h:550
libusb_device_descriptor::idProduct
uint16_t idProduct
USB-IF product ID.
Definition: libusb.h:559
libusb_device_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:535
libusb_device_descriptor::bDeviceSubClass
uint8_t bDeviceSubClass
USB-IF subclass code for the device, qualified by the bDeviceClass value.
Definition: libusb.h:546
libusb_device_descriptor::bDeviceClass
uint8_t bDeviceClass
USB-IF class code for the device.
Definition: libusb.h:542
libusb_device_descriptor::iManufacturer
uint8_t iManufacturer
Index of string descriptor describing manufacturer.
Definition: libusb.h:565
libusb_device_descriptor::idVendor
uint16_t idVendor
USB-IF vendor ID.
Definition: libusb.h:556
libusb_device_descriptor::bcdUSB
uint16_t bcdUSB
USB specification release number in binary-coded decimal.
Definition: libusb.h:539
libusb_device_descriptor::bcdDevice
uint16_t bcdDevice
Device release number in binary-coded decimal.
Definition: libusb.h:562
libusb_device_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:530
libusb_endpoint_descriptor
A structure representing the standard USB endpoint descriptor.
Definition: libusb.h:582
libusb_endpoint_descriptor::extra_length
int extra_length
Length of the extra descriptors, in bytes.
Definition: libusb.h:622
libusb_endpoint_descriptor::bEndpointAddress
uint8_t bEndpointAddress
The address of the endpoint described by this descriptor.
Definition: libusb.h:594
libusb_endpoint_descriptor::extra
const unsigned char * extra
Extra descriptors.
Definition: libusb.h:619
libusb_endpoint_descriptor::bInterval
uint8_t bInterval
Interval for polling endpoint for data transfers.
Definition: libusb.h:608
libusb_endpoint_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:589
libusb_endpoint_descriptor::bRefresh
uint8_t bRefresh
For audio devices only: the rate at which synchronization feedback is provided.
Definition: libusb.h:612
libusb_endpoint_descriptor::bmAttributes
uint8_t bmAttributes
Attributes which apply to the endpoint when it is configured using the bConfigurationValue.
Definition: libusb.h:602
libusb_endpoint_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:584
libusb_endpoint_descriptor::bSynchAddress
uint8_t bSynchAddress
For audio devices only: the address if the synch endpoint.
Definition: libusb.h:615
libusb_endpoint_descriptor::wMaxPacketSize
uint16_t wMaxPacketSize
Maximum packet size this endpoint is capable of sending/receiving.
Definition: libusb.h:605
libusb_interface_descriptor
A structure representing the standard USB interface descriptor.
Definition: libusb.h:630
libusb_interface_descriptor::bInterfaceSubClass
uint8_t bInterfaceSubClass
USB-IF subclass code for this interface, qualified by the bInterfaceClass value.
Definition: libusb.h:654
libusb_interface_descriptor::iInterface
uint8_t iInterface
Index of string descriptor describing this interface.
Definition: libusb.h:661
libusb_interface_descriptor::bInterfaceClass
uint8_t bInterfaceClass
USB-IF class code for this interface.
Definition: libusb.h:650
libusb_interface_descriptor::bAlternateSetting
uint8_t bAlternateSetting
Value used to select this alternate setting for this interface.
Definition: libusb.h:643
libusb_interface_descriptor::endpoint
const struct libusb_endpoint_descriptor * endpoint
Array of endpoint descriptors.
Definition: libusb.h:665
libusb_interface_descriptor::bNumEndpoints
uint8_t bNumEndpoints
Number of endpoints used by this interface (excluding the control endpoint).
Definition: libusb.h:647
libusb_interface_descriptor::bInterfaceProtocol
uint8_t bInterfaceProtocol
USB-IF protocol code for this interface, qualified by the bInterfaceClass and bInterfaceSubClass valu...
Definition: libusb.h:658
libusb_interface_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:632
libusb_interface_descriptor::bInterfaceNumber
uint8_t bInterfaceNumber
Number of this interface.
Definition: libusb.h:640
libusb_interface_descriptor::extra
const unsigned char * extra
Extra descriptors.
Definition: libusb.h:669
libusb_interface_descriptor::extra_length
int extra_length
Length of the extra descriptors, in bytes.
Definition: libusb.h:672
libusb_interface_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:637
libusb_interface
A collection of alternate settings for a particular USB interface.
Definition: libusb.h:678
libusb_interface::altsetting
const struct libusb_interface_descriptor * altsetting
Array of interface descriptors.
Definition: libusb.h:681
libusb_interface::num_altsetting
int num_altsetting
The number of alternate settings that belong to this interface.
Definition: libusb.h:685
libusb_iso_packet_descriptor
Isochronous packet descriptor.
Definition: libusb.h:1192
libusb_iso_packet_descriptor::actual_length
unsigned int actual_length
Amount of data that was actually transferred.
Definition: libusb.h:1197
libusb_iso_packet_descriptor::length
unsigned int length
Length of data to request in this packet.
Definition: libusb.h:1194
libusb_iso_packet_descriptor::status
enum libusb_transfer_status status
Status code for this packet.
Definition: libusb.h:1200
libusb_pollfd
File descriptor for polling.
Definition: libusb.h:1879
libusb_pollfd::events
short events
Event flags to poll for from <poll.h>.
Definition: libusb.h:1887
libusb_pollfd::fd
int fd
Numeric file descriptor.
Definition: libusb.h:1881
libusb_ss_endpoint_companion_descriptor
A structure representing the superspeed endpoint companion descriptor.
Definition: libusb.h:741
libusb_ss_endpoint_companion_descriptor::wBytesPerInterval
uint16_t wBytesPerInterval
The total number of bytes this EP will transfer every service interval.
Definition: libusb.h:762
libusb_ss_endpoint_companion_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:743
libusb_ss_endpoint_companion_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:748
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:752
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:758
libusb_ss_usb_device_capability_descriptor
A structure representing the SuperSpeed USB Device Capability descriptor This descriptor is documente...
Definition: libusb.h:842
libusb_ss_usb_device_capability_descriptor::bDevCapabilityType
uint8_t bDevCapabilityType
Capability type.
Definition: libusb.h:854
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:864
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:870
libusb_ss_usb_device_capability_descriptor::bU2DevExitLat
uint16_t bU2DevExitLat
U2 Device Exit Latency.
Definition: libusb.h:876
libusb_ss_usb_device_capability_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:844
libusb_ss_usb_device_capability_descriptor::bmAttributes
uint8_t bmAttributes
Bitmap encoding of supported device level features.
Definition: libusb.h:860
libusb_ss_usb_device_capability_descriptor::bU1DevExitLat
uint8_t bU1DevExitLat
U1 Device Exit Latency.
Definition: libusb.h:873
libusb_ss_usb_device_capability_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:849
libusb_transfer
The generic USB transfer structure.
Definition: libusb.h:1222
libusb_transfer::endpoint
unsigned char endpoint
Address of the endpoint where this transfer will be sent.
Definition: libusb.h:1230
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:1280
libusb_transfer::status
enum libusb_transfer_status status
The status of the transfer.
Definition: libusb.h:1246
libusb_transfer::length
int length
Length of the data buffer.
Definition: libusb.h:1249
libusb_transfer::callback
libusb_transfer_cb_fn callback
Callback function.
Definition: libusb.h:1258
libusb_transfer::type
unsigned char type
Type of the transfer from libusb_transfer_type.
Definition: libusb.h:1233
libusb_transfer::actual_length
int actual_length
Actual length of data that was transferred.
Definition: libusb.h:1254
libusb_transfer::buffer
unsigned char * buffer
Data buffer.
Definition: libusb.h:1273
libusb_transfer::num_iso_packets
int num_iso_packets
Number of isochronous packets.
Definition: libusb.h:1277
libusb_transfer::timeout
unsigned int timeout
Timeout for this transfer in milliseconds.
Definition: libusb.h:1237
libusb_transfer::user_data
void * user_data
User context data.
Definition: libusb.h:1270
libusb_transfer::dev_handle
libusb_device_handle * dev_handle
Handle of the device that this transfer will be submitted to.
Definition: libusb.h:1224
libusb_transfer::flags
uint8_t flags
A bitwise OR combination of libusb_transfer_flags.
Definition: libusb.h:1227
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:816
libusb_usb_2_0_extension_descriptor::bLength
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:818
libusb_usb_2_0_extension_descriptor::bDevCapabilityType
uint8_t bDevCapabilityType
Capability type.
Definition: libusb.h:828
libusb_usb_2_0_extension_descriptor::bmAttributes
uint32_t bmAttributes
Bitmap encoding of supported device level features.
Definition: libusb.h:834
libusb_usb_2_0_extension_descriptor::bDescriptorType
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:823
libusb_version
Structure providing the version of the libusb runtime.
Definition: libusb.h:950
libusb_version::micro
const uint16_t micro
Library micro version.
Definition: libusb.h:958
libusb_version::major
const uint16_t major
Library major version.
Definition: libusb.h:952
libusb_version::rc
const char * rc
Library release candidate suffix string, e.g.
Definition: libusb.h:964
libusb_version::minor
const uint16_t minor
Library minor version.
Definition: libusb.h:955
libusb_version::describe
const char * describe
For ABI compatibility only.
Definition: libusb.h:967
libusb_version::nano
const uint16_t nano
Library nano version.
Definition: libusb.h:961