KVM: how to connect a USB GSM modem to a virtual machine

When we are virtualizing, whether with VirtualBox or KVM , one of the problems we encounter is that sometimes the devices we connect to the Host (Physical PC) cannot be seen on the Client (Virtual PC).

VirtualBox has a plugin for viewing USB drives, and in the case of KVM, seeing these types of devices shouldn't be a problem because it directly uses the installed kernel. However, devices aren't always displayed, as in the example below, where a user needed to connect their GSM modem via USB.

I found the article very interesting, so I am bringing them to you so you can see what he did.

Connect a USB GSM modem using KVM

1- Connect the modem to the PC and execute a command to find out some information:

$ lsusb Bus 001 Device 001: ID 1d6b: 0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b: 0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b: 0001 Linux Foundation 1.1 root hub Bus 004 Device 002: ID 0557: 2221 ATEN International Co., Ltd Winbond Hermon Bus 002 Device 003: ID 12d1: 1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E230 / E270 / E870 HSDPA / HSUPA Modem

In this case, what the author needed was the last line, specifically the vendor ID number ( 12d1 ) and the product ID ( 1003 ).

When you run the same command on the client, as you can see, you don't get the same result:

$ lsusb Bus 001 Device 001: ID 1d6b: 0001 Linux Foundation 1.1 root hub Bus 001 Device 002: ID 0627: 0001 Adomax Technology Co., Ltd Bus 001 Device 003: ID 0409: 55aa NEC Corp. Hub

Now the device must be defined in the client XML (VM). We can do this by directly editing the XML file using the command:

$ sudo virsh edit example-server.

The USB device must be added in the devices section:

[...] 
Notice that it has been added 0x in front of each ID

We save the file, restart the VM, and see if we can now see the connected device:

$ lsusb Bus 001 Device 001: ID 1d6b: 0001 Linux Foundation 1.1 root hub Bus 001 Device 002: ID 0627: 0001 Adomax Technology Co., Ltd Bus 001 Device 003: ID 0409: 55aa NEC Corp. Hub Bus 001 Device 004: ID 12d1: 1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E230 / E270 / E870 HSDPA / HSUPA Modem

And that's it.

Source: http://liquidat.wordpress.com


Add as preferred source in Google