Skip to contentSkip to conversation

tools/usbip: persistently forward USB devices on a given bus

PATCH Superseded Lars Gunnarsson 1 participant 1 message Oct 25, 2021

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/3 tools/usbip: persistently forward USB devices on a given bus

To forward a remote usb device over usbip the following steps is required:

1. Execute "usbip bind" on remote end.
2. Execute "usbip attach" on local end.

These steps must be perfomed in above order and after usb device is plugged in. If the usb device is unplugged on the remote end the steps above needs to be performed again to establish the connection. This patch set implements a feature to persistently forward devices on a given bus. When using flag "-p|--persistent" on remot end, the USB device becomes exported when plugged in. When using flag "-p|--persistent" on local end, the USB device becomes imported when available on remote end. Thus it is only required to run the usbip command once on each end, in any order, to persistently forward usb devices on a given bus.

This patch extends the command "usbip bind" with flag "-p|--persistent" to monitor and export a devices on given busid when plugged in, instead of returning an error if the device is not available. When the usb device is unplugged, it will start monitor the given bus again.

---
v2: Change title, fix style warnings, improve feature description, refactor
cmdline flag usage.

 Documentation/usb/usbip_protocol.rst |   5 ++
 tools/usb/usbip/src/usbip_bind.c     | 114 +++++++++++++++++++++------
 2 files changed, 94 insertions(+), 25 deletions(-)
Documentation/usb/usbip_protocol.rst +5 -0
index 0b8541fda4d8..2ed7d97278e8 100644
@@ -9,6 +9,11 @@ The USB/IP protocol follows a server/client architecture. The server exports the
 USB devices and the clients import them. The device driver for the exported
 USB device runs on the client machine.
 
+Initially the server may choose to export any of its available USB devices,
+based on the busid. The device will remain exported until it's unplugged or
+unbound from the usbip driver. It is also possible to persistently export
+devices on a given bus by monitor when they are plugged in.
+
 The client may ask for the list of the exported USB devices. To get the list the
 client opens a TCP/IP connection to the server, and sends an OP_REQ_DEVLIST
 packet on top of the TCP/IP connection (so the actual OP_REQ_DEVLIST may be sent
tools/usb/usbip/src/usbip_bind.c +89 -25

176 lines not on this page · raw message

Signature · 1 line
2.25.1