29 #if !defined(__cplusplus) 30 #define inline __inline 33 #ifndef _SSIZE_T_DEFINED 34 #define _SSIZE_T_DEFINED 37 typedef __int64 ssize_t;
45 #if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H)) 46 typedef unsigned __int8 uint8_t;
47 typedef unsigned __int16 uint16_t;
48 typedef unsigned __int32 uint32_t;
53 #if !defined(_WIN32_WCE) 54 #include <sys/types.h> 57 #if defined(__linux__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__HAIKU__) 64 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) 65 #define ZERO_SIZED_ARRAY 67 #define ZERO_SIZED_ARRAY 0 75 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) 77 #if defined(interface) 80 #if !defined(__CYGWIN__) 85 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) 86 #define LIBUSB_DEPRECATED_FOR(f) \ 87 __attribute__((deprecated("Use " #f " instead"))) 89 #define LIBUSB_DEPRECATED_FOR(f) __attribute__((deprecated)) 91 #define LIBUSB_DEPRECATED_FOR(f) 126 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) 127 #define LIBUSB_CALL WINAPI 152 #define LIBUSB_API_VERSION 0x01000107 155 #define LIBUSBX_API_VERSION LIBUSB_API_VERSION 175 _tmp.b8[1] = (uint8_t) (x >> 8);
176 _tmp.b8[0] = (uint8_t) (x & 0xff);
188 #define libusb_le16_to_cpu libusb_cpu_to_le16 218 LIBUSB_CLASS_IMAGE = 6,
298 #define LIBUSB_DT_DEVICE_SIZE 18 299 #define LIBUSB_DT_CONFIG_SIZE 9 300 #define LIBUSB_DT_INTERFACE_SIZE 9 301 #define LIBUSB_DT_ENDPOINT_SIZE 7 302 #define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 303 #define LIBUSB_DT_HUB_NONVAR_SIZE 7 304 #define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6 305 #define LIBUSB_DT_BOS_SIZE 5 306 #define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3 309 #define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7 310 #define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10 311 #define LIBUSB_BT_CONTAINER_ID_SIZE 20 314 #define LIBUSB_DT_BOS_MAX_SIZE ((LIBUSB_DT_BOS_SIZE) +\ 315 (LIBUSB_BT_USB_2_0_EXTENSION_SIZE) +\ 316 (LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE) +\ 317 (LIBUSB_BT_CONTAINER_ID_SIZE)) 319 #define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f 320 #define LIBUSB_ENDPOINT_DIR_MASK 0x80 334 #define LIBUSB_TRANSFER_TYPE_MASK 0x03 441 #define LIBUSB_ISO_SYNC_TYPE_MASK 0x0C 462 #define LIBUSB_ISO_USAGE_TYPE_MASK 0x30 891 #define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup)) 1102 #define LIBUSB_ERROR_COUNT 14 1291 LIBUSB_LOG_LEVEL_NONE = 0,
1292 LIBUSB_LOG_LEVEL_ERROR = 1,
1293 LIBUSB_LOG_LEVEL_WARNING = 2,
1294 LIBUSB_LOG_LEVEL_INFO = 3,
1295 LIBUSB_LOG_LEVEL_DEBUG = 4,
1387 unsigned char endpoint);
1389 unsigned char endpoint);
1399 int interface_number);
1401 int interface_number);
1407 int interface_number,
int alternate_setting);
1409 unsigned char endpoint);
1413 uint32_t num_streams,
unsigned char *endpoints,
int num_endpoints);
1415 unsigned char *endpoints,
int num_endpoints);
1420 unsigned char *buffer,
size_t length);
1423 int interface_number);
1425 int interface_number);
1427 int interface_number);
1448 return transfer->
buffer + LIBUSB_CONTROL_SETUP_SIZE;
1551 transfer->
buffer = buffer;
1553 transfer->
length = (int) (LIBUSB_CONTROL_SETUP_SIZE
1575 void *user_data,
unsigned int timeout)
1581 transfer->
buffer = buffer;
1582 transfer->
length = length;
1605 unsigned char endpoint, uint32_t stream_id,
1607 void *user_data,
unsigned int timeout)
1610 length, callback, user_data, timeout);
1630 unsigned char endpoint,
unsigned char *buffer,
int length,
1637 transfer->
buffer = buffer;
1638 transfer->
length = length;
1659 unsigned char *buffer,
int length,
int num_iso_packets,
1666 transfer->
buffer = buffer;
1667 transfer->
length = length;
1715 if (packet > INT_MAX)
1717 _packet = (int) packet;
1722 for (i = 0; i < _packet; i++)
1725 return transfer->
buffer + offset;
1755 if (packet > INT_MAX)
1757 _packet = (int) packet;
1769 unsigned char *data, uint16_t
wLength,
unsigned int timeout);
1772 unsigned char endpoint,
unsigned char *data,
int length,
1773 int *actual_length,
unsigned int timeout);
1776 unsigned char endpoint,
unsigned char *data,
int length,
1777 int *actual_length,
unsigned int timeout);
1792 uint8_t desc_type, uint8_t desc_index,
unsigned char *data,
int length)
1796 0, data, (uint16_t) length, 1000);
1814 uint8_t desc_index, uint16_t langid,
unsigned char *data,
int length)
1818 langid, data, (uint16_t) length, 1000);
1822 uint8_t desc_index,
unsigned char *data,
int length);
1837 struct timeval *tv);
1839 struct timeval *tv,
int *completed);
1843 struct timeval *tv);
1846 struct timeval *tv);
1937 #define LIBUSB_HOTPLUG_MATCH_ANY -1 2003 int vendor_id,
int product_id,
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:1007
const char * describe
For ABI compatibility only.
Definition: libusb.h:919
uint16_t bU2DevExitLat
U2 Device Exit Latency.
Definition: libusb.h:834
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:808
Device.
Definition: libusb.h:429
int libusb_hotplug_register_callback(libusb_context *ctx, libusb_hotplug_event events, libusb_hotplug_flag 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:234
uint8_t bFunctionalitySupport
The lowest speed at which all the functionality supported by the device is available to the user...
Definition: libusb.h:828
SuperSpeed Endpoint Companion descriptor.
Definition: libusb.h:294
const char * libusb_strerror(enum libusb_error errcode)
Returns a constant string with a short description of the given error code, this description is inten...
Definition: strerror.c:223
uint8_t bInterfaceNumber
Number of this interface.
Definition: libusb.h:599
Asynchronous.
Definition: libusb.h:453
uint8_t bSynchAddress
For audio devices only: the address if the synch endpoint.
Definition: libusb.h:574
Control endpoint.
Definition: libusb.h:342
The device is operating at low speed (1.5MBit/s).
Definition: libusb.h:977
Success (no error)
Definition: libusb.h:1056
Low speed operation supported (1.5MBit/s).
Definition: libusb.h:998
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:798
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:1705
Device was disconnected.
Definition: libusb.h:1125
Device Capability descriptor.
Definition: libusb.h:276
uint8_t bmAttributes
Attributes which apply to the endpoint when it is configured using the bConfigurationValue.
Definition: libusb.h:561
The OS doesn't report or know the device speed.
Definition: libusb.h:974
void libusb_free_transfer(struct libusb_transfer *transfer)
Free a transfer structure.
Definition: io.c:1312
A collection of alternate settings for a particular USB interface.
Definition: libusb.h:637
static unsigned char * libusb_control_transfer_get_data(struct libusb_transfer *transfer)
Get the data section of a control transfer.
Definition: libusb.h:1445
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:169
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:1902
HID descriptor.
Definition: libusb.h:279
void(* libusb_log_cb)(libusb_context *ctx, enum libusb_log_level level, const char *str)
Callback function for handling log messages.
Definition: libusb.h:1319
void libusb_free_pollfds(const struct libusb_pollfd **pollfds)
Free a list of libusb_pollfd structures.
Definition: io.c:2809
uint8_t bReserved
Reserved field.
Definition: libusb.h:857
enum libusb_transfer_status status
Status code for this packet.
Definition: libusb.h:1188
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
uint8_t bNumConfigurations
Number of possible configurations.
Definition: libusb.h:531
Audio class.
Definition: libusb.h:202
uint8_t bRequest
Request.
Definition: libusb.h:878
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:699
Operation not supported or unimplemented on this platform.
Definition: libusb.h:1092
Physical.
Definition: libusb.h:211
void libusb_interrupt_event_handler(libusb_context *ctx)
Interrupt any active thread that is handling events.
Definition: io.c:1910
int libusb_cancel_transfer(struct libusb_transfer *transfer)
Asynchronously cancel a previously submitted transfer.
Definition: io.c:1578
Other.
Definition: libusb.h:438
Interrupt endpoint.
Definition: libusb.h:351
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:1854
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:1572
const uint16_t nano
Library nano version.
Definition: libusb.h:913
uint8_t bDevCapabilityType
Capability type.
Definition: libusb.h:854
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:733
uint8_t bDeviceSubClass
USB-IF subclass code for the device, qualified by the bDeviceClass value.
Definition: libusb.h:503
libusb_class_code
Device and/or Interface Class codes.
Definition: libusb.h:194
#define libusb_le16_to_cpu
Convert a 16-bit value from little-endian to host-endian format.
Definition: libusb.h:188
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:737
Hub class.
Definition: libusb.h:224
int libusb_detach_kernel_driver(libusb_device_handle *dev_handle, int interface_number)
Detach a kernel driver from an interface.
Definition: core.c:2023
int libusb_try_lock_events(libusb_context *ctx)
Attempt to acquire the event handling lock.
Definition: io.c:1762
A structure representing the standard USB configuration descriptor.
Definition: libusb.h:652
A generic representation of a BOS Device Capability descriptor.
Definition: libusb.h:731
int libusb_wait_for_event(libusb_context *ctx, struct timeval *tv)
Wait for another thread to signal completion of an event.
Definition: io.c:1987
uint8_t bInterval
Interval for polling endpoint for data transfers.
Definition: libusb.h:567
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:487
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:329
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:1872
enum libusb_transfer_status status
The status of the transfer.
Definition: libusb.h:1234
Default value when not using any flags.
Definition: libusb.h:1914
libusb_endpoint_direction
Endpoint direction.
Definition: libusb.h:326
uint8_t bDeviceClass
USB-IF class code for the device.
Definition: libusb.h:499
int libusb_claim_interface(libusb_device_handle *dev_handle, int interface_number)
Claim an interface on a given device handle.
Definition: core.c:1687
Interface descriptor.
Definition: libusb.h:267
Overflow.
Definition: libusb.h:1080
int libusb_open(libusb_device *dev, libusb_device_handle **dev_handle)
Open a device and obtain a device handle.
Definition: core.c:1326
short events
Event flags to poll for from <poll.h>.
Definition: libusb.h:1859
int extra_length
Length of the extra descriptors, in bytes.
Definition: libusb.h:581
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:1884
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:2057
A structure representing the SuperSpeed USB Device Capability descriptor This descriptor is documente...
Definition: libusb.h:800
uint8_t flags
A bitwise OR combination of libusb_transfer_flags.
Definition: libusb.h:1215
int libusb_setlocale(const char *locale)
Set the language, and only the language, not the encoding! used for translatable libusb messages...
Definition: strerror.c:189
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:615
Feedback endpoint.
Definition: libusb.h:474
Data endpoint.
Definition: libusb.h:471
Reserved.
Definition: libusb.h:420
Callback function handling context related log mesages.
Definition: libusb.h:1308
Arm the callback and fire it for all matching currently attached devices.
Definition: libusb.h:1917
uint8_t bmAttributes
In bulk EP: bits 4:0 represents the maximum number of streams the EP supports.
Definition: libusb.h:719
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:1747
void libusb_close(libusb_device_handle *dev_handle)
Close a device handle.
Definition: core.c:1488
uint8_t libusb_get_bus_number(libusb_device *dev)
Get the number of the bus that a device is connected to.
Definition: core.c:897
The library can access HID devices without requiring user intervention.
Definition: libusb.h:1276
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:546
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:1263
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:277
Class is vendor-specific.
Definition: libusb.h:251
struct libusb_context libusb_context
Structure representing a libusb session.
Definition: libusb.h:939
Terminate transfers that are a multiple of the endpoint's wMaxPacketSize with an extra zero length pa...
Definition: libusb.h:1175
uint8_t iSerialNumber
Index of string descriptor containing device serial number.
Definition: libusb.h:528
Superspeed operation supported (5000MBit/s).
Definition: libusb.h:1007
libusb_option
Available option values for libusb_set_option().
Definition: libusb.h:2026
Container ID type.
Definition: libusb.h:1044
Sets both the U1 and U2 Exit Latency.
Definition: libusb.h:398
int libusb_get_ss_endpoint_companion_descriptor(struct 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:753
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:591
Invalid parameter.
Definition: libusb.h:1062
File descriptor for polling.
Definition: libusb.h:1851
uint8_t bNumInterfaces
Number of interfaces supported by this configuration.
Definition: libusb.h:665
libusb_speed
Speed codes.
Definition: libusb.h:972
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:1066
A device has left and is no longer available.
Definition: libusb.h:1932
int libusb_event_handler_active(libusb_context *ctx)
Determine if an active thread is handling events (i.e.
Definition: io.c:1882
System call interrupted (perhaps due to signal)
Definition: libusb.h:1086
libusb_iso_sync_type
Synchronization type for isochronous endpoints.
Definition: libusb.h:448
uint8_t bmAttributes
Bitmap encoding of supported device level features.
Definition: libusb.h:818
int libusb_get_configuration(libusb_device_handle *dev, int *config)
Determine the bConfigurationValue of the currently active configuration.
Definition: core.c:1574
void libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos)
Free a BOS descriptor obtained from libusb_get_bos_descriptor().
Definition: descriptor.c:943
int libusb_get_usb_2_0_extension_descriptor(struct 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:968
uint16_t bcdDevice
Device release number in binary-coded decimal.
Definition: libusb.h:519
unsigned char * buffer
Data buffer.
Definition: libusb.h:1252
uint8_t libusb_get_port_number(libusb_device *dev)
Get the number of the port that a device is connected to.
Definition: core.c:916
uint8_t bDeviceProtocol
USB-IF protocol code for the device, qualified by the bDeviceClass and bDeviceSubClass values...
Definition: libusb.h:507
A device has been plugged in and is ready to use.
Definition: libusb.h:1927
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:1628
Access denied (insufficient permissions)
Definition: libusb.h:1065
Entity not found.
Definition: libusb.h:1071
Input/output error.
Definition: libusb.h:1059
The libusb_has_capability() API is available.
Definition: libusb.h:1269
uint16_t wMaxPacketSize
Maximum packet size this endpoint is capable of sending/receiving.
Definition: libusb.h:564
Diagnostic Device.
Definition: libusb.h:242
uint8_t bDevCapabilityType
Capability type.
Definition: libusb.h:812
const unsigned char * extra
Extra descriptors.
Definition: libusb.h:578
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:566
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:1791
libusb_standard_request
Standard requests, as defined in table 9-5 of the USB 3.0 specifications.
Definition: libusb.h:359
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:1123
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:1100
The device is operating at full speed (12MBit/s).
Definition: libusb.h:980
int libusb_get_device_speed(libusb_device *dev)
Get the negotiated connection speed for a device.
Definition: core.c:999
Set device address for all future accesses.
Definition: libusb.h:374
Bulk endpoint.
Definition: libusb.h:348
int fd
Numeric file descriptor.
Definition: libusb.h:1853
A structure representing the Container ID descriptor.
Definition: libusb.h:842
uint8_t iManufacturer
Index of string descriptor describing manufacturer.
Definition: libusb.h:522
The device is operating at super speed plus (10000MBit/s).
Definition: libusb.h:989
uint8_t iInterface
Index of string descriptor describing this interface.
Definition: libusb.h:620
int libusb_handle_events(libusb_context *ctx)
Handle any pending events in blocking mode.
Definition: io.c:2465
The generic USB transfer structure.
Definition: libusb.h:1210
struct libusb_transfer * libusb_alloc_transfer(int iso_packets)
Allocate a libusb transfer with a specified number of isochronous packet descriptors.
Definition: io.c:1269
Full speed operation supported (12MBit/s).
Definition: libusb.h:1001
Automatically call libusb_free_transfer() after callback returns.
Definition: libusb.h:1150
libusb_descriptor_type
Descriptor types as defined by the USB specification.
Definition: libusb.h:256
Endpoint.
Definition: libusb.h:435
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:988
The device is operating at high speed (480MBit/s).
Definition: libusb.h:983
unsigned int timeout
Timeout for this transfer in milliseconds.
Definition: libusb.h:1225
void libusb_lock_event_waiters(libusb_context *ctx)
Acquire the event waiters lock.
Definition: io.c:1945
Used to update existing descriptors or add new descriptors.
Definition: libusb.h:380
struct libusb_bos_dev_capability_descriptor * dev_capability[ZERO_SIZED_ARRAY]
bNumDeviceCap Device Capability Descriptors
Definition: libusb.h:766
Smart Card.
Definition: libusb.h:230
void libusb_unref_device(libusb_device *dev)
Decrement the reference count of a device.
Definition: core.c:1168
uint8_t bDevCapabilityType
Device Capability type.
Definition: libusb.h:739
int libusb_pollfds_handle_timeouts(libusb_context *ctx)
Determines whether your application must apply special timing considerations when monitoring libusb's...
Definition: io.c:2557
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:1141
libusb_transfer_cb_fn callback
Callback function.
Definition: libusb.h:1246
A structure representing the standard USB interface descriptor.
Definition: libusb.h:589
const uint16_t minor
Library minor version.
Definition: libusb.h:907
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:2674
const unsigned char * extra
Extra descriptors.
Definition: libusb.h:688
Out: host-to-device.
Definition: libusb.h:331
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:1603
A structure representing the standard USB device descriptor.
Definition: libusb.h:485
Insufficient memory.
Definition: libusb.h:1089
uint8_t bmRequestType
Request type.
Definition: libusb.h:871
int libusb_set_configuration(libusb_device_handle *dev_handle, int configuration)
Set the active configuration for a device.
Definition: core.c:1652
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:541
Human Interface Device class.
Definition: libusb.h:208
Mass storage class.
Definition: libusb.h:221
struct libusb_device libusb_device
Structure representing a USB device detected on the system.
Definition: libusb.h:956
uint8_t bEndpointAddress
The address of the endpoint described by this descriptor.
Definition: libusb.h:552
Get the current device configuration value.
Definition: libusb.h:383
Printer class.
Definition: libusb.h:214
Resource busy.
Definition: libusb.h:1074
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:1942
Get the specified descriptor.
Definition: libusb.h:377
High speed operation supported (480MBit/s).
Definition: libusb.h:1004
Content Security.
Definition: libusb.h:233
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:1988
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:1492
Other error.
Definition: libusb.h:1098
const struct libusb_interface * interface
Array of interfaces supported by this configuration.
Definition: libusb.h:684
libusb_request_recipient
Recipient bits of the bmRequestType field in control transfers.
Definition: libusb.h:427
int libusb_reset_device(libusb_device_handle *dev_handle)
Perform a USB port reset to reinitialize a device.
Definition: core.c:1845
Image class.
Definition: libusb.h:217
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:703
uint8_t ContainerID[16]
128 bit UUID
Definition: libusb.h:860
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:596
A structure representing the superspeed endpoint companion descriptor.
Definition: libusb.h:700
SuperSpeed USB device capability.
Definition: libusb.h:1041
void libusb_exit(libusb_context *ctx)
Deinitialize libusb.
Definition: core.c:2365
libusb_error
Error codes.
Definition: libusb.h:1054
SuperSpeed Hub descriptor.
Definition: libusb.h:291
int extra_length
Length of the extra descriptors, in bytes.
Definition: libusb.h:631
const struct libusb_interface_descriptor * altsetting
Array of interface descriptors.
Definition: libusb.h:640
struct libusb_iso_packet_descriptor iso_packet_desc[ZERO_SIZED_ARRAY]
Isochronous packet descriptors, for isochronous transfers only.
Definition: libusb.h:1259
libusb_hotplug_event
Since version 1.0.16, LIBUSB_API_VERSION >= 0x01000102.
Definition: libusb.h:1925
void libusb_lock_events(libusb_context *ctx)
Acquire the event handling lock, blocking until successful acquisition if it is contended.
Definition: io.c:1804
Use the UsbDk backend for a specific context, if available.
Definition: libusb.h:2057
libusb_hotplug_flag
Since version 1.0.16, LIBUSB_API_VERSION >= 0x01000102.
Definition: libusb.h:1912
const uint16_t major
Library major version.
Definition: libusb.h:904
uint8_t bU1DevExitLat
U1 Device Exit Latency.
Definition: libusb.h:831
A structure representing the Binary Device Object Store (BOS) descriptor.
Definition: libusb.h:749
Data class.
Definition: libusb.h:227
libusb_transfer_status
Transfer status codes.
Definition: libusb.h:1106
Interface.
Definition: libusb.h:432
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:1388
Wireless USB device capability.
Definition: libusb.h:1035
const uint16_t micro
Library micro version.
Definition: libusb.h:910
unsigned int actual_length
Amount of data that was actually transferred.
Definition: libusb.h:1185
int num_altsetting
The number of alternate settings that belong to this interface.
Definition: libusb.h:644
libusb_request_type
Request type bits of the bmRequestType field in control transfers.
Definition: libusb.h:409
int libusb_hotplug_callback_handle
Callback handle.
Definition: libusb.h:1905
void libusb_unlock_event_waiters(libusb_context *ctx)
Release the event waiters lock.
Definition: io.c:1956
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:776
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:1657
uint8_t bInterfaceClass
USB-IF class code for this interface.
Definition: libusb.h:609
int libusb_has_capability(uint32_t capability)
Check at runtime if the loaded library has a given capability.
Definition: core.c:2460
libusb_log_cb_mode
Log callback mode.
Definition: libusb.h:1302
int libusb_get_next_timeout(libusb_context *ctx, struct timeval *tv)
Determine the next internal timeout that libusb needs to handle.
Definition: io.c:2596
int libusb_get_container_id_descriptor(struct 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:1085
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:543
Transfer timed out.
Definition: libusb.h:1115
int libusb_handle_events_completed(libusb_context *ctx, int *completed)
Handle any pending events in blocking mode.
Definition: io.c:2487
Operation timed out.
Definition: libusb.h:1077
Adaptive.
Definition: libusb.h:456
libusb_iso_usage_type
Usage type for isochronous endpoints.
Definition: libusb.h:469
uint16_t wValue
Value.
Definition: libusb.h:881
void libusb_transfer_set_stream_id(struct libusb_transfer *transfer, uint32_t stream_id)
Set a transfers bulk stream id.
Definition: io.c:1622
Standard.
Definition: libusb.h:411
Physical descriptor.
Definition: libusb.h:285
void libusb_unlock_events(libusb_context *ctx)
Release the lock previously acquired with libusb_try_lock_events() or libusb_lock_events().
Definition: io.c:1819
uint8_t bmAttributes
Configuration characteristics.
Definition: libusb.h:674
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:659
int length
Length of the data buffer.
Definition: libusb.h:1237
Report short frames as errors.
Definition: libusb.h:1138
void * user_data
User context data to pass to the callback function.
Definition: libusb.h:1249
No synchronization.
Definition: libusb.h:450
uint8_t bNumEndpoints
Number of endpoints used by this interface (excluding the control endpoint).
Definition: libusb.h:606
uint16_t wIndex
Index.
Definition: libusb.h:885
int libusb_handle_events_timeout(libusb_context *ctx, struct timeval *tv)
Handle any pending events.
Definition: io.c:2445
BOS descriptor.
Definition: libusb.h:273
Transfer completed without error.
Definition: libusb.h:1109
Hub descriptor.
Definition: libusb.h:288
Wireless class.
Definition: libusb.h:245
A structure representing the USB 2.0 Extension descriptor This descriptor is documented in section 9...
Definition: libusb.h:774
uint8_t bDevCapabilityType
Capability type.
Definition: libusb.h:786
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:1681
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:2689
String descriptor.
Definition: libusb.h:264
Synchronous.
Definition: libusb.h:459
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:807
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:751
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:1962
Setup packet for control transfers.
Definition: libusb.h:865
const struct libusb_version * libusb_get_version(void)
Returns a pointer to const struct libusb_version with the version (major, minor, micro, nano and rc) of the running library.
Definition: core.c:2744
The device is operating at super speed (5000MBit/s).
Definition: libusb.h:986
void libusb_set_log_cb(libusb_context *ctx, libusb_log_cb cb, int mode)
Set log handler.
Definition: core.c:2142
Transfer failed.
Definition: libusb.h:1112
libusb_device * libusb_get_parent(libusb_device *dev)
Get the the parent from the specified device.
Definition: core.c:978
USB 2.0 extensions.
Definition: libusb.h:1038
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:849
libusb_device_handle * dev_handle
Handle of the device that this transfer will be submitted to.
Definition: libusb.h:1212
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:781
uint8_t bNumDeviceCaps
The number of separate device capability descriptors in the BOS.
Definition: libusb.h:763
uint16_t wTotalLength
Total length of data returned for this configuration.
Definition: libusb.h:662
uint16_t idProduct
USB-IF product ID.
Definition: libusb.h:516
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:2513
Configuration descriptor.
Definition: libusb.h:261
uint16_t wTotalLength
Length of this descriptor and all of its sub descriptors.
Definition: libusb.h:759
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:1541
Return the selected alternate setting for the specified interface.
Definition: libusb.h:389
Endpoint descriptor.
Definition: libusb.h:270
Class.
Definition: libusb.h:414
Supports Latency Tolerance Messages (LTM)
Definition: libusb.h:1027
Clear or disable a specific feature.
Definition: libusb.h:364
uint16_t wLength
Number of bytes to transfer.
Definition: libusb.h:888
libusb_supported_speed
Supported speeds (wSpeedSupported) bitfield.
Definition: libusb.h:996
Video.
Definition: libusb.h:236
uint16_t idVendor
USB-IF vendor ID.
Definition: libusb.h:513
int libusb_set_option(libusb_context *ctx, enum libusb_option option,...)
Set an option in the library.
Definition: core.c:2183
uint8_t bInterfaceSubClass
USB-IF subclass code for this interface, qualified by the bInterfaceClass value.
Definition: libusb.h:613
A structure representing the standard USB endpoint descriptor.
Definition: libusb.h:539
The library supports detaching of the default USB driver, using libusb_detach_kernel_driver(), if one is set by the OS kernel.
Definition: libusb.h:1279
void(* libusb_transfer_cb_fn)(struct libusb_transfer *transfer)
Asynchronous transfer callback function type.
Definition: libusb.h:1202
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:802
uint8_t bConfigurationValue
Identifier value for this configuration.
Definition: libusb.h:668
No such device (it may have been disconnected)
Definition: libusb.h:1068
int num_iso_packets
Number of isochronous packets.
Definition: libusb.h:1256
libusb_transfer_flags
libusb_transfer.flags values
Definition: libusb.h:1136
libusb_usb_2_0_extension_attributes
Masks for the bits of the bmAttributes field of the USB 2.0 Extension descriptor. ...
Definition: libusb.h:1015
libusb_device * libusb_ref_device(libusb_device *dev)
Increment the reference count of a device.
Definition: core.c:1155
int actual_length
Actual length of data that was transferred.
Definition: libusb.h:1242
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:492
In: device-to-host.
Definition: libusb.h:328
Application class.
Definition: libusb.h:248
Stream endpoint.
Definition: libusb.h:354
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:654
struct libusb_device_handle libusb_device_handle
Structure representing a handle on a USB device.
Definition: libusb.h:967
int libusb_handle_events_timeout_completed(libusb_context *ctx, struct timeval *tv, int *completed)
Handle any pending events.
Definition: io.c:2376
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:932
Transfer was cancelled.
Definition: libusb.h:1118
For bulk/interrupt endpoints: halt condition detected (endpoint stalled).
Definition: libusb.h:1122
uint8_t bMaxPacketSize0
Maximum packet size for endpoint 0.
Definition: libusb.h:510
uint32_t libusb_transfer_get_stream_id(struct libusb_transfer *transfer)
Get a transfers bulk stream id.
Definition: io.c:1639
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:1025
Personal Healthcare.
Definition: libusb.h:239
uint8_t iProduct
Index of string descriptor describing product.
Definition: libusb.h:525
Delay from the time a host transmits a packet to the time it is received by the device.
Definition: libusb.h:402
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:1813
Set the log message verbosity.
Definition: libusb.h:2048
libusb_bos_type
USB capability types.
Definition: libusb.h:1033
uint8_t dev_capability_data[ZERO_SIZED_ARRAY]
Device Capability data (bLength - 3 bytes)
Definition: libusb.h:741
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:1961
uint8_t bLength
Size of this descriptor (in bytes)
Definition: libusb.h:844
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:876
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:756
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:2769
libusb_capability
Capabilities supported by an instance of libusb on the current running platform.
Definition: libusb.h:1267
libusb_transfer_type
Endpoint transfer type.
Definition: libusb.h:340
int libusb_submit_transfer(struct libusb_transfer *transfer)
Submit a transfer.
Definition: io.c:1487
Select an alternate interface for the specified interface.
Definition: libusb.h:392
int extra_length
Length of the extra descriptors, in bytes.
Definition: libusb.h:691
int libusb_clear_halt(libusb_device_handle *dev_handle, unsigned char endpoint)
Clear the halt/stall condition for an endpoint.
Definition: core.c:1816
uint32_t bmAttributes
Bitmap encoding of supported device level features.
Definition: libusb.h:792
uint16_t wBytesPerInterval
The total number of bytes this EP will transfer every service interval.
Definition: libusb.h:723
uint8_t iConfiguration
Index of string descriptor describing this configuration.
Definition: libusb.h:671
unsigned int length
Length of data to request in this packet.
Definition: libusb.h:1182
const unsigned char * extra
Extra descriptors.
Definition: libusb.h:628
uint8_t bAlternateSetting
Value used to select this alternate setting for this interface.
Definition: libusb.h:602
Implicit feedback Data endpoint.
Definition: libusb.h:477
libusb_log_level
Log message levels.
Definition: libusb.h:1290
Device sent more data than requested.
Definition: libusb.h:1128
Pipe error.
Definition: libusb.h:1083
Request status of the specific recipient.
Definition: libusb.h:361
libusb_device * libusb_get_device(libusb_device_handle *dev_handle)
Get the underlying device for a device handle.
Definition: core.c:1549
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:1875
Vendor.
Definition: libusb.h:417
Communications class.
Definition: libusb.h:205
int libusb_get_ss_usb_device_capability_descriptor(struct 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:1026
unsigned char endpoint
Address of the endpoint where this transfer will be sent.
Definition: libusb.h:1218
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:894
uint8_t bInterfaceProtocol
USB-IF protocol code for this interface, qualified by the bInterfaceClass and bInterfaceSubClass valu...
Definition: libusb.h:617
Automatically free() transfer buffer during libusb_free_transfer().
Definition: libusb.h:1144
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:730
uint16_t bcdUSB
USB specification release number in binary-coded decimal.
Definition: libusb.h:496
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:1776
Structure providing the version of the libusb runtime.
Definition: libusb.h:902
Device descriptor.
Definition: libusb.h:258
uint8_t bMaxBurst
The maximum number of packets the endpoint can send or receive as part of a burst.
Definition: libusb.h:713
uint16_t wSpeedSupported
Bitmap encoding of the speed supported by this device when operating in SuperSpeed mode...
Definition: libusb.h:822
Set or enable a specific feature.
Definition: libusb.h:369
Set device configuration.
Definition: libusb.h:386
const struct libusb_endpoint_descriptor * endpoint
Array of endpoint descriptors.
Definition: libusb.h:624
int libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *path, uint8_t path_length)
Deprecated please use libusb_get_port_numbers instead.
Definition: core.c:958
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:102
int libusb_release_interface(libusb_device_handle *dev_handle, int interface_number)
Release an interface previously claimed with libusb_claim_interface().
Definition: core.c:1731
#define LIBUSB_CALL
libusb's Windows calling convention.
Definition: libusb.h:129
Isochronous endpoint.
Definition: libusb.h:345
int libusb_init(libusb_context **ctx)
Initialize libusb.
Definition: core.c:2254
Isochronous packet descriptor.
Definition: libusb.h:1180
uint8_t bDescriptorType
Descriptor type.
Definition: libusb.h:708
const char * rc
Library release candidate suffix string, e.g.
Definition: libusb.h:916
void libusb_hotplug_deregister_callback(libusb_context *ctx, libusb_hotplug_callback_handle callback_handle)
Deregisters a hotplug callback.
Definition: hotplug.c:322
Set then report an endpoint's synchronization frame.
Definition: libusb.h:395
Hotplug support is available on this platform.
Definition: libusb.h:1271
uint8_t MaxPower
Maximum power consumption of the USB device from this bus in this configuration when the device is fu...
Definition: libusb.h:680
void libusb_set_debug(libusb_context *ctx, int level)
Definition: core.c:2107
HID report descriptor.
Definition: libusb.h:282
unsigned char type
Type of the endpoint from libusb_transfer_type.
Definition: libusb.h:1221
Callback function handling all log mesages.
Definition: libusb.h:1305
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:1463
Supports Link Power Management (LPM)
Definition: libusb.h:1017
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:1045
uint8_t bRefresh
For audio devices only: the rate at which synchronization feedback is provided.
Definition: libusb.h:571
In the context of a device descriptor, this bDeviceClass value indicates that each interface specifie...
Definition: libusb.h:199