Host API¶
Drive USB devices over USB/IP. open / attach
return a Handle with libusb-shaped control / bulk / interrupt /
isochronous transfers, or subclass Driver for a reusable host
driver that binds by class code (use it via Driver.open(vid, pid, transport=...)).
A Connection is the underlying imported-device session
both are built on.
host
¶
Host side - write host drivers that drive USB devices over USB/IP.
open()/attach() return a Handle with libusb-shaped transfers. A reusable host
driver is a Driver subclass that auto-binds by class code (the mirror of a
device-side Interface).
Handle
¶
libusb-shaped device handle.
Source code in usbip/host.py
control
¶
bulk_in
¶
bulk_out
¶
clear_halt
¶
Clear a halted (STALLed) endpoint: CLEAR_FEATURE(ENDPOINT_HALT).
The standard recovery after a transfer raises :class:Stall - a device
halts a pipe to abandon a transfer it cannot complete, and the pipe stays
halted until this clears it.
Source code in usbip/host.py
interrupt_in
¶
interrupt_out
¶
iso_in
¶
Isochronous IN. Returns a list of bytes objects, one per packet (each trimmed to its actual_length).
Source code in usbip/host.py
iso_out
¶
Isochronous OUT. packets is a list of bytes objects, one per packet.
Returns the per-packet [offset, length, actual_length, status] list.
Source code in usbip/host.py
Connection
¶
One imported device: owns the socket and submits URBs.
Source code in usbip/host.py
import_device
¶
control
¶
Source code in usbip/host.py
transfer_in
¶
transfer_out
¶
Source code in usbip/host.py
iso_transfer
¶
One isochronous transfer (libusb-shaped, synchronous). packet_lengths
is the requested length per packet; for OUT data holds the packets laid
out at their slot offsets. Returns (buffer, packets) where packets is a
list of [offset, length, actual_length, status].
Source code in usbip/host.py
open
¶
Import a device and return a Handle. With vid/pid given, verifies the
match; without, accepts whatever busid resolves to (real devices).
When a server exports several devices, vid/pid alone is enough: the busid is
looked up with :func:list_devices. Passing busid skips that and imports
it directly.
Source code in usbip/host.py
attach
¶
Convenience for real remote devices: attach(host, '1-1.4').