|
USBIP C library 0.7.0
Virtual USB devices & host drivers over USB/IP
|
Host API - write host drivers that drive USB devices over USB/IP. More...
#include "usbip.h"Data Structures | |
| struct | usbip_host_iso_packet_descriptor |
| One isochronous packet's request/result (libusb-shaped). More... | |
| struct | usbip_host_transfer |
| An isochronous transfer (libusb-shaped; submitted synchronously). More... | |
Typedefs | |
| typedef struct usbip_host_context | usbip_host_context |
| Library session / device list owner. | |
| typedef struct usbip_host_device | usbip_host_device |
| An enumerated device, not yet opened. | |
| typedef struct usbip_host_handle | usbip_host_handle |
| An opened device, usable for I/O | |
Functions | |
| int | usbip_host_init (usbip_host_context **ctx) |
| Create a library context (the root object for enumeration and I/O). | |
| void | usbip_host_exit (usbip_host_context *ctx) |
| Destroy a context created by usbip_host_init() and free its resources. | |
| int | usbip_host_set_transport (usbip_host_context *ctx, usb_transport *transport) |
| Bind a USB/IP transport to the context - the only USB/IP-aware call. | |
| long | usbip_host_get_device_list (usbip_host_context *ctx, usbip_host_device ***list) |
| Enumerate the devices reachable on the context's transport. | |
| void | usbip_host_free_device_list (usbip_host_device **list) |
| Free a device list returned by usbip_host_get_device_list(). | |
| int | usbip_host_get_device_descriptor (usbip_host_device *dev, usb_device_descriptor *out) |
| Copy an enumerated device's 18-byte device descriptor. | |
| int | usbip_host_open (usbip_host_device *dev, usbip_host_handle **handle) |
| Open an enumerated device, yielding a handle for I/O. | |
| usbip_host_handle * | usbip_host_open_vid_pid (usbip_host_context *ctx, uint16_t vid, uint16_t pid) |
| Convenience: enumerate, match the first device by VID:PID, and open it. | |
| void | usbip_host_close (usbip_host_handle *handle) |
| Close a handle from usbip_host_open() / usbip_host_open_vid_pid(). | |
| int | usbip_host_set_configuration (usbip_host_handle *handle, int config) |
| Select a configuration (standard SET_CONFIGURATION request). | |
| int | usbip_host_claim_interface (usbip_host_handle *handle, int iface) |
| Claim an interface. | |
| int | usbip_host_release_interface (usbip_host_handle *handle, int iface) |
| Release an interface claimed with usbip_host_claim_interface() (compatibility no-op). | |
| int | usbip_host_set_interface_alt_setting (usbip_host_handle *handle, int iface, int alt) |
| Select an interface's alternate setting (standard SET_INTERFACE request). | |
| int | usbip_host_clear_halt (usbip_host_handle *handle, uint8_t endpoint) |
Clear a halted (STALLed) endpoint - CLEAR_FEATURE(ENDPOINT_HALT). | |
| int | usbip_host_control_transfer (usbip_host_handle *handle, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint8_t *data, uint16_t wLength, unsigned timeout_ms) |
| Perform a synchronous control transfer on endpoint 0 (libusb-shaped). | |
| int | usbip_host_bulk_transfer (usbip_host_handle *handle, uint8_t endpoint, uint8_t *data, int length, int *transferred, unsigned timeout_ms) |
| Perform a synchronous bulk transfer (libusb-shaped). | |
| int | usbip_host_interrupt_transfer (usbip_host_handle *handle, uint8_t endpoint, uint8_t *data, int length, int *transferred, unsigned timeout_ms) |
| Perform a synchronous interrupt transfer (libusb-shaped). | |
| usbip_host_transfer * | usbip_host_alloc_transfer (int num_iso_packets) |
Allocate an iso transfer with room for num_iso_packets packet descriptors. | |
| void | usbip_host_free_transfer (usbip_host_transfer *transfer) |
| Free a transfer from usbip_host_alloc_transfer(). | |
| void | usbip_host_fill_iso_transfer (usbip_host_transfer *transfer, usbip_host_handle *handle, uint8_t endpoint, uint8_t *buffer, int length, int num_iso_packets, unsigned timeout_ms) |
| Populate an iso transfer's fields (libusb-shaped convenience setter). | |
| void | usbip_host_set_iso_packet_lengths (usbip_host_transfer *transfer, unsigned length) |
Set every packet's requested length to length (the common equal-size case). | |
| uint8_t * | usbip_host_get_iso_packet_buffer_simple (usbip_host_transfer *transfer, unsigned packet) |
Pointer to packet packet's data within the transfer buffer (assumes equal-size packets). | |
| int | usbip_host_submit_transfer (usbip_host_transfer *transfer) |
| Submit - and, here, synchronously complete - an isochronous transfer. | |
Host API - write host drivers that drive USB devices over USB/IP.
Deliberately libusb-shaped: porting libusb code is essentially s/libusb_/usbip_host_/. The one addition is usbip_host_set_transport().
Conventions: functions return USB_SUCCESS (0) on success and a negative USB_ERROR code on failure, unless noted (the transfer calls return a byte count, and the constructors return a pointer or NULL).