26 #include <sys/types.h>
42 #define libusb_cpu_to_le16(x) ({ \
47 uint16_t _tmp2 = (uint16_t)(x); \
48 _tmp.b8[1] = _tmp2 >> 8; \
49 _tmp.b8[0] = _tmp2 & 0xff; \
61 #define libusb_le16_to_cpu libusb_cpu_to_le16
140 #define LIBUSB_DT_DEVICE_SIZE 18
141 #define LIBUSB_DT_CONFIG_SIZE 9
142 #define LIBUSB_DT_INTERFACE_SIZE 9
143 #define LIBUSB_DT_ENDPOINT_SIZE 7
144 #define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9
145 #define LIBUSB_DT_HUB_NONVAR_SIZE 7
147 #define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f
148 #define LIBUSB_ENDPOINT_DIR_MASK 0x80
162 #define LIBUSB_TRANSFER_TYPE_MASK 0x03
259 #define LIBUSB_ISO_SYNC_TYPE_MASK 0x0C
280 #define LIBUSB_ISO_USAGE_TYPE_MASK 0x30
538 #define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
766 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
808 uint16_t vendor_id, uint16_t product_id);
811 int interface_number,
int alternate_setting);
833 static inline unsigned char *libusb_control_transfer_get_data(
879 static inline void libusb_fill_control_setup(
unsigned char *buffer,
923 static inline void libusb_fill_control_transfer(
933 transfer->
buffer = buffer;
954 static inline void libusb_fill_bulk_transfer(
struct libusb_transfer *transfer,
957 void *user_data,
unsigned int timeout)
963 transfer->
buffer = buffer;
964 transfer->
length = length;
982 static inline void libusb_fill_interrupt_transfer(
984 unsigned char endpoint,
unsigned char *buffer,
int length,
991 transfer->
buffer = buffer;
992 transfer->
length = length;
1011 static inline void libusb_fill_iso_transfer(
struct libusb_transfer *transfer,
1013 unsigned char *buffer,
int length,
int num_iso_packets,
1020 transfer->
buffer = buffer;
1021 transfer->
length = length;
1035 static inline void libusb_set_iso_packet_lengths(
1059 static inline unsigned char *libusb_get_iso_packet_buffer(
1069 if (packet > INT_MAX)
1076 for (i = 0; i < _packet; i++)
1079 return transfer->
buffer + offset;
1101 static inline unsigned char *libusb_get_iso_packet_buffer_simple(
1109 if (packet > INT_MAX)
1122 uint8_t request_type, uint8_t request, uint16_t value, uint16_t index,
1123 unsigned char *data, uint16_t length,
unsigned int timeout);
1126 unsigned char endpoint,
unsigned char *data,
int length,
1127 int *actual_length,
unsigned int timeout);
1130 unsigned char endpoint,
unsigned char *data,
int length,
1131 int *actual_length,
unsigned int timeout);
1146 uint8_t desc_type, uint8_t desc_index,
unsigned char *data,
int length)
1168 uint8_t desc_index, uint16_t langid,
unsigned char *data,
int length)
1172 langid, data, length, 1000);
1176 uint8_t index,
unsigned char *data,
int length);
int libusb_wait_for_event(libusb_context *ctx, struct timeval *tv)
int libusb_clear_halt(libusb_device_handle *dev, unsigned char endpoint)
uint8_t bConfigurationValue
void(* libusb_pollfd_removed_cb)(int fd, void *user_data)
int libusb_handle_events(libusb_context *ctx)
struct libusb_device libusb_device
void(* libusb_pollfd_added_cb)(int fd, short events, void *user_data)
int libusb_get_device_descriptor(libusb_device *dev, struct libusb_device_descriptor *desc)
int libusb_set_configuration(libusb_device_handle *dev, int configuration)
void(* libusb_transfer_cb_fn)(struct libusb_transfer *transfer)
struct libusb_device_handle libusb_device_handle
int libusb_get_max_iso_packet_size(libusb_device *dev, unsigned char endpoint)
int libusb_reset_device(libusb_device_handle *dev)
int libusb_detach_kernel_driver(libusb_device_handle *dev, int interface)
uint8_t bNumConfigurations
int libusb_release_interface(libusb_device_handle *dev, int iface)
libusb_transfer_cb_fn callback
libusb_device * libusb_get_device(libusb_device_handle *dev_handle)
#define libusb_le16_to_cpu
int libusb_get_string_descriptor_ascii(libusb_device_handle *dev, uint8_t index, unsigned char *data, int length)
int libusb_handle_events_locked(libusb_context *ctx, struct timeval *tv)
int libusb_get_active_config_descriptor(libusb_device *dev, struct libusb_config_descriptor **config)
void libusb_free_device_list(libusb_device **list, int unref_devices)
int libusb_kernel_driver_active(libusb_device_handle *dev, int interface)
enum libusb_transfer_status status
int libusb_get_config_descriptor_by_value(libusb_device *dev, uint8_t bConfigurationValue, struct libusb_config_descriptor **config)
uint8_t bInterfaceSubClass
const struct libusb_interface * interface
int libusb_event_handler_active(libusb_context *ctx)
int libusb_get_max_packet_size(libusb_device *dev, unsigned char endpoint)
void libusb_lock_events(libusb_context *ctx)
int libusb_open(libusb_device *dev, libusb_device_handle **handle)
uint8_t bInterfaceProtocol
int libusb_get_config_descriptor(libusb_device *dev, uint8_t config_index, struct libusb_config_descriptor **config)
struct libusb_transfer * libusb_alloc_transfer(int iso_packets)
void libusb_unref_device(libusb_device *dev)
int libusb_get_configuration(libusb_device_handle *dev, int *config)
void libusb_close(libusb_device_handle *dev_handle)
void libusb_unlock_event_waiters(libusb_context *ctx)
int libusb_pollfds_handle_timeouts(libusb_context *ctx)
const unsigned char * extra
struct libusb_context libusb_context
#define libusb_cpu_to_le16(x)
uint8_t libusb_get_device_address(libusb_device *dev)
libusb_device * libusb_ref_device(libusb_device *dev)
void libusb_set_debug(libusb_context *ctx, int level)
void libusb_free_transfer(struct libusb_transfer *transfer)
uint8_t libusb_get_bus_number(libusb_device *dev)
void libusb_free_config_descriptor(struct libusb_config_descriptor *config)
void libusb_set_pollfd_notifiers(libusb_context *ctx, libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb, void *user_data)
int libusb_control_transfer(libusb_device_handle *dev_handle, uint8_t request_type, uint8_t request, uint16_t value, uint16_t index, unsigned char *data, uint16_t length, unsigned int timeout)
void libusb_lock_event_waiters(libusb_context *ctx)
int libusb_interrupt_transfer(libusb_device_handle *dev_handle, unsigned char endpoint, unsigned char *data, int length, int *actual_length, unsigned int timeout)
void libusb_unlock_events(libusb_context *ctx)
int libusb_handle_events_timeout(libusb_context *ctx, struct timeval *tv)
enum libusb_transfer_status status
libusb_device_handle * dev_handle
ssize_t libusb_get_device_list(libusb_context *ctx, libusb_device ***list)
const unsigned char * extra
const struct libusb_endpoint_descriptor * endpoint
const struct libusb_interface_descriptor * altsetting
struct libusb_iso_packet_descriptor iso_packet_desc[0]
libusb_device_handle * libusb_open_device_with_vid_pid(libusb_context *ctx, uint16_t vendor_id, uint16_t product_id)
int libusb_submit_transfer(struct libusb_transfer *transfer)
const struct libusb_pollfd ** libusb_get_pollfds(libusb_context *ctx)
unsigned int actual_length
const unsigned char * extra
int libusb_attach_kernel_driver(libusb_device_handle *dev, int interface)
int libusb_cancel_transfer(struct libusb_transfer *transfer)
libusb_endpoint_direction
int libusb_bulk_transfer(libusb_device_handle *dev_handle, unsigned char endpoint, unsigned char *data, int length, int *actual_length, unsigned int timeout)
int libusb_try_lock_events(libusb_context *ctx)
int libusb_init(libusb_context **ctx)
int libusb_claim_interface(libusb_device_handle *dev, int iface)
int libusb_get_next_timeout(libusb_context *ctx, struct timeval *tv)
int libusb_event_handling_ok(libusb_context *ctx)
#define LIBUSB_CONTROL_SETUP_SIZE
int libusb_set_interface_alt_setting(libusb_device_handle *dev, int interface_number, int alternate_setting)
void libusb_exit(libusb_context *ctx)
uint8_t bAlternateSetting