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__)
69 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
71 #if defined(interface)
74 #if !defined(__CYGWIN__)
79 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
80 #define LIBUSB_DEPRECATED_FOR(f) \
81 __attribute__((deprecated("Use " #f " instead")))
83 #define LIBUSB_DEPRECATED_FOR(f)
118 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
119 #define LIBUSB_CALL WINAPI
147 #define LIBUSBX_API_VERSION 0x01000102
161 static inline uint16_t libusb_cpu_to_le16(
const uint16_t x)
167 _tmp.b8[1] = (uint8_t) (x >> 8);
168 _tmp.b8[0] = (uint8_t) (x & 0xff);
180 #define libusb_le16_to_cpu libusb_cpu_to_le16
210 LIBUSB_CLASS_IMAGE = 6,
290 #define LIBUSB_DT_DEVICE_SIZE 18
291 #define LIBUSB_DT_CONFIG_SIZE 9
292 #define LIBUSB_DT_INTERFACE_SIZE 9
293 #define LIBUSB_DT_ENDPOINT_SIZE 7
294 #define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9
295 #define LIBUSB_DT_HUB_NONVAR_SIZE 7
296 #define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6
297 #define LIBUSB_DT_BOS_SIZE 5
298 #define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3
301 #define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7
302 #define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10
303 #define LIBUSB_BT_CONTAINER_ID_SIZE 20
306 #define LIBUSB_DT_BOS_MAX_SIZE ((LIBUSB_DT_BOS_SIZE) +\
307 (LIBUSB_BT_USB_2_0_EXTENSION_SIZE) +\
308 (LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE) +\
309 (LIBUSB_BT_CONTAINER_ID_SIZE))
311 #define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f
312 #define LIBUSB_ENDPOINT_DIR_MASK 0x80
326 #define LIBUSB_TRANSFER_TYPE_MASK 0x03
430 #define LIBUSB_ISO_SYNC_TYPE_MASK 0x0C
451 #define LIBUSB_ISO_USAGE_TYPE_MASK 0x30
729 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
760 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
890 #define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
897 struct libusb_hotplug_callback;
1099 #define LIBUSB_ERROR_COUNT 14
1254 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
1293 LIBUSB_LOG_LEVEL_NONE = 0,
1294 LIBUSB_LOG_LEVEL_ERROR,
1295 LIBUSB_LOG_LEVEL_WARNING,
1296 LIBUSB_LOG_LEVEL_INFO,
1297 LIBUSB_LOG_LEVEL_DEBUG,
1363 unsigned char endpoint);
1365 unsigned char endpoint);
1374 int interface_number);
1376 int interface_number);
1382 int interface_number,
int alternate_setting);
1384 unsigned char endpoint);
1388 int interface_number);
1390 int interface_number);
1392 int interface_number);
1413 return transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE;
1463 setup->
wValue = libusb_cpu_to_le16(wValue);
1464 setup->
wIndex = libusb_cpu_to_le16(wIndex);
1465 setup->
wLength = libusb_cpu_to_le16(wLength);
1510 transfer->
buffer = buffer;
1512 transfer->
length = (int) (LIBUSB_CONTROL_SETUP_SIZE
1534 void *user_data,
unsigned int timeout)
1540 transfer->
buffer = buffer;
1541 transfer->
length = length;
1561 unsigned char endpoint,
unsigned char *buffer,
int length,
1568 transfer->
buffer = buffer;
1569 transfer->
length = length;
1590 unsigned char *buffer,
int length,
int num_iso_packets,
1597 transfer->
buffer = buffer;
1598 transfer->
length = length;
1646 if (packet > INT_MAX)
1648 _packet = (int) packet;
1653 for (i = 0; i < _packet; i++)
1656 return transfer->
buffer + offset;
1686 if (packet > INT_MAX)
1688 _packet = (int) packet;
1700 unsigned char *data, uint16_t
wLength,
unsigned int timeout);
1703 unsigned char endpoint,
unsigned char *data,
int length,
1704 int *actual_length,
unsigned int timeout);
1707 unsigned char endpoint,
unsigned char *data,
int length,
1708 int *actual_length,
unsigned int timeout);
1723 uint8_t desc_type, uint8_t desc_index,
unsigned char *data,
int length)
1727 0, data, (uint16_t) length, 1000);
1745 uint8_t desc_index, uint16_t langid,
unsigned char *data,
int length)
1749 langid, data, (uint16_t) length, 1000);
1753 uint8_t desc_index,
unsigned char *data,
int length);
1767 struct timeval *tv);
1769 struct timeval *tv,
int *completed);
1773 struct timeval *tv);
1776 struct timeval *tv);
1863 #define LIBUSB_HOTPLUG_MATCH_ANY -1
1917 int vendor_id,
int product_id,
1921 libusb_hotplug_callback_handle *handle);
1935 libusb_hotplug_callback_handle handle);