1df4b8c2aSAndrew Thompson /* $FreeBSD$ */ 2df4b8c2aSAndrew Thompson /*- 3*5e53a4f9SPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 4*5e53a4f9SPedro F. Giffuni * 54594d907SAndrew Thompson * Copyright (c) 2008-2009 Hans Petter Selasky. All rights reserved. 6df4b8c2aSAndrew Thompson * Copyright (c) 2007-2008 Daniel Drake. All rights reserved. 7df4b8c2aSAndrew Thompson * Copyright (c) 2001 Johannes Erdfelt. All rights reserved. 8df4b8c2aSAndrew Thompson * 9df4b8c2aSAndrew Thompson * Redistribution and use in source and binary forms, with or without 10df4b8c2aSAndrew Thompson * modification, are permitted provided that the following conditions 11df4b8c2aSAndrew Thompson * are met: 12df4b8c2aSAndrew Thompson * 1. Redistributions of source code must retain the above copyright 13df4b8c2aSAndrew Thompson * notice, this list of conditions and the following disclaimer. 14df4b8c2aSAndrew Thompson * 2. Redistributions in binary form must reproduce the above copyright 15df4b8c2aSAndrew Thompson * notice, this list of conditions and the following disclaimer in the 16df4b8c2aSAndrew Thompson * documentation and/or other materials provided with the distribution. 17df4b8c2aSAndrew Thompson * 18df4b8c2aSAndrew Thompson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19df4b8c2aSAndrew Thompson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20df4b8c2aSAndrew Thompson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21df4b8c2aSAndrew Thompson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22df4b8c2aSAndrew Thompson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23df4b8c2aSAndrew Thompson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24df4b8c2aSAndrew Thompson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25df4b8c2aSAndrew Thompson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26df4b8c2aSAndrew Thompson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27df4b8c2aSAndrew Thompson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28df4b8c2aSAndrew Thompson * SUCH DAMAGE. 29df4b8c2aSAndrew Thompson */ 30df4b8c2aSAndrew Thompson 31df4b8c2aSAndrew Thompson #ifndef _LIBUSB20_H_ 32df4b8c2aSAndrew Thompson #define _LIBUSB20_H_ 33df4b8c2aSAndrew Thompson 3466194130SHans Petter Selasky #ifndef LIBUSB_GLOBAL_INCLUDE_FILE 35f3cba95cSWojciech A. Koszek #include <stdint.h> 3666194130SHans Petter Selasky #endif 37df4b8c2aSAndrew Thompson 38df4b8c2aSAndrew Thompson #ifdef __cplusplus 39df4b8c2aSAndrew Thompson extern "C" { 40df4b8c2aSAndrew Thompson #endif 41df4b8c2aSAndrew Thompson #if 0 42df4b8c2aSAndrew Thompson }; /* style */ 43df4b8c2aSAndrew Thompson 44df4b8c2aSAndrew Thompson #endif 45df4b8c2aSAndrew Thompson 46df4b8c2aSAndrew Thompson /** \ingroup misc 47df4b8c2aSAndrew Thompson * Error codes. Most libusb20 functions return 0 on success or one of 48df4b8c2aSAndrew Thompson * these codes on failure. 49df4b8c2aSAndrew Thompson */ 50df4b8c2aSAndrew Thompson enum libusb20_error { 51df4b8c2aSAndrew Thompson /** Success (no error) */ 52df4b8c2aSAndrew Thompson LIBUSB20_SUCCESS = 0, 53df4b8c2aSAndrew Thompson 54df4b8c2aSAndrew Thompson /** Input/output error */ 55df4b8c2aSAndrew Thompson LIBUSB20_ERROR_IO = -1, 56df4b8c2aSAndrew Thompson 57df4b8c2aSAndrew Thompson /** Invalid parameter */ 58df4b8c2aSAndrew Thompson LIBUSB20_ERROR_INVALID_PARAM = -2, 59df4b8c2aSAndrew Thompson 60df4b8c2aSAndrew Thompson /** Access denied (insufficient permissions) */ 61df4b8c2aSAndrew Thompson LIBUSB20_ERROR_ACCESS = -3, 62df4b8c2aSAndrew Thompson 63df4b8c2aSAndrew Thompson /** No such device (it may have been disconnected) */ 64df4b8c2aSAndrew Thompson LIBUSB20_ERROR_NO_DEVICE = -4, 65df4b8c2aSAndrew Thompson 66df4b8c2aSAndrew Thompson /** Entity not found */ 67df4b8c2aSAndrew Thompson LIBUSB20_ERROR_NOT_FOUND = -5, 68df4b8c2aSAndrew Thompson 69df4b8c2aSAndrew Thompson /** Resource busy */ 70df4b8c2aSAndrew Thompson LIBUSB20_ERROR_BUSY = -6, 71df4b8c2aSAndrew Thompson 72df4b8c2aSAndrew Thompson /** Operation timed out */ 73df4b8c2aSAndrew Thompson LIBUSB20_ERROR_TIMEOUT = -7, 74df4b8c2aSAndrew Thompson 75df4b8c2aSAndrew Thompson /** Overflow */ 76df4b8c2aSAndrew Thompson LIBUSB20_ERROR_OVERFLOW = -8, 77df4b8c2aSAndrew Thompson 78df4b8c2aSAndrew Thompson /** Pipe error */ 79df4b8c2aSAndrew Thompson LIBUSB20_ERROR_PIPE = -9, 80df4b8c2aSAndrew Thompson 81df4b8c2aSAndrew Thompson /** System call interrupted (perhaps due to signal) */ 82df4b8c2aSAndrew Thompson LIBUSB20_ERROR_INTERRUPTED = -10, 83df4b8c2aSAndrew Thompson 84df4b8c2aSAndrew Thompson /** Insufficient memory */ 85df4b8c2aSAndrew Thompson LIBUSB20_ERROR_NO_MEM = -11, 86df4b8c2aSAndrew Thompson 87df4b8c2aSAndrew Thompson /** Operation not supported or unimplemented on this platform */ 88df4b8c2aSAndrew Thompson LIBUSB20_ERROR_NOT_SUPPORTED = -12, 89df4b8c2aSAndrew Thompson 90df4b8c2aSAndrew Thompson /** Other error */ 91df4b8c2aSAndrew Thompson LIBUSB20_ERROR_OTHER = -99, 92df4b8c2aSAndrew Thompson }; 93df4b8c2aSAndrew Thompson 94df4b8c2aSAndrew Thompson /** \ingroup asyncio 95df4b8c2aSAndrew Thompson * libusb20_tr_get_status() values */ 96df4b8c2aSAndrew Thompson enum libusb20_transfer_status { 97df4b8c2aSAndrew Thompson /** Transfer completed without error. Note that this does not 98df4b8c2aSAndrew Thompson * indicate that the entire amount of requested data was 99df4b8c2aSAndrew Thompson * transferred. */ 100df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_COMPLETED, 101df4b8c2aSAndrew Thompson 102df4b8c2aSAndrew Thompson /** Callback code to start transfer */ 103df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_START, 104df4b8c2aSAndrew Thompson 105df4b8c2aSAndrew Thompson /** Drain complete callback code */ 106df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_DRAINED, 107df4b8c2aSAndrew Thompson 108df4b8c2aSAndrew Thompson /** Transfer failed */ 109df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_ERROR, 110df4b8c2aSAndrew Thompson 111df4b8c2aSAndrew Thompson /** Transfer timed out */ 112df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_TIMED_OUT, 113df4b8c2aSAndrew Thompson 114df4b8c2aSAndrew Thompson /** Transfer was cancelled */ 115df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_CANCELLED, 116df4b8c2aSAndrew Thompson 117df4b8c2aSAndrew Thompson /** For bulk/interrupt endpoints: halt condition detected 118df4b8c2aSAndrew Thompson * (endpoint stalled). For control endpoints: control request 119df4b8c2aSAndrew Thompson * not supported. */ 120df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_STALL, 121df4b8c2aSAndrew Thompson 122df4b8c2aSAndrew Thompson /** Device was disconnected */ 123df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_NO_DEVICE, 124df4b8c2aSAndrew Thompson 125df4b8c2aSAndrew Thompson /** Device sent more data than requested */ 126df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_OVERFLOW, 127df4b8c2aSAndrew Thompson }; 128df4b8c2aSAndrew Thompson 129df4b8c2aSAndrew Thompson /** \ingroup asyncio 130df4b8c2aSAndrew Thompson * libusb20_tr_set_flags() values */ 131df4b8c2aSAndrew Thompson enum libusb20_transfer_flags { 132df4b8c2aSAndrew Thompson /** Report a short frame as error */ 133df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK = 0x0001, 134df4b8c2aSAndrew Thompson 135df4b8c2aSAndrew Thompson /** Multiple short frames are not allowed */ 136df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_MULTI_SHORT_NOT_OK = 0x0002, 137df4b8c2aSAndrew Thompson 138df4b8c2aSAndrew Thompson /** All transmitted frames are short terminated */ 139df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_FORCE_SHORT = 0x0004, 140df4b8c2aSAndrew Thompson 141df4b8c2aSAndrew Thompson /** Will do a clear-stall before xfer */ 142df4b8c2aSAndrew Thompson LIBUSB20_TRANSFER_DO_CLEAR_STALL = 0x0008, 143df4b8c2aSAndrew Thompson }; 144df4b8c2aSAndrew Thompson 145df4b8c2aSAndrew Thompson /** \ingroup misc 146df4b8c2aSAndrew Thompson * libusb20_dev_get_mode() values 147df4b8c2aSAndrew Thompson */ 148df4b8c2aSAndrew Thompson enum libusb20_device_mode { 149df4b8c2aSAndrew Thompson LIBUSB20_MODE_HOST, /* default */ 150df4b8c2aSAndrew Thompson LIBUSB20_MODE_DEVICE, 151df4b8c2aSAndrew Thompson }; 152df4b8c2aSAndrew Thompson 153df4b8c2aSAndrew Thompson /** \ingroup misc 154df4b8c2aSAndrew Thompson * libusb20_dev_get_speed() values 155df4b8c2aSAndrew Thompson */ 156df4b8c2aSAndrew Thompson enum { 157df4b8c2aSAndrew Thompson LIBUSB20_SPEED_UNKNOWN, /* default */ 158df4b8c2aSAndrew Thompson LIBUSB20_SPEED_LOW, 159df4b8c2aSAndrew Thompson LIBUSB20_SPEED_FULL, 160df4b8c2aSAndrew Thompson LIBUSB20_SPEED_HIGH, 161df4b8c2aSAndrew Thompson LIBUSB20_SPEED_VARIABLE, 162df4b8c2aSAndrew Thompson LIBUSB20_SPEED_SUPER, 163df4b8c2aSAndrew Thompson }; 164df4b8c2aSAndrew Thompson 165df4b8c2aSAndrew Thompson /** \ingroup misc 166df4b8c2aSAndrew Thompson * libusb20_dev_set_power() values 167df4b8c2aSAndrew Thompson */ 168df4b8c2aSAndrew Thompson enum { 169df4b8c2aSAndrew Thompson LIBUSB20_POWER_OFF, 170df4b8c2aSAndrew Thompson LIBUSB20_POWER_ON, 171df4b8c2aSAndrew Thompson LIBUSB20_POWER_SAVE, 172df4b8c2aSAndrew Thompson LIBUSB20_POWER_SUSPEND, 173df4b8c2aSAndrew Thompson LIBUSB20_POWER_RESUME, 174df4b8c2aSAndrew Thompson }; 175df4b8c2aSAndrew Thompson 176760bc48eSAndrew Thompson struct usb_device_info; 177df4b8c2aSAndrew Thompson struct libusb20_transfer; 178df4b8c2aSAndrew Thompson struct libusb20_backend; 179df4b8c2aSAndrew Thompson struct libusb20_backend_methods; 180df4b8c2aSAndrew Thompson struct libusb20_device; 181df4b8c2aSAndrew Thompson struct libusb20_device_methods; 182df4b8c2aSAndrew Thompson struct libusb20_config; 183df4b8c2aSAndrew Thompson struct LIBUSB20_CONTROL_SETUP_DECODED; 184df4b8c2aSAndrew Thompson struct LIBUSB20_DEVICE_DESC_DECODED; 185df4b8c2aSAndrew Thompson 186df4b8c2aSAndrew Thompson typedef void (libusb20_tr_callback_t)(struct libusb20_transfer *xfer); 187df4b8c2aSAndrew Thompson 188df4b8c2aSAndrew Thompson struct libusb20_quirk { 189df4b8c2aSAndrew Thompson uint16_t vid; /* vendor ID */ 190df4b8c2aSAndrew Thompson uint16_t pid; /* product ID */ 191df4b8c2aSAndrew Thompson uint16_t bcdDeviceLow; /* low revision value, inclusive */ 192df4b8c2aSAndrew Thompson uint16_t bcdDeviceHigh; /* high revision value, inclusive */ 193df4b8c2aSAndrew Thompson uint16_t reserved[2]; /* for the future */ 194df4b8c2aSAndrew Thompson /* quirk name, UQ_XXX, including terminating zero */ 195df4b8c2aSAndrew Thompson char quirkname[64 - 12]; 196df4b8c2aSAndrew Thompson }; 197df4b8c2aSAndrew Thompson 1981c497368SHans Petter Selasky #define LIBUSB20_MAX_FRAME_PRE_SCALE (1U << 31) 199df4b8c2aSAndrew Thompson 2001c497368SHans Petter Selasky /* USB transfer operations */ 201df4b8c2aSAndrew Thompson int libusb20_tr_close(struct libusb20_transfer *xfer); 202df4b8c2aSAndrew Thompson int libusb20_tr_open(struct libusb20_transfer *xfer, uint32_t max_buf_size, uint32_t max_frame_count, uint8_t ep_no); 20307b6ce3bSHans Petter Selasky int libusb20_tr_open_stream(struct libusb20_transfer *xfer, uint32_t max_buf_size, uint32_t max_frame_count, uint8_t ep_no, uint16_t stream_id); 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); 253e50ac68bSAndrew Thompson int libusb20_dev_check_connected(struct libusb20_device *pdev); 254df4b8c2aSAndrew Thompson int libusb20_dev_set_power_mode(struct libusb20_device *pdev, uint8_t power_mode); 255df4b8c2aSAndrew Thompson uint8_t libusb20_dev_get_power_mode(struct libusb20_device *pdev); 256c77a24c2SHans Petter Selasky int libusb20_dev_get_port_path(struct libusb20_device *pdev, uint8_t *buf, uint8_t bufsize); 257aafcb732SHans Petter Selasky uint16_t libusb20_dev_get_power_usage(struct libusb20_device *pdev); 258df4b8c2aSAndrew Thompson int libusb20_dev_set_alt_index(struct libusb20_device *pdev, uint8_t iface_index, uint8_t alt_index); 259760bc48eSAndrew Thompson int libusb20_dev_get_info(struct libusb20_device *pdev, struct usb_device_info *pinfo); 260df4b8c2aSAndrew Thompson int libusb20_dev_get_iface_desc(struct libusb20_device *pdev, uint8_t iface_index, char *buf, uint8_t len); 261df4b8c2aSAndrew Thompson 262df4b8c2aSAndrew Thompson struct LIBUSB20_DEVICE_DESC_DECODED *libusb20_dev_get_device_desc(struct libusb20_device *pdev); 263df4b8c2aSAndrew Thompson struct libusb20_config *libusb20_dev_alloc_config(struct libusb20_device *pdev, uint8_t config_index); 264df4b8c2aSAndrew Thompson struct libusb20_device *libusb20_dev_alloc(void); 265df4b8c2aSAndrew Thompson uint8_t libusb20_dev_get_address(struct libusb20_device *pdev); 2662485d8a7SHans Petter Selasky uint8_t libusb20_dev_get_parent_address(struct libusb20_device *pdev); 2672485d8a7SHans Petter Selasky uint8_t libusb20_dev_get_parent_port(struct libusb20_device *pdev); 268df4b8c2aSAndrew Thompson uint8_t libusb20_dev_get_bus_number(struct libusb20_device *pdev); 269df4b8c2aSAndrew Thompson uint8_t libusb20_dev_get_mode(struct libusb20_device *pdev); 270df4b8c2aSAndrew Thompson uint8_t libusb20_dev_get_speed(struct libusb20_device *pdev); 271df4b8c2aSAndrew Thompson uint8_t libusb20_dev_get_config_index(struct libusb20_device *pdev); 272df4b8c2aSAndrew Thompson void libusb20_dev_free(struct libusb20_device *pdev); 273df4b8c2aSAndrew Thompson void libusb20_dev_set_debug(struct libusb20_device *pdev, int debug); 274df4b8c2aSAndrew Thompson void libusb20_dev_wait_process(struct libusb20_device *pdev, int timeout); 275df4b8c2aSAndrew Thompson 276df4b8c2aSAndrew Thompson /* USB global operations */ 277df4b8c2aSAndrew Thompson 278df4b8c2aSAndrew Thompson int libusb20_be_get_dev_quirk(struct libusb20_backend *pbe, uint16_t index, struct libusb20_quirk *pq); 279df4b8c2aSAndrew Thompson int libusb20_be_get_quirk_name(struct libusb20_backend *pbe, uint16_t index, struct libusb20_quirk *pq); 280df4b8c2aSAndrew Thompson int libusb20_be_add_dev_quirk(struct libusb20_backend *pbe, struct libusb20_quirk *pq); 281df4b8c2aSAndrew Thompson int libusb20_be_remove_dev_quirk(struct libusb20_backend *pbe, struct libusb20_quirk *pq); 28238d3e5feSXin LI int libusb20_be_get_template(struct libusb20_backend *pbe, int *ptemp); 28338d3e5feSXin LI int libusb20_be_set_template(struct libusb20_backend *pbe, int temp); 284df4b8c2aSAndrew Thompson 285df4b8c2aSAndrew Thompson /* USB backend operations */ 286df4b8c2aSAndrew Thompson 287df4b8c2aSAndrew Thompson struct libusb20_backend *libusb20_be_alloc(const struct libusb20_backend_methods *methods); 288df4b8c2aSAndrew Thompson struct libusb20_backend *libusb20_be_alloc_default(void); 289df4b8c2aSAndrew Thompson struct libusb20_backend *libusb20_be_alloc_freebsd(void); 290df4b8c2aSAndrew Thompson struct libusb20_backend *libusb20_be_alloc_linux(void); 291df4b8c2aSAndrew Thompson struct libusb20_backend *libusb20_be_alloc_ugen20(void); 292df4b8c2aSAndrew Thompson struct libusb20_device *libusb20_be_device_foreach(struct libusb20_backend *pbe, struct libusb20_device *pdev); 293df4b8c2aSAndrew Thompson void libusb20_be_dequeue_device(struct libusb20_backend *pbe, struct libusb20_device *pdev); 294df4b8c2aSAndrew Thompson void libusb20_be_enqueue_device(struct libusb20_backend *pbe, struct libusb20_device *pdev); 295df4b8c2aSAndrew Thompson void libusb20_be_free(struct libusb20_backend *pbe); 296df4b8c2aSAndrew Thompson 297c61f2561SHans Petter Selasky /* USB debugging */ 298c61f2561SHans Petter Selasky 299c61f2561SHans Petter Selasky const char *libusb20_strerror(int); 300c61f2561SHans Petter Selasky const char *libusb20_error_name(int); 301c61f2561SHans Petter Selasky 302df4b8c2aSAndrew Thompson #if 0 303df4b8c2aSAndrew Thompson { /* style */ 304df4b8c2aSAndrew Thompson #endif 305df4b8c2aSAndrew Thompson #ifdef __cplusplus 306df4b8c2aSAndrew Thompson } 307df4b8c2aSAndrew Thompson 308df4b8c2aSAndrew Thompson #endif 309df4b8c2aSAndrew Thompson 310df4b8c2aSAndrew Thompson #endif /* _LIBUSB20_H_ */ 311