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