Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 1 | # |
| 2 | # README for usbip-utils |
| 3 | # |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 4 | # Copyright (C) 2011 matt mooney <mfm@muteddisk.com> |
| 5 | # 2005-2008 Takahiro Hirofuchi |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 6 | |
Krzysztof Opasiak | 444d9309 | 2016-12-20 20:53:14 +0100 | [diff] [blame] | 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. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 30 | |
| 31 | [Requirements] |
| 32 | - USB/IP device drivers |
Krzysztof Opasiak | 444d9309 | 2016-12-20 20:53:14 +0100 | [diff] [blame] | 33 | Found in the drivers/usb/usbip/ directory of the Linux kernel tree. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 34 | |
Valentina Manea | 98ada08 | 2014-03-08 14:53:30 +0200 | [diff] [blame] | 35 | - libudev >= 2.0 |
| 36 | libudev library |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 37 | |
| 38 | - libwrap0-dev |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 39 | tcp wrapper library |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 40 | |
| 41 | - gcc >= 4.0 |
| 42 | |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 43 | - libtool, automake >= 1.9, autoconf >= 2.5.0, pkg-config |
| 44 | |
Valentina Manea | 04f7bb9 | 2014-03-08 14:53:36 +0200 | [diff] [blame] | 45 | [Optional] |
| 46 | - hwdata |
| 47 | Contains USB device identification data. |
| 48 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 49 | |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 50 | [Install] |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 51 | 0. Generate configuration scripts. |
| 52 | $ ./autogen.sh |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 53 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 54 | 1. Compile & install the userspace utilities. |
| 55 | $ ./configure [--with-tcp-wrappers=no] [--with-usbids-dir=<dir>] |
| 56 | $ make install |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 57 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 58 | 2. Compile & install USB/IP drivers. |
| 59 | |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 60 | |
| 61 | [Usage] |
Krzysztof Opasiak | 444d9309 | 2016-12-20 20:53:14 +0100 | [diff] [blame] | 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 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 66 | server:# (Physically attach your USB device.) |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 67 | |
matt mooney | 220973d | 2011-05-14 03:55:12 -0700 | [diff] [blame] | 68 | server:# insmod usbip-core.ko |
| 69 | server:# insmod usbip-host.ko |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 70 | |
| 71 | server:# usbipd -D |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 72 | - Start usbip daemon. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 73 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 74 | server:# usbip list -l |
| 75 | - List driver assignments for USB devices. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 76 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 77 | server:# usbip bind --busid 1-2 |
| 78 | - Bind usbip-host.ko to the device with busid 1-2. |
| 79 | - The USB device 1-2 is now exportable to other hosts! |
| 80 | - Use `usbip unbind --busid 1-2' to stop exporting the device. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 81 | |
Krzysztof Opasiak | 444d9309 | 2016-12-20 20:53:14 +0100 | [diff] [blame] | 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 | |
matt mooney | 220973d | 2011-05-14 03:55:12 -0700 | [diff] [blame] | 106 | client:# insmod usbip-core.ko |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 107 | client:# insmod vhci-hcd.ko |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 108 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 109 | client:# usbip list --remote <host> |
| 110 | - List exported USB devices on the <host>. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 111 | |
Kurt Kanzenbach | 80e4b94 | 2013-04-04 16:03:15 +0200 | [diff] [blame] | 112 | client:# usbip attach --remote <host> --busid 1-2 |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 113 | - Connect the remote USB device. |
Krzysztof Opasiak | 444d9309 | 2016-12-20 20:53:14 +0100 | [diff] [blame] | 114 | - When using vudc on a server side busid is really vudc instance name. |
| 115 | For example: usbip-vudc.0 |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 116 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 117 | client:# usbip port |
| 118 | - Show virtual port status. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 119 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 120 | client:# usbip detach --port <port> |
| 121 | - Detach the USB device. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 122 | |
| 123 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 124 | [Example] |
| 125 | --------------------------- |
| 126 | SERVER SIDE |
| 127 | --------------------------- |
| 128 | Physically attach your USB devices to this host. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 129 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 130 | trois:# insmod path/to/usbip-core.ko |
| 131 | trois:# insmod path/to/usbip-host.ko |
| 132 | trois:# usbipd -D |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 133 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 134 | In another terminal, let's look up what USB devices are physically |
| 135 | attached to this host. |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 136 | |
matt mooney | 45dd9a9 | 2011-07-07 00:31:55 -0700 | [diff] [blame] | 137 | trois:# usbip list -l |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 138 | Local USB devices |
| 139 | ================= |
| 140 | - busid 1-1 (05a9:a511) |
| 141 | 1-1:1.0 -> ov511 |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 142 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 143 | - busid 3-2 (0711:0902) |
| 144 | 3-2:1.0 -> none |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 145 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 146 | - busid 3-3.1 (08bb:2702) |
| 147 | 3-3.1:1.0 -> snd-usb-audio |
| 148 | 3-3.1:1.1 -> snd-usb-audio |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 149 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 150 | - busid 3-3.2 (04bb:0206) |
| 151 | 3-3.2:1.0 -> usb-storage |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 152 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 153 | - busid 3-3 (0409:0058) |
| 154 | 3-3:1.0 -> hub |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 155 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 156 | - busid 4-1 (046d:08b2) |
| 157 | 4-1:1.0 -> none |
| 158 | 4-1:1.1 -> none |
| 159 | 4-1:1.2 -> none |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 160 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 161 | - busid 5-2 (058f:9254) |
| 162 | 5-2:1.0 -> hub |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 163 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 164 | A USB storage device of busid 3-3.2 is now bound to the usb-storage |
| 165 | driver. To export this device, we first mark the device as |
| 166 | "exportable"; the device is bound to the usbip-host driver. Please |
| 167 | remember you can not export a USB hub. |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 168 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 169 | Mark the device of busid 3-3.2 as exportable: |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 170 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 171 | trois:# usbip --debug bind --busid 3-3.2 |
| 172 | ... |
matt mooney | 45dd9a9 | 2011-07-07 00:31:55 -0700 | [diff] [blame] | 173 | usbip debug: usbip_bind.c:162:[unbind_other] 3-3.2:1.0 -> usb-storage |
| 174 | ... |
| 175 | bind device on busid 3-3.2: complete |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 176 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 177 | trois:# usbip list -l |
| 178 | Local USB devices |
| 179 | ================= |
| 180 | ... |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 181 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 182 | - busid 3-3.2 (04bb:0206) |
| 183 | 3-3.2:1.0 -> usbip-host |
| 184 | ... |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 185 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 186 | --------------------------- |
| 187 | CLIENT SIDE |
| 188 | --------------------------- |
| 189 | First, let's list available remote devices that are marked as |
| 190 | exportable on the host. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 191 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 192 | deux:# insmod path/to/usbip-core.ko |
| 193 | deux:# insmod path/to/vhci-hcd.ko |
| 194 | |
| 195 | deux:# usbip list --remote 10.0.0.3 |
matt mooney | 45dd9a9 | 2011-07-07 00:31:55 -0700 | [diff] [blame] | 196 | Exportable USB devices |
| 197 | ====================== |
| 198 | - 10.0.0.3 |
| 199 | 1-1: Prolific Technology, Inc. : unknown product (067b:3507) |
| 200 | : /sys/devices/pci0000:00/0000:00:1f.2/usb1/1-1 |
| 201 | : (Defined at Interface level) / unknown subclass / unknown protocol (00/00/00) |
| 202 | : 0 - Mass Storage / SCSI / Bulk (Zip) (08/06/50) |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 203 | |
matt mooney | 45dd9a9 | 2011-07-07 00:31:55 -0700 | [diff] [blame] | 204 | 1-2.2.1: Apple Computer, Inc. : unknown product (05ac:0203) |
| 205 | : /sys/devices/pci0000:00/0000:00:1f.2/usb1/1-2/1-2.2/1-2.2.1 |
| 206 | : (Defined at Interface level) / unknown subclass / unknown protocol (00/00/00) |
| 207 | : 0 - Human Interface Devices / Boot Interface Subclass / Keyboard (03/01/01) |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 208 | |
matt mooney | 45dd9a9 | 2011-07-07 00:31:55 -0700 | [diff] [blame] | 209 | 1-2.2.3: OmniVision Technologies, Inc. : OV511+ WebCam (05a9:a511) |
| 210 | : /sys/devices/pci0000:00/0000:00:1f.2/usb1/1-2/1-2.2/1-2.2.3 |
| 211 | : (Defined at Interface level) / unknown subclass / unknown protocol (00/00/00) |
| 212 | : 0 - Vendor Specific Class / unknown subclass / unknown protocol (ff/00/00) |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 213 | |
matt mooney | 45dd9a9 | 2011-07-07 00:31:55 -0700 | [diff] [blame] | 214 | 3-1: Logitech, Inc. : QuickCam Pro 4000 (046d:08b2) |
| 215 | : /sys/devices/pci0000:00/0000:00:1e.0/0000:02:0a.0/usb3/3-1 |
| 216 | : (Defined at Interface level) / unknown subclass / unknown protocol (00/00/00) |
| 217 | : 0 - Data / unknown subclass / unknown protocol (0a/ff/00) |
| 218 | : 1 - Audio / Control Device / unknown protocol (01/01/00) |
| 219 | : 2 - Audio / Streaming / unknown protocol (01/02/00) |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 220 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 221 | Attach a remote USB device: |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 222 | |
Kurt Kanzenbach | 80e4b94 | 2013-04-04 16:03:15 +0200 | [diff] [blame] | 223 | deux:# usbip attach --remote 10.0.0.3 --busid 1-1 |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 224 | port 0 attached |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 225 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 226 | Show the devices attached to this client: |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 227 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 228 | deux:# usbip port |
| 229 | Port 00: <Port in Use> at Full Speed(12Mbps) |
| 230 | Prolific Technology, Inc. : unknown product (067b:3507) |
| 231 | 6-1 -> usbip://10.0.0.3:3240/1-1 (remote bus/dev 001/004) |
| 232 | 6-1:1.0 used by usb-storage |
| 233 | /sys/class/scsi_device/0:0:0:0/device |
| 234 | /sys/class/scsi_host/host0/device |
| 235 | /sys/block/sda/device |
matt mooney | 9abec45 | 2011-05-14 03:55:11 -0700 | [diff] [blame] | 236 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 237 | Detach the imported device: |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 238 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 239 | deux:# usbip detach --port 0 |
| 240 | port 0 detached |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 241 | |
| 242 | |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 243 | [Checklist] |
| 244 | - See 'Debug Tips' on the project wiki. |
| 245 | - http://usbip.wiki.sourceforge.net/how-to-debug-usbip |
matt mooney | 220973d | 2011-05-14 03:55:12 -0700 | [diff] [blame] | 246 | - usbip-host.ko must be bound to the target device. |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 247 | - See /proc/bus/usb/devices and find "Driver=..." lines of the device. |
Krzysztof Opasiak | 444d9309 | 2016-12-20 20:53:14 +0100 | [diff] [blame] | 248 | - Target USB gadget must be bound to vudc |
| 249 | (using USB gadget susbsys, not usbip bind command) |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 250 | - Shutdown firewall. |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 251 | - usbip now uses TCP port 3240. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 252 | - Disable SELinux. |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 253 | - Check the kernel and daemon messages. |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 254 | |
| 255 | |
| 256 | [Contact] |
matt mooney | 8941521 | 2011-06-16 02:24:59 -0700 | [diff] [blame] | 257 | Mailing List: linux-usb@vger.kernel.org |