|
USBIP C library 0.7.0
Virtual USB devices & host drivers over USB/IP
|
Programs already written against libusb or libusbK need no porting.
The repository builds a wrapper library for each - ABI- and symbol-compatible with the real one, implemented on the same USB/IP client primitives the host API uses - so an already-compiled binary drives a virtual device unmodified: no kernel module, no root, no vhci, no source change.
| Wrapper | Artifact | Runs on | Loaded by |
|---|---|---|---|
| libusb-1.0 | libusb-1.0.so.0 / libusb-1.0.dll | Linux, macOS, Windows | lsusb, dfu-util, pyusb, anything built against <libusb.h> |
| libusbK | libusbK.dll | Windows | libusbK and WinUSB-API programs (UsbK_*, WinUsb_*) |
The libusb wrapper implements the synchronous and asynchronous APIs - libusb_submit_transfer + libusb_handle_events + callbacks over a worker thread - plus parsed configuration descriptors and string descriptors, with no non-libusb exported symbols. Substitute it for the system libusb and the real dfu-util flashes a virtual DFU device.
The libusbK wrapper is the Windows sibling, with undecorated __stdcall exports, so GetProcAddress and LibK_LoadDriverAPI resolve exactly as against the real one. Both entry styles work - the direct UsbK_* exports and the KUSB_DRIVER_API function table - as do the OVERLAPPED asynchronous API, pipe streams and isochronous streaming. The WinUsb_* names are exported too and forward to their UsbK_* twins, so a program written against winusb.h links unchanged.
A stock binary has no place to name a USB/IP server in code, so the wrappers - alone in this library - take one from USBIP_HOST / USBIP_PORT in the environment, read once at libusb_init / UsbK_Init time. Environment variables has those variables, the syntax for each shell, and how to put a wrapper in front of the system library on each OS.
Each wrapper's own page carries its build commands, a worked session and its per-call fidelity matrix - what is implemented, what is stubbed, and what USB/IP cannot honestly offer (hotplug, enforced timeouts, in-flight cancellation): libusb-1.0 and libusbK.
examples/device/ - the device programs these tools are pointed at