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:
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:
*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.