USB over IP tunnel

USB/IP Project aims to develop a general USB device sharing system over IP network. To share USB devices between computers with their full functionality, USB/IP encapsulates "USB I/O messages" into TCP/IP payloads and transmits them between computers.

:!: This is reported to be working, but we lack a HowTo yet!

Server on OpenWrt

First install the usb kernel module and usbip server package:

opkg install kmod-usb-ohci usbip-server

Now using the usbip list -l list the local usb devices available that can be exported, in the following example a hub, usb printer, and an optical mouse are shown:

root@OpenWrt:~# usbip list -l
Local USB devices
 - busid 2-1 (05e3:0608)
         2-1:1.0 -> hub

 - busid 2-1.4 (04e8:344f)
         2-1.4:1.0 -> unknown
         2-1.4:1.1 -> unknown

 - busid 2-2 (093a:2510)
         2-2:1.0 -> unknown

The information that you are looking for is 2-2 that is the BUSID for the target device (an optical mouse).
Edit the /etc/rc.local and before the 'exit 0' add the follow lines:

usbipd -D &
sleep 1
usbip bind -b 2-2

Using netstat you can see if everything works.

root@OpenWrt:~# netstat -alpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0  *               LISTEN      927/usbipd

Client side (Arch-linux PC)

Install usbip in your PC

[root@tool dani]# pacman -S usbip

Load the module for the client

[root@tool dani]# modprobe vhci_hcd

List the available remote devices at OpenWrt (server side).

[root@tool dani]# usbip list -r
Exportable USB devices
        2-2: Pixart Imaging, Inc. : Optical Mouse (093a:2510)
           : /sys/devices/platform/bcm63xx_ohci.0/usb2/2-2
           : (Defined at Interface level) (00/00/00)
           :  0 - Human Interface Device / Boot Interface Subclass / Mouse (03/01/02)

Attach the remote device

[root@tool dani]# usbip attach -r -b 2-2

If all went fine now you can move the mouse on your pc, but attached to the router with OpenWrt.


Back to top

doc/howto/usb.iptunnel.txt · Last modified: 2014/01/07 17:01 by danitool