|
4 | 4 | # Copyright (C) 2011 matt mooney < [email protected]>
|
5 | 5 | # 2005-2008 Takahiro Hirofuchi
|
6 | 6 |
|
| 7 | +[Overview] |
| 8 | +USB/IP protocol allows to pass USB device from server to client over the |
| 9 | +network. Server is a machine which provides (shares) a USB device. Client is |
| 10 | +a machine which uses USB device provided by server over the network. |
| 11 | +The USB device may be either physical device connected to a server or |
| 12 | +software entity created on a server using USB gadget subsystem. |
| 13 | +Whole project consists of four parts: |
| 14 | + |
| 15 | + - usbip-vhci |
| 16 | + A client side kernel module which provides a virtual USB Host Controller |
| 17 | + and allows to import a USB device from a remote machine. |
| 18 | + |
| 19 | + - usbip-host (stub driver) |
| 20 | + A server side module which provides a USB device driver which can be |
| 21 | + bound to a physical USB device to make it exportable. |
| 22 | + |
| 23 | + - usbip-vudc |
| 24 | + A server side module which provides a virtual USB Device Controller and allows |
| 25 | + to export a USB device created using USB Gadget Subsystem. |
| 26 | + |
| 27 | + - usbip-utils |
| 28 | + A set of userspace tools used to handle connection and management. |
| 29 | + Used on both sides. |
7 | 30 |
|
8 | 31 | [Requirements]
|
9 | 32 | - USB/IP device drivers
|
10 |
| - Found in the staging directory of the Linux kernel. |
| 33 | + Found in the drivers/usb/usbip/ directory of the Linux kernel tree. |
11 | 34 |
|
12 | 35 | - libudev >= 2.0
|
13 | 36 | libudev library
|
|
36 | 59 |
|
37 | 60 |
|
38 | 61 | [Usage]
|
| 62 | +On a server side there are two entities which can be shared. |
| 63 | +First of them is physical usb device connected to the machine. |
| 64 | +To make it available below steps should be executed: |
| 65 | + |
39 | 66 | server:# (Physically attach your USB device.)
|
40 | 67 |
|
41 | 68 | server:# insmod usbip-core.ko
|
|
52 | 79 | - The USB device 1-2 is now exportable to other hosts!
|
53 | 80 | - Use `usbip unbind --busid 1-2' to stop exporting the device.
|
54 | 81 |
|
| 82 | +Second of shareable entities is USB Gadget created using USB Gadget Subsystem |
| 83 | +on a server machine. To make it available below steps should be executed: |
| 84 | + |
| 85 | + server:# (Create your USB gadget) |
| 86 | + - Currently the most preferable way of creating a new USB gadget |
| 87 | + is ConfigFS Composite Gadget. Please refer to its documentation |
| 88 | + for details. |
| 89 | + - See vudc_server_example.sh for a short example of USB gadget creation |
| 90 | + |
| 91 | + server:# insmod usbip-core.ko |
| 92 | + server:# insmod usbip-vudc.ko |
| 93 | + - To create more than one instance of vudc use num module param |
| 94 | + |
| 95 | + server:# (Bind gadget to one of available vudc) |
| 96 | + - Assign your new gadget to USB/IP UDC |
| 97 | + - Using ConfigFS interface you may do this simply by: |
| 98 | + server:# cd /sys/kernel/config/usb_gadget/<gadget_name> |
| 99 | + server:# echo "usbip-vudc.0" > UDC |
| 100 | + |
| 101 | + server:# usbipd -D --device |
| 102 | + - Start usbip daemon. |
| 103 | + |
| 104 | +To attach new device to client machine below commands should be used: |
| 105 | + |
55 | 106 | client:# insmod usbip-core.ko
|
56 | 107 | client:# insmod vhci-hcd.ko
|
57 | 108 |
|
|
60 | 111 |
|
61 | 112 | client:# usbip attach --remote <host> --busid 1-2
|
62 | 113 | - Connect the remote USB device.
|
| 114 | + - When using vudc on a server side busid is really vudc instance name. |
| 115 | + For example: usbip-vudc.0 |
63 | 116 |
|
64 | 117 | client:# usbip port
|
65 | 118 | - Show virtual port status.
|
@@ -192,6 +245,8 @@ Detach the imported device:
|
192 | 245 | - http://usbip.wiki.sourceforge.net/how-to-debug-usbip
|
193 | 246 | - usbip-host.ko must be bound to the target device.
|
194 | 247 | - See /proc/bus/usb/devices and find "Driver=..." lines of the device.
|
| 248 | + - Target USB gadget must be bound to vudc |
| 249 | + (using USB gadget susbsys, not usbip bind command) |
195 | 250 | - Shutdown firewall.
|
196 | 251 | - usbip now uses TCP port 3240.
|
197 | 252 | - Disable SELinux.
|
|
0 commit comments