How To Modify Your Gnu/Linux Box To Serve As A USB Over IP Server

Want to support HowtoForge? Become a subscriber!
 
Submitted by shayne.alone (Contact Author) (Forums) on Tue, 2010-01-05 16:05. :: Linux

How To Modify Your Gnu/Linux Box To Serve As A USB Over IP Server

There was a long time that I was looking for a way to put away my old co CRM server! But why? Because I had installed a virtualization environment with Xen and all my servers are turned to small VPS on a nice pretty infrastructure. The base point was that the CRM had a USB/Lock and there was no way to take the lock under a virtualized VPS.

The commercial way is to use a USBoverIP hardware which will have a cost at about 100$ for a 2 port USB support, up to 500$ or more ... 

Huuum, let's finish the story!

Open Source  ways are always here ;)

There is a good open source project available on the following link:

http://usbip.sourceforge.net/

which turns your Linux Box as a USB server to serve USB devices over IP for both Gnu\Linux and MS-Windows Clients.

 

Server Side

1- Download the latest package:

http://downloads.sourceforge.net/project/usbip/usbip/usbip-win-preview/usbip-win.zip?use_mirror=ignum

*You can check your distro repository for the related package with dependencies.

Debian based distro such as Ubuntu Karmic imported the USBIP branch to their repository.

Our test platform is Ubuntu Karmic, so all you need to do is:

usbip:~$ sudo aptitude install usbip

Then you need to load the following modules to be able to control your USB ports.

usbip:~$ sudo modprobe usbip
usbip:~$ sudo modprobe usbip_common_mod

 Now, it's time to start the usbip service as a system Daemon.

usbip:~$ usbipd -D

Bind usbip.ko to a usb device to be exportable!
usbip:~$ 

 which means that all the things are ok and you just need to choose which port is your favourite port to be shared.

1- Attach the usb device to your box.

2- Execute the command

lsusb

to find the corresponding Vendor/Device ID which is in the form of:

Bus XXX Device YYY: ID VendorID:DeviceID

** Vendor and Device IDs are four digit codes like the "0c45:63ee" that the first one here (0c45) is for Microdia Co, and the second one (63ee) is the USB device Unic number. For example a USB webcam device.

Know that to find your favourite hardware ID, you can locate its possition on the BUS. Just match the ID with the result of usbip server check:

usbip:~$ sudo usbip_bind_driver --list

.

.

.

busid 1-6 (0c45:63ee)
         1-6:1.0 -> uvcvideo
         1-6:1.1 -> uvcvideo
.

.

.

Just find the bus-ID which points to your usb device. Here it is "1-6".

Now, it's time to attach the deivce to the server:

usbip:~$ sudo usbip_bind_driver --usbip 1-6

As you execute the above command, the system will grab that device from your  OS and will listen for remote clients to serve it for.

 

Client Side

* MS Windows Client

Download the zip version:

http://ignum.dl.sourceforge.net/project/usbip/usbip/usbip-win-preview/usbip-win.zip

Extract it...

There are two steps you should do!

First:

There is a file "bus.inf" in the zip file, which you should install as a "Generic system device" in your client hardware managment.

Second:

Execute the excutable file which is in the zip file:

path-to-usbip:> usbip.exe -l <server-ip>

The result will show you the bus-ID that you had bound in server.

Huum, it's a light point.

All that is left to do is to attach the device:

path-to-usbip:> usbip.exe -a <server-ip> USB-ID

** USB-ID is a number in the form of X-Y (in our case it was 1-6).

Done!!! You will see the new USB device which is detected in your OS.

It's time to enjoy. ;)

 

* Gnu/Linux Client

*Test Distro: Ubuntu Karmic

Like on the server side, all we need to do is use the command:

$ sudo apt-get install usbip

Then simply load the "vhci-hcd" module with the following command:

$ sudo modprobe vhci-hcd

Now you are able to query and attach the remote USB device with the following commands:

$ sudo usbip -l <server-ip>

The above command is able to give you a list of the usb-devices which are available.

$ sudo usbip -a <server-ip> X-Y

And this one is the magic command which will bring that remote USB device up for you.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Sat, 2011-12-17 10:04.
How do you know to modprobe vhci-hcd?
Submitted by Silvain Dupertuis (not registered) on Tue, 2011-08-23 16:33.

I have

A Unbuntu 11.04 installation

A USB-Ethernet device which works well with a Windows XP client computer. It is a Sharkoon USB/Ethernet connector. (USB Lanport 100, 1 USB USB Server)


I would like having it work using a Linux client (Ubuntu) as well.


I have done the following :

1. Configuring etc/hosts by adding a line

192.168.2.101 serveur-imprimantes #Default name sharkoon.

The url serveur-imprimantes works well and displays the name of the USB device attached to the USB port of the connector (I have done this step before seeing you post)


2. Installing USBIP from the regular update manager available in my Ubuntu distribution. (I suppose it is the same as the one you suggest to install manuallly).


3. I have tried the different steps using the USBIP command on the client machine as described in your explanations, without success...


sudo usbip -l 192.168.2.101

> does not answer at all

sudo usbip -l serveur-imprimantes

> idem

sudo usbip -p serveur-imprimantes

> gives the answer

8 ports available

Port 00: <Port Available>

...

Port 07: <Port Available>

sudo usbip -l 192.168.2.101:00

> usbip err: usbip_network.c: 206 (tcp_connect ) 192.168.2.101:00 3240: Name or service not known

192.168.2.101:00 failed

 

As far as I understand things correctly, when a USB device is connected to a USB/Ethernet connector, not to a server computer, there should not be any server-side installation to make...

I also tried commands including the MAC address of my USB/Ethernet connector in the commands... it did not help...

I do not see what else should be done...

Thanks for your help

(Sorry, I tried to use the styles to highlight code, but it was so messy that I had to remove all the styling  the editor does not seem to function properly)

Submitted by woi (not registered) on Sun, 2012-12-23 22:21.
your question is a little elderly – did you ever get a solution?
Submitted by Fred Zinsli (not registered) on Tue, 2011-06-14 02:14.

After you issue the command "path-to-usbip:> usbip.exe -a <server-ip> USB-ID" is the receive sequence counter supposed to remain or finish? Mine stays there all the time. The counter seems to get to a point and stop.

Is there a work around for this because if I ctrl+c or close the cmd box I loss the connection (obviously) and I would like the connection to remain after restarts without the need to open the cmd prompt issue the command and have it remain.

 This is on a Vista client

Thank you in advance.

Fred

Submitted by eafandi (not registered) on Wed, 2011-04-13 16:56.

Hello all,

I wonder if in this scenario the server that hosts the USB and clients connected to it will share same USB resources on the same level?

Have a nice day all

Submitted by ML (not registered) on Thu, 2011-02-10 21:41.

Hi,

any ideas for a Win7 64-bit client?
The download from usbip is not working on 64bit..
Thx

Submitted by Aaron (not registered) on Tue, 2010-04-13 03:58.

Interesting idea but what does:

There is a file "bus.inf" in the zip file, which you should install as a "Generic system device" in your client hardware managment.

 mean?

Submitted by Anonymous (not registered) on Fri, 2010-01-08 07:59.
i need helpz to uze dis thing!111!!!! how do u use it?
Submitted by kaas (not registered) on Thu, 2010-09-09 14:39.

use hdwwiz to install .inf file

Start run hdwwiz

follow instructions