USB device over IP Network in Ubuntu: USBIP.

The 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.

Original USB device drivers and applications can be also used for remote USB devices without any modification of them.

A computer can use remote USB devices as if they were directly attached; for example, it is possible to manage:

  • USB storage devices: fdisk, mkfs, mount/umount, file operations, play a DVD movie and record a DVD-R media.
  • USB keyboards and USB mice: use with linux console and X Window System.
  • USB webcams and USB speakers: view webcam, capture image data and play some music.
  • USB printers, USB scanners, USB serial converters and USB Ethernet interfaces: ok, use fine.

It is currently implemented as Linux device drivers and available under the open source license GPL. Its I/O performance is enough practical in local area network for all types of devices, including isochronous devices, without any modification of Linux-original USB device drivers.

In a client host, the VHCI (Virtual Host Controller Interface) driver is implemented as a USB host controller driver.
The VHCI driver emulates a real USB host controller interface for virtual attachment/detachment, enumeration and initialization of remote USB devices.
It encapsulates USB request blocks and then transmits USB/IP requests to remote server hosts.

In a server host, the Stub driver is implemented as a USB per-device driver.
The Stub driver decapsulates USB/IP requests into USB requests and then submit them to real USB devices.

In Ubuntu, USBIP is installable via Official Repository:

apt-get install usbip

Installing And Using USB/IP On The Server
Load specific modules:

modprobe usbip
modprobe usbip_common_mod

Note: to automatically load these modules at boot, edit the /etc/modules file and insert usbip and usbip_common_mod lines.

Start USBIP Daemon:

usbipd -D

After connecting the device, check that it has been recognized form the Linux Host:

lsusb

and from USBIP:

usbip_bind_driver –list

To bind a specific device to USBIP, use the command:

usbip_bind_driver –usbip [USB_ID]

Note: [USB_ID] is read from usbip_bind_driver –list command.

Installing And Using USB/IP On The Client
Load specific module:

modprobe vhci-hcd

Note: to automatically load this modules at boot, edit the /etc/modules file and insert vhci-hcd line.

Connect to the usbip server and get a list of available USB devices:

usbip -l [Server_IP]>

Attach that device to the client:

usbip -a [Server_IP] [USB_ID]

Note: [USB_ID] is read from usbip -l [Server_IP] command.

Check if device appears on USB Devices List:

lsusb

Detaching A Remote USB Device
To find out the port that the remote USB Device uses on the client, the used command is:

usbip --port

To detach a device on client:

usbip -d [Port_ID]

Note: [Port_ID] is read from usbip –port command.

On the server it is possible to use BUSID ([USB_ID]) to bind the USB Device to the local system.
The –other switch binds the device to the local system, as consequence it will not be available anymore over the network.

usbip_bind_driver --other [USB_ID]

Comments are closed.