|
USBIP C library 0.7.0
Virtual USB devices & host drivers over USB/IP
|
None of the USBIP_* variables is required, and none changes the USB behaviour of a device - they turn on diagnostics, or tell the wrappers where to connect.
| Variable | Read by | Default | Effect |
|---|---|---|---|
USBIP_PCAPNG | libusbip-device and libusbip-host (and both wrappers) | unset - off | write every transfer to a PCAPNG capture file (Capturing traffic) |
USBIP_DEBUG | libusbip-device | unset - off | log every control request (with the verdict) and every data transfer, to stderr (Debugging) |
USBIP_HOST | the libusb-1.0 / libusbK wrappers only | 127.0.0.1 | which USB/IP server to connect to |
USBIP_PORT | the libusb-1.0 / libusbK wrappers only | 3240 | its TCP port |
These pages write their examples for a POSIX shell. Only the syntax differs:
Linux / macOS (sh) | Windows cmd | PowerShell | |
|---|---|---|---|
| for one command only | USBIP_DEBUG=1 prog | not supported | not supported |
| for the rest of the session | export USBIP_DEBUG=1 | set USBIP_DEBUG=1 | $env:USBIP_DEBUG = "1" |
| unset it again | unset USBIP_DEBUG | set USBIP_DEBUG= | Remove-Item Env:USBIP_DEBUG |
cmd, put each set on its own line: set USBIP_PORT=4000 && prog makes the space before && part of the value.Substituting a wrapper for the system library is the one step that is not an environment variable on Windows:
| Linux | macOS | Windows | |
|---|---|---|---|
| load the wrapper, not the system libusb | LD_PRELOAD=/path/to/libusb-1.0.so.0 | DYLD_LIBRARY_PATH (SIP blocks DYLD_INSERT_LIBRARIES) | copy libusb-1.0.dll into the program's own directory, which Windows searches first |
| find your own shared library at run time | LD_LIBRARY_PATH | DYLD_LIBRARY_PATH | beside the .exe, or on PATH |
pyusb needs neither: it takes the backend path as an argument.
USBIP_HOST / USBIP_PORT are not read by libusbip-host. A program using the host API picks its server in code, with usbip_host_set_transport() - the variables exist because a stock libusb or libusbK program has no place to pass one (see Wrappers). Both wrappers read them once, at libusb_init / UsbK_Init time - set them before the program starts.