README 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. #
  2. # README for usbip-utils
  3. #
  4. # Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  5. # 2005-2008 Takahiro Hirofuchi
  6. [Overview]
  7. USB/IP protocol allows to pass USB device from server to client over the
  8. network. Server is a machine which provides (shares) a USB device. Client is
  9. a machine which uses USB device provided by server over the network.
  10. The USB device may be either physical device connected to a server or
  11. software entity created on a server using USB gadget subsystem.
  12. Whole project consists of four parts:
  13. - usbip-vhci
  14. A client side kernel module which provides a virtual USB Host Controller
  15. and allows to import a USB device from a remote machine.
  16. - usbip-host (stub driver)
  17. A server side module which provides a USB device driver which can be
  18. bound to a physical USB device to make it exportable.
  19. - usbip-vudc
  20. A server side module which provides a virtual USB Device Controller and allows
  21. to export a USB device created using USB Gadget Subsystem.
  22. - usbip-utils
  23. A set of userspace tools used to handle connection and management.
  24. Used on both sides.
  25. [Requirements]
  26. - USB/IP device drivers
  27. Found in the drivers/usb/usbip/ directory of the Linux kernel tree.
  28. - libudev >= 2.0
  29. libudev library
  30. - libwrap0-dev
  31. tcp wrapper library
  32. - gcc >= 4.0
  33. - libtool, automake >= 1.9, autoconf >= 2.5.0, pkg-config
  34. [Optional]
  35. - hwdata
  36. Contains USB device identification data.
  37. [Install]
  38. 0. Generate configuration scripts.
  39. $ ./autogen.sh
  40. 1. Compile & install the userspace utilities.
  41. $ ./configure [--with-tcp-wrappers=no] [--with-usbids-dir=<dir>]
  42. $ make install
  43. 2. Compile & install USB/IP drivers.
  44. [Usage]
  45. On a server side there are two entities which can be shared.
  46. First of them is physical usb device connected to the machine.
  47. To make it available below steps should be executed:
  48. server:# (Physically attach your USB device.)
  49. server:# insmod usbip-core.ko
  50. server:# insmod usbip-host.ko
  51. server:# usbipd -D
  52. - Start usbip daemon.
  53. server:# usbip list -l
  54. - List driver assignments for USB devices.
  55. server:# usbip bind --busid 1-2
  56. - Bind usbip-host.ko to the device with busid 1-2.
  57. - The USB device 1-2 is now exportable to other hosts!
  58. - Use `usbip unbind --busid 1-2' to stop exporting the device.
  59. Second of shareable entities is USB Gadget created using USB Gadget Subsystem
  60. on a server machine. To make it available below steps should be executed:
  61. server:# (Create your USB gadget)
  62. - Currently the most preferable way of creating a new USB gadget
  63. is ConfigFS Composite Gadget. Please refer to its documentation
  64. for details.
  65. - See vudc_server_example.sh for a short example of USB gadget creation
  66. server:# insmod usbip-core.ko
  67. server:# insmod usbip-vudc.ko
  68. - To create more than one instance of vudc use num module param
  69. server:# (Bind gadget to one of available vudc)
  70. - Assign your new gadget to USB/IP UDC
  71. - Using ConfigFS interface you may do this simply by:
  72. server:# cd /sys/kernel/config/usb_gadget/<gadget_name>
  73. server:# echo "usbip-vudc.0" > UDC
  74. server:# usbipd -D --device
  75. - Start usbip daemon.
  76. To attach new device to client machine below commands should be used:
  77. client:# insmod usbip-core.ko
  78. client:# insmod vhci-hcd.ko
  79. client:# usbip list --remote <host>
  80. - List exported USB devices on the <host>.
  81. client:# usbip attach --remote <host> --busid 1-2
  82. - Connect the remote USB device.
  83. - When using vudc on a server side busid is really vudc instance name.
  84. For example: usbip-vudc.0
  85. client:# usbip port
  86. - Show virtual port status.
  87. client:# usbip detach --port <port>
  88. - Detach the USB device.
  89. [Example]
  90. ---------------------------
  91. SERVER SIDE
  92. ---------------------------
  93. Physically attach your USB devices to this host.
  94. trois:# insmod path/to/usbip-core.ko
  95. trois:# insmod path/to/usbip-host.ko
  96. trois:# usbipd -D
  97. In another terminal, let's look up what USB devices are physically
  98. attached to this host.
  99. trois:# usbip list -l
  100. Local USB devices
  101. =================
  102. - busid 1-1 (05a9:a511)
  103. 1-1:1.0 -> ov511
  104. - busid 3-2 (0711:0902)
  105. 3-2:1.0 -> none
  106. - busid 3-3.1 (08bb:2702)
  107. 3-3.1:1.0 -> snd-usb-audio
  108. 3-3.1:1.1 -> snd-usb-audio
  109. - busid 3-3.2 (04bb:0206)
  110. 3-3.2:1.0 -> usb-storage
  111. - busid 3-3 (0409:0058)
  112. 3-3:1.0 -> hub
  113. - busid 4-1 (046d:08b2)
  114. 4-1:1.0 -> none
  115. 4-1:1.1 -> none
  116. 4-1:1.2 -> none
  117. - busid 5-2 (058f:9254)
  118. 5-2:1.0 -> hub
  119. A USB storage device of busid 3-3.2 is now bound to the usb-storage
  120. driver. To export this device, we first mark the device as
  121. "exportable"; the device is bound to the usbip-host driver. Please
  122. remember you can not export a USB hub.
  123. Mark the device of busid 3-3.2 as exportable:
  124. trois:# usbip --debug bind --busid 3-3.2
  125. ...
  126. usbip debug: usbip_bind.c:162:[unbind_other] 3-3.2:1.0 -> usb-storage
  127. ...
  128. bind device on busid 3-3.2: complete
  129. trois:# usbip list -l
  130. Local USB devices
  131. =================
  132. ...
  133. - busid 3-3.2 (04bb:0206)
  134. 3-3.2:1.0 -> usbip-host
  135. ...
  136. ---------------------------
  137. CLIENT SIDE
  138. ---------------------------
  139. First, let's list available remote devices that are marked as
  140. exportable on the host.
  141. deux:# insmod path/to/usbip-core.ko
  142. deux:# insmod path/to/vhci-hcd.ko
  143. deux:# usbip list --remote 10.0.0.3
  144. Exportable USB devices
  145. ======================
  146. - 10.0.0.3
  147. 1-1: Prolific Technology, Inc. : unknown product (067b:3507)
  148. : /sys/devices/pci0000:00/0000:00:1f.2/usb1/1-1
  149. : (Defined at Interface level) / unknown subclass / unknown protocol (00/00/00)
  150. : 0 - Mass Storage / SCSI / Bulk (Zip) (08/06/50)
  151. 1-2.2.1: Apple Computer, Inc. : unknown product (05ac:0203)
  152. : /sys/devices/pci0000:00/0000:00:1f.2/usb1/1-2/1-2.2/1-2.2.1
  153. : (Defined at Interface level) / unknown subclass / unknown protocol (00/00/00)
  154. : 0 - Human Interface Devices / Boot Interface Subclass / Keyboard (03/01/01)
  155. 1-2.2.3: OmniVision Technologies, Inc. : OV511+ WebCam (05a9:a511)
  156. : /sys/devices/pci0000:00/0000:00:1f.2/usb1/1-2/1-2.2/1-2.2.3
  157. : (Defined at Interface level) / unknown subclass / unknown protocol (00/00/00)
  158. : 0 - Vendor Specific Class / unknown subclass / unknown protocol (ff/00/00)
  159. 3-1: Logitech, Inc. : QuickCam Pro 4000 (046d:08b2)
  160. : /sys/devices/pci0000:00/0000:00:1e.0/0000:02:0a.0/usb3/3-1
  161. : (Defined at Interface level) / unknown subclass / unknown protocol (00/00/00)
  162. : 0 - Data / unknown subclass / unknown protocol (0a/ff/00)
  163. : 1 - Audio / Control Device / unknown protocol (01/01/00)
  164. : 2 - Audio / Streaming / unknown protocol (01/02/00)
  165. Attach a remote USB device:
  166. deux:# usbip attach --remote 10.0.0.3 --busid 1-1
  167. port 0 attached
  168. Show the devices attached to this client:
  169. deux:# usbip port
  170. Port 00: <Port in Use> at Full Speed(12Mbps)
  171. Prolific Technology, Inc. : unknown product (067b:3507)
  172. 6-1 -> usbip://10.0.0.3:3240/1-1 (remote bus/dev 001/004)
  173. 6-1:1.0 used by usb-storage
  174. /sys/class/scsi_device/0:0:0:0/device
  175. /sys/class/scsi_host/host0/device
  176. /sys/block/sda/device
  177. Detach the imported device:
  178. deux:# usbip detach --port 0
  179. port 0 detached
  180. [Checklist]
  181. - See 'Debug Tips' on the project wiki.
  182. - http://usbip.wiki.sourceforge.net/how-to-debug-usbip
  183. - usbip-host.ko must be bound to the target device.
  184. - See /sys/kernel/debug/usb/devices and find "Driver=..." lines of the device.
  185. - Target USB gadget must be bound to vudc
  186. (using USB gadget susbsys, not usbip bind command)
  187. - Shutdown firewall.
  188. - usbip now uses TCP port 3240.
  189. - Disable SELinux.
  190. - Check the kernel and daemon messages.
  191. [Contact]
  192. Mailing List: linux-usb@vger.kernel.org