1df4b8c2aSAndrew Thompson /* $FreeBSD$ */ 2df4b8c2aSAndrew Thompson /*- 34594d907SAndrew Thompson * Copyright (c) 2008-2009 Hans Petter Selasky. All rights reserved. 4df4b8c2aSAndrew Thompson * Copyright (c) 2007-2008 Daniel Drake. All rights reserved. 5df4b8c2aSAndrew Thompson * Copyright (c) 2001 Johannes Erdfelt. All rights reserved. 6df4b8c2aSAndrew Thompson * 7df4b8c2aSAndrew Thompson * Redistribution and use in source and binary forms, with or without 8df4b8c2aSAndrew Thompson * modification, are permitted provided that the following conditions 9df4b8c2aSAndrew Thompson * are met: 10df4b8c2aSAndrew Thompson * 1. Redistributions of source code must retain the above copyright 11df4b8c2aSAndrew Thompson * notice, this list of conditions and the following disclaimer. 12df4b8c2aSAndrew Thompson * 2. Redistributions in binary form must reproduce the above copyright 13df4b8c2aSAndrew Thompson * notice, this list of conditions and the following disclaimer in the 14df4b8c2aSAndrew Thompson * documentation and/or other materials provided with the distribution. 15df4b8c2aSAndrew Thompson * 16df4b8c2aSAndrew Thompson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17df4b8c2aSAndrew Thompson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18df4b8c2aSAndrew Thompson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19df4b8c2aSAndrew Thompson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20df4b8c2aSAndrew Thompson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21df4b8c2aSAndrew Thompson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22df4b8c2aSAndrew Thompson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23df4b8c2aSAndrew Thompson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24df4b8c2aSAndrew Thompson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25df4b8c2aSAndrew Thompson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26df4b8c2aSAndrew Thompson * SUCH DAMAGE. 27df4b8c2aSAndrew Thompson */ 28df4b8c2aSAndrew Thompson 29df4b8c2aSAndrew Thompson #ifndef _LIBUSB20_H_ 30df4b8c2aSAndrew Thompson #define _LIBUSB20_H_ 31df4b8c2aSAndrew Thompson 32df4b8c2aSAndrew Thompson #include <stdint.h> 33df4b8c2aSAndrew Thompson #include <time.h> 34df4b8c2aSAndrew Thompson #include <string.h> 35df4b8c2aSAndrew Thompson 36df4b8c2aSAndrew Thompson #include <sys/time.h> 37df4b8c2aSAndrew Thompson #include <sys/types.h> 38df4b8c2aSAndrew Thompson #include <sys/endian.h> 39df4b8c2aSAndrew Thompson 40df4b8c2aSAndrew Thompson #ifdef __cplusplus 41df4b8c2aSAndrew Thompson extern "C" { 42df4b8c2aSAndrew Thompson #endif 43df4b8c2aSAndrew Thompson #if 0 44df4b8c2aSAndrew Thompson }; /* style */ 45df4b8c2aSAndrew Thompson 46df4b8c2aSAndrew Thompson #endif 47df4b8c2aSAndrew Thompson 48df4b8c2aSAndrew Thompson /** \ingroup misc 49df4b8c2aSAndrew Thompson * Error codes. Most libusb20 functions return 0 on success or one of 50df4b8c2aSAndrew Thompson * these codes on failure. 51df4b8c2aSAndrew Thompson */ 52df4b8c2aSAndrew Thompson enum libusb20_error { 53df4b8c2aSAndrew Thompson /** Success (no error) */ 54df4b8c2aSAndrew Thompson LIBUSB20_SUCCESS = 0, 55df4b8c2aSAndrew Thompson 56df4b8c2aSAndrew Thompson /** Input/output error */ 57df4b8c2aSAndrew Thompson LIBUSB20_ERROR_IO = -1, 58df4b8c2aSAndrew Thompson 59df4b8c2aSAndrew Thompson /** Invalid parameter */ 60df4b8c2aSAndrew Thompson LIBUSB20_ERROR_INVALID_PARAM = -2, 61df4b8c2aSAndrew Thompson 62df4b8c2aSAndrew Thompson /** Access denied (insufficient permissions) */ 63df4b8c2aSAndrew Thompson LIBUSB20_ERROR_ACCESS = -3, 64df4b8c2aSAndrew Thompson 65df4b8c2aSAndrew Thompson /** No such device (it may have been disconnected) */ 66df4b8c2aSAndrew Thompson LIBUSB20_ERROR_NO_DEVICE = -4, 67df4b8c2aSAndrew Thompson 68df4b8c2aSAndrew Thompson /** Entity not found */ 69df4b8c2aSAndrew Thompson LIBUSB20_ERROR_NOT_FOUND = -5, 70df4b8c2aSAndrew Thompson 71df4b8c2aSAndrew Thompson /** Resource busy */ 72df4b8c2aSAndrew Thompson LIBUSB20_ERROR_BUSY = -6, 73df4b8c2aSAndrew Thompson 74df4b8c2aSAndrew Thompson /** Operation timed out */ 75df4b8c2aSAndrew Thompson LIBUSB20_ERROR_TIMEOUT = -7, 76df4b8c2aSAndrew Thompson 77df4b8c2aSAndrew Thompson /** Overflow */ 78df4b8c2aSAndrew Thompson LIBUSB20_ERROR_OVERFLOW = -8, 79df4b8c2aSAndrew Thompson 80df4b8c2aSAndrew Thompson /** Pipe error */ 81df4b8c2aSAndrew Thompson LIBUSB20_ERROR_PIPE = -9, 82df4b8c2aSAndrew Thompson 83df4b8c2aSAndrew Thompson /** System call interrupted (perhaps due to signal) */ 84df4b8c2aSAndrew Thompson LIBUSB20_ERROR_INTERRUPTED = -10, 85df4b8c2aSAndrew Thompson 86df4b8c2aSAndrew Thompson /** Insufficient memory */ 87df4b8c2aSAndrew Thompson LIBUSB20_ERROR_NO_MEM = -11, 88df4b8c2aSAndrew Thompson 89df4b8c2aSAndrew Thompson /** Operation not supported or unimplemented on this platform */ 90df4b8c2aSAndrew Thompson LIBUSB20_ERROR_NOT_SUPPORTED = -12, 91df4b8c2aSAndrew Thompson 92df4b8c2aSAndrew Thompson /** Other error */ 93df4b8c2aSAndrew Thompson LIBUSB20_ERROR_OTHER = -99, 94df4b8c2aSAndrew Thompson }; 95df4b8c2aSAndrew Thompson 96df4b8c2aSAndrew Thompson /** \ingroup asyncio 97df4b8c2aSAndrew Thompson * libusb20_tr_get_status() values */ 98df4b8c2aSAndrew Thompson enum libusb20_transfer_status { 99df4b8c2aSAndrew Thompson /** Transfer completed without error. Note that this does not 100df4b8c2aSAndrew Thompson * indicate that the entire amount of requested data was 101df4b8c2aSAndrew Thompson * transferred. */ 102df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_COMPLETED, 103df4b8c2aSAndrew Thompson 104df4b8c2aSAndrew Thompson /** Callback code to start transfer */ 105df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_START, 106df4b8c2aSAndrew Thompson 107df4b8c2aSAndrew Thompson /** Drain complete callback code */ 108df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_DRAINED, 109df4b8c2aSAndrew Thompson 110df4b8c2aSAndrew Thompson /** Transfer failed */ 111df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_ERROR, 112df4b8c2aSAndrew Thompson 113df4b8c2aSAndrew Thompson /** Transfer timed out */ 114df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_TIMED_OUT, 115df4b8c2aSAndrew Thompson 116df4b8c2aSAndrew Thompson /** Transfer was cancelled */ 117df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_CANCELLED, 118df4b8c2aSAndrew Thompson 119df4b8c2aSAndrew Thompson /** For bulk/interrupt endpoints: halt condition detected 120df4b8c2aSAndrew Thompson * (endpoint stalled). For control endpoints: control request 121df4b8c2aSAndrew Thompson * not supported. */ 122df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_STALL, 123df4b8c2aSAndrew Thompson 124df4b8c2aSAndrew Thompson /** Device was disconnected */ 125df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_NO_DEVICE, 126df4b8c2aSAndrew Thompson 127df4b8c2aSAndrew Thompson /** Device sent more data than requested */ 128df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_OVERFLOW, 129df4b8c2aSAndrew Thompson }; 130df4b8c2aSAndrew Thompson 131df4b8c2aSAndrew Thompson /** \ingroup asyncio 132df4b8c2aSAndrew Thompson * libusb20_tr_set_flags() values */ 133df4b8c2aSAndrew Thompson enum libusb20_transfer_flags { 134df4b8c2aSAndrew Thompson /** Report a short frame as error */ 135df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK = 0x0001, 136df4b8c2aSAndrew Thompson 137df4b8c2aSAndrew Thompson /** Multiple short frames are not allowed */ 138df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_MULTI_SHORT_NOT_OK = 0x0002, 139df4b8c2aSAndrew Thompson 140df4b8c2aSAndrew Thompson /** All transmitted frames are short terminated */ 141df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_FORCE_SHORT = 0x0004, 142df4b8c2aSAndrew Thompson 143df4b8c2aSAndrew Thompson /** Will do a clear-stall before xfer */ 144df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_DO_CLEAR_STALL = 0x0008, 145df4b8c2aSAndrew Thompson }; 146df4b8c2aSAndrew Thompson 147df4b8c2aSAndrew Thompson /** \ingroup misc 148df4b8c2aSAndrew Thompson * libusb20_dev_get_mode() values 149df4b8c2aSAndrew Thompson */ 150df4b8c2aSAndrew Thompson enum libusb20_device_mode { 151df4b8c2aSAndrew Thompson LIBUSB20_MODE_HOST, /* default */ 152df4b8c2aSAndrew Thompson LIBUSB20_MODE_DEVICE, 153df4b8c2aSAndrew Thompson }; 154df4b8c2aSAndrew Thompson 155df4b8c2aSAndrew Thompson /** \ingroup misc 156df4b8c2aSAndrew Thompson * libusb20_dev_get_speed() values 157df4b8c2aSAndrew Thompson */ 158df4b8c2aSAndrew Thompson enum { 159df4b8c2aSAndrew Thompson LIBUSB20_SPEED_UNKNOWN, /* default */ 160df4b8c2aSAndrew Thompson LIBUSB20_SPEED_LOW, 161df4b8c2aSAndrew Thompson LIBUSB20_SPEED_FULL, 162df4b8c2aSAndrew Thompson LIBUSB20_SPEED_HIGH, 163df4b8c2aSAndrew Thompson LIBUSB20_SPEED_VARIABLE, 164df4b8c2aSAndrew Thompson LIBUSB20_SPEED_SUPER, 165df4b8c2aSAndrew Thompson }; 166df4b8c2aSAndrew Thompson 167df4b8c2aSAndrew Thompson /** \ingroup misc 168df4b8c2aSAndrew Thompson * libusb20_dev_set_power() values 169df4b8c2aSAndrew Thompson */ 170df4b8c2aSAndrew Thompson enum { 171df4b8c2aSAndrew Thompson LIBUSB20_POWER_OFF, 172df4b8c2aSAndrew Thompson LIBUSB20_POWER_ON, 173df4b8c2aSAndrew Thompson LIBUSB20_POWER_SAVE, 174df4b8c2aSAndrew Thompson LIBUSB20_POWER_SUSPEND, 175df4b8c2aSAndrew Thompson LIBUSB20_POWER_RESUME, 176df4b8c2aSAndrew Thompson }; 177df4b8c2aSAndrew Thompson 178760bc48eSAndrew Thompson struct usb_device_info; 179df4b8c2aSAndrew Thompson struct libusb20_transfer; 180df4b8c2aSAndrew Thompson struct libusb20_backend; 181df4b8c2aSAndrew Thompson struct libusb20_backend_methods; 182df4b8c2aSAndrew Thompson struct libusb20_device; 183df4b8c2aSAndrew Thompson struct libusb20_device_methods; 184df4b8c2aSAndrew Thompson struct libusb20_config; 185df4b8c2aSAndrew Thompson struct LIBUSB20_CONTROL_SETUP_DECODED; 186df4b8c2aSAndrew Thompson struct LIBUSB20_DEVICE_DESC_DECODED; 187df4b8c2aSAndrew Thompson 188df4b8c2aSAndrew Thompson typedef void (libusb20_tr_callback_t)(struct libusb20_transfer *xfer); 189df4b8c2aSAndrew Thompson 190df4b8c2aSAndrew Thompson struct libusb20_quirk { 191df4b8c2aSAndrew Thompson uint16_t vid; /* vendor ID */ 192df4b8c2aSAndrew Thompson uint16_t pid; /* product ID */ 193df4b8c2aSAndrew Thompson uint16_t bcdDeviceLow; /* low revision value, inclusive */ 194df4b8c2aSAndrew Thompson uint16_t bcdDeviceHigh; /* high revision value, inclusive */ 195df4b8c2aSAndrew Thompson uint16_t reserved[2]; /* for the future */ 196df4b8c2aSAndrew Thompson /* quirk name, UQ_XXX, including terminating zero */ 197df4b8c2aSAndrew Thompson char quirkname[64 - 12]; 198df4b8c2aSAndrew Thompson }; 199df4b8c2aSAndrew Thompson 200df4b8c2aSAndrew Thompson /* USB transfer operations */ 201df4b8c2aSAndrew Thompson 202df4b8c2aSAndrew Thompson int libusb20_tr_close(struct libusb20_transfer *xfer); 203df4b8c2aSAndrew Thompson int libusb20_tr_open(struct libusb20_transfer *xfer, uint32_t max_buf_size, uint32_t max_frame_count, uint8_t ep_no); 204df4b8c2aSAndrew Thompson struct libusb20_transfer *libusb20_tr_get_pointer(struct libusb20_device *pdev, uint16_t tr_index); 205df4b8c2aSAndrew Thompson uint16_t libusb20_tr_get_time_complete(struct libusb20_transfer *xfer); 206df4b8c2aSAndrew Thompson uint32_t libusb20_tr_get_actual_frames(struct libusb20_transfer *xfer); 207df4b8c2aSAndrew Thompson uint32_t libusb20_tr_get_actual_length(struct libusb20_transfer *xfer); 208df4b8c2aSAndrew Thompson uint32_t libusb20_tr_get_max_frames(struct libusb20_transfer *xfer); 209df4b8c2aSAndrew Thompson uint32_t libusb20_tr_get_max_packet_length(struct libusb20_transfer *xfer); 210df4b8c2aSAndrew Thompson uint32_t libusb20_tr_get_max_total_length(struct libusb20_transfer *xfer); 211df4b8c2aSAndrew Thompson uint8_t libusb20_tr_get_status(struct libusb20_transfer *xfer); 212df4b8c2aSAndrew Thompson uint8_t libusb20_tr_pending(struct libusb20_transfer *xfer); 213df4b8c2aSAndrew Thompson void libusb20_tr_callback_wrapper(struct libusb20_transfer *xfer); 214df4b8c2aSAndrew Thompson void libusb20_tr_clear_stall_sync(struct libusb20_transfer *xfer); 215df4b8c2aSAndrew Thompson void libusb20_tr_drain(struct libusb20_transfer *xfer); 216df4b8c2aSAndrew Thompson void libusb20_tr_set_buffer(struct libusb20_transfer *xfer, void *buffer, uint16_t fr_index); 217df4b8c2aSAndrew Thompson void libusb20_tr_set_callback(struct libusb20_transfer *xfer, libusb20_tr_callback_t *cb); 218df4b8c2aSAndrew Thompson void libusb20_tr_set_flags(struct libusb20_transfer *xfer, uint8_t flags); 219545b01adSAndrew Thompson uint32_t libusb20_tr_get_length(struct libusb20_transfer *xfer, uint16_t fr_index); 220df4b8c2aSAndrew Thompson void libusb20_tr_set_length(struct libusb20_transfer *xfer, uint32_t length, uint16_t fr_index); 221df4b8c2aSAndrew Thompson void libusb20_tr_set_priv_sc0(struct libusb20_transfer *xfer, void *sc0); 222df4b8c2aSAndrew Thompson void libusb20_tr_set_priv_sc1(struct libusb20_transfer *xfer, void *sc1); 223df4b8c2aSAndrew Thompson void libusb20_tr_set_timeout(struct libusb20_transfer *xfer, uint32_t timeout); 224df4b8c2aSAndrew Thompson void libusb20_tr_set_total_frames(struct libusb20_transfer *xfer, uint32_t nFrames); 225df4b8c2aSAndrew Thompson void libusb20_tr_setup_bulk(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint32_t timeout); 226df4b8c2aSAndrew Thompson void libusb20_tr_setup_control(struct libusb20_transfer *xfer, void *psetup, void *pbuf, uint32_t timeout); 227df4b8c2aSAndrew Thompson void libusb20_tr_setup_intr(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint32_t timeout); 228df4b8c2aSAndrew Thompson void libusb20_tr_setup_isoc(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint16_t fr_index); 2294594d907SAndrew Thompson uint8_t libusb20_tr_bulk_intr_sync(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint32_t *pactlen, uint32_t timeout); 230df4b8c2aSAndrew Thompson void libusb20_tr_start(struct libusb20_transfer *xfer); 231df4b8c2aSAndrew Thompson void libusb20_tr_stop(struct libusb20_transfer *xfer); 232df4b8c2aSAndrew Thompson void libusb20_tr_submit(struct libusb20_transfer *xfer); 233df4b8c2aSAndrew Thompson void *libusb20_tr_get_priv_sc0(struct libusb20_transfer *xfer); 234df4b8c2aSAndrew Thompson void *libusb20_tr_get_priv_sc1(struct libusb20_transfer *xfer); 235df4b8c2aSAndrew Thompson 236df4b8c2aSAndrew Thompson 237df4b8c2aSAndrew Thompson /* USB device operations */ 238df4b8c2aSAndrew Thompson 239df4b8c2aSAndrew Thompson const char *libusb20_dev_get_backend_name(struct libusb20_device *pdev); 240df4b8c2aSAndrew Thompson const char *libusb20_dev_get_desc(struct libusb20_device *pdev); 241df4b8c2aSAndrew Thompson int libusb20_dev_close(struct libusb20_device *pdev); 242df4b8c2aSAndrew Thompson int libusb20_dev_detach_kernel_driver(struct libusb20_device *pdev, uint8_t iface_index); 243df4b8c2aSAndrew Thompson int libusb20_dev_set_config_index(struct libusb20_device *pdev, uint8_t configIndex); 244df4b8c2aSAndrew Thompson int libusb20_dev_get_debug(struct libusb20_device *pdev); 245df4b8c2aSAndrew Thompson int libusb20_dev_get_fd(struct libusb20_device *pdev); 246df4b8c2aSAndrew Thompson int libusb20_dev_kernel_driver_active(struct libusb20_device *pdev, uint8_t iface_index); 247df4b8c2aSAndrew Thompson int libusb20_dev_open(struct libusb20_device *pdev, uint16_t transfer_max); 248df4b8c2aSAndrew Thompson int libusb20_dev_process(struct libusb20_device *pdev); 249df4b8c2aSAndrew Thompson int libusb20_dev_request_sync(struct libusb20_device *pdev, struct LIBUSB20_CONTROL_SETUP_DECODED *setup, void *data, uint16_t *pactlen, uint32_t timeout, uint8_t flags); 250df4b8c2aSAndrew Thompson int libusb20_dev_req_string_sync(struct libusb20_device *pdev, uint8_t index, uint16_t langid, void *ptr, uint16_t len); 251df4b8c2aSAndrew Thompson int libusb20_dev_req_string_simple_sync(struct libusb20_device *pdev, uint8_t index, void *ptr, uint16_t len); 252df4b8c2aSAndrew Thompson int libusb20_dev_reset(struct libusb20_device *pdev); 253df4b8c2aSAndrew Thompson int libusb20_dev_set_power_mode(struct libusb20_device *pdev, uint8_t power_mode); 254df4b8c2aSAndrew Thompson uint8_t libusb20_dev_get_power_mode(struct libusb20_device *pdev); 255df4b8c2aSAndrew Thompson int libusb20_dev_set_alt_index(struct libusb20_device *pdev, uint8_t iface_index, uint8_t alt_index); 256760bc48eSAndrew Thompson int libusb20_dev_get_info(struct libusb20_device *pdev, struct usb_device_info *pinfo); 257df4b8c2aSAndrew Thompson int libusb20_dev_get_iface_desc(struct libusb20_device *pdev, uint8_t iface_index, char *buf, uint8_t len); 258df4b8c2aSAndrew Thompson 259df4b8c2aSAndrew Thompson struct LIBUSB20_DEVICE_DESC_DECODED *libusb20_dev_get_device_desc(struct libusb20_device *pdev); 260df4b8c2aSAndrew Thompson struct libusb20_config *libusb20_dev_alloc_config(struct libusb20_device *pdev, uint8_t config_index); 261df4b8c2aSAndrew Thompson struct libusb20_device *libusb20_dev_alloc(void); 262df4b8c2aSAndrew Thompson uint8_t libusb20_dev_get_address(struct libusb20_device *pdev); 263df4b8c2aSAndrew Thompson uint8_t libusb20_dev_get_bus_number(struct libusb20_device *pdev); 264df4b8c2aSAndrew Thompson uint8_t libusb20_dev_get_mode(struct libusb20_device *pdev); 265df4b8c2aSAndrew Thompson uint8_t libusb20_dev_get_speed(struct libusb20_device *pdev); 266df4b8c2aSAndrew Thompson uint8_t libusb20_dev_get_config_index(struct libusb20_device *pdev); 267df4b8c2aSAndrew Thompson void libusb20_dev_free(struct libusb20_device *pdev); 268df4b8c2aSAndrew Thompson void libusb20_dev_set_debug(struct libusb20_device *pdev, int debug); 269df4b8c2aSAndrew Thompson void libusb20_dev_wait_process(struct libusb20_device *pdev, int timeout); 270df4b8c2aSAndrew Thompson 271df4b8c2aSAndrew Thompson /* USB global operations */ 272df4b8c2aSAndrew Thompson 273df4b8c2aSAndrew Thompson int libusb20_be_get_dev_quirk(struct libusb20_backend *pbe, uint16_t index, struct libusb20_quirk *pq); 274df4b8c2aSAndrew Thompson int libusb20_be_get_quirk_name(struct libusb20_backend *pbe, uint16_t index, struct libusb20_quirk *pq); 275df4b8c2aSAndrew Thompson int libusb20_be_add_dev_quirk(struct libusb20_backend *pbe, struct libusb20_quirk *pq); 276df4b8c2aSAndrew Thompson int libusb20_be_remove_dev_quirk(struct libusb20_backend *pbe, struct libusb20_quirk *pq); 27738d3e5feSXin LI int libusb20_be_get_template(struct libusb20_backend *pbe, int *ptemp); 27838d3e5feSXin LI int libusb20_be_set_template(struct libusb20_backend *pbe, int temp); 279df4b8c2aSAndrew Thompson 280df4b8c2aSAndrew Thompson /* USB backend operations */ 281df4b8c2aSAndrew Thompson 282df4b8c2aSAndrew Thompson struct libusb20_backend *libusb20_be_alloc(const struct libusb20_backend_methods *methods); 283df4b8c2aSAndrew Thompson struct libusb20_backend *libusb20_be_alloc_default(void); 284df4b8c2aSAndrew Thompson struct libusb20_backend *libusb20_be_alloc_freebsd(void); 285df4b8c2aSAndrew Thompson struct libusb20_backend *libusb20_be_alloc_linux(void); 286df4b8c2aSAndrew Thompson struct libusb20_backend *libusb20_be_alloc_ugen20(void); 287df4b8c2aSAndrew Thompson struct libusb20_device *libusb20_be_device_foreach(struct libusb20_backend *pbe, struct libusb20_device *pdev); 288df4b8c2aSAndrew Thompson void libusb20_be_dequeue_device(struct libusb20_backend *pbe, struct libusb20_device *pdev); 289df4b8c2aSAndrew Thompson void libusb20_be_enqueue_device(struct libusb20_backend *pbe, struct libusb20_device *pdev); 290df4b8c2aSAndrew Thompson void libusb20_be_free(struct libusb20_backend *pbe); 291df4b8c2aSAndrew Thompson 292df4b8c2aSAndrew Thompson #if 0 293df4b8c2aSAndrew Thompson { /* style */ 294df4b8c2aSAndrew Thompson #endif 295df4b8c2aSAndrew Thompson #ifdef __cplusplus 296df4b8c2aSAndrew Thompson } 297df4b8c2aSAndrew Thompson 298df4b8c2aSAndrew Thompson #endif 299df4b8c2aSAndrew Thompson 300df4b8c2aSAndrew Thompson #endif /* _LIBUSB20_H_ */ 301