[Spice-devel] Can we directly redir usb hub?

邵鄭叡 vampirictutor at gmail.com
Mon Jun 24 02:40:55 PDT 2013


Hi all,
maybe I should post this message to [usbredir and qemu devel list] ,
but I just didnt find it :)

By default, spice-gtk filters out 'usb hubs' from redir list, and only show
'non-hub non-interface' usb devs.

But sometime, we want to just simply pass a usb-hub to guest , and dont
care about whatever is plugged on it.

So, I tweaked spice-gtk a bit  like this:

static void spice_usb_device_manager_add_dev(SpiceUsbDeviceManager  *self,
                                             GUdevDevice            *udev)
{
...
    /* Skip hubs */
    devclass = g_udev_device_get_sysfs_attr(udev, "bDeviceClass");
    if (!devclass || !strcmp(devclass, "09"))
    {
-       return;
+      printf(" Yes, it's a hub, and we want it :) \n  ");
...
    }

Then, something interesting happened after I redired a usb-hub with a
usb-disk plugged on it.
1. The hub is successfully redired into guest.
    I can see it in 'Window Device Manager' , it is correctly recognized as
'usb hub' with right usb transfer speed (in my case , 480M).

2. The usb-disk is also detected by windows, and addressed under the hub.
   But we are not lucky enough to see it as 'usb mass storage', but as
'unknown device'.

3. If I redir the usb-disk rather than the hub, that's OK.

my env:
qemu 1.3.1 ( kvm is enabled )
libusb 1.0.9
libusbredir 0.6
spice-gtk 0.19
spice       0.12.3

So my question is , can we directly redir usb hub to guest?
If not, what hinder us to accomplish this?
Maybe I can modify qemu/libusb/... to enable this ,
but now I need your hint and idea :)

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130624/d3a428a3/attachment-0001.html>


More information about the Spice-devel mailing list