KVM -How to add many USB Redirectors

Here is a challenge. I have a device that has one USB connector, that is essentially a hub with multiple radios. I would like to pass this through to a kvm virtual machine.

The problem is this device shows up as many separate USB devices. Normally I would just add USB redirectors, but this device goes beyond the limit of redirectors that can be assigned to a single controller.
I can’t add another USB controller, that does not seem to be allowed.

Does anyone know how I could pass more than the standard USB devices to the guest OS? I am looking at over 14 devices.

I am having difficulties installing the product’s main driver with OpenSUSE as well. I am not sure if I need to have those drivers working before I can pass it on to the guest.

If anyone is curious what kind of crazy device would do that, it is the hak5 wifi coconut. https://docs.hak5.org/wifi-coconut/
If anyone else was able to get that working on OpenSUSE, I would love to know that as well.

Thanks in advance.

Hi
Interesting device :wink:

When it’s plugged into the hosts system and look at the output from lsusb -tvv does it show the device id’s as all the same or each channel a different ID?

I suspect some crafting of the kvm xml file with perhaps the mac address of each channel may work.

Would you have a good reference that I could read? I am trying to get a handle on how USB devices present themselves and how that transfers to the guest. The redirectors are simple and straight forward, but not enough. I am assuming that I can’t just go in and up the number of redirectors in the XML to try an override the GUI limitations. The other option that I see is to add a USB Host Device but is also limited by the number of USB devices. I am assuming the number is a restriction of the USB controller functionality. This I am trying to pass through looks like a combination of Terminus hubs and Ralink radios.

Is there a way to add an additional USB controller to the VM? I am thinking that would increase the USB devices maybe??? The GUI will not allow that. Any thoughts or words of wisdom? Thanks.

This is the output:
|__ Port 13: Dev 6, If 0, Class=Hub, Driver=hub/7p, 480M
ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
/sys/bus/usb/devices/1-13 /dev/bus/usb/001/006
|__ Port 1: Dev 7, If 0, Class=Hub, Driver=hub/4p, 480M
ID 1a40:0101 Terminus Technology Inc. Hub
/sys/bus/usb/devices/1-13.1 /dev/bus/usb/001/007
|__ Port 4: Dev 21, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.1.4 /dev/bus/usb/001/021
|__ Port 2: Dev 14, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.1.2 /dev/bus/usb/001/014
|__ Port 3: Dev 18, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.1.3 /dev/bus/usb/001/018
|__ Port 1: Dev 10, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.1.1 /dev/bus/usb/001/010
|__ Port 2: Dev 8, If 0, Class=Hub, Driver=hub/4p, 480M
ID 1a40:0101 Terminus Technology Inc. Hub
/sys/bus/usb/devices/1-13.2 /dev/bus/usb/001/008
|__ Port 3: Dev 20, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.2.3 /dev/bus/usb/001/020
|__ Port 1: Dev 12, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.2.1 /dev/bus/usb/001/012
|__ Port 4: Dev 23, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.2.4 /dev/bus/usb/001/023
|__ Port 2: Dev 16, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.2.2 /dev/bus/usb/001/016
|__ Port 3: Dev 9, If 0, Class=Hub, Driver=hub/4p, 480M
ID 1a40:0101 Terminus Technology Inc. Hub
/sys/bus/usb/devices/1-13.3 /dev/bus/usb/001/009
|__ Port 1: Dev 13, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.3.1 /dev/bus/usb/001/013
|__ Port 2: Dev 17, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.3.2 /dev/bus/usb/001/017
|__ Port 4: Dev 11, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.4 /dev/bus/usb/001/011
|__ Port 5: Dev 15, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.5 /dev/bus/usb/001/015
|__ Port 6: Dev 19, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.6 /dev/bus/usb/001/019
|__ Port 7: Dev 22, If 0, Class=Vendor Specific Class, Driver=, 480M
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
/sys/bus/usb/devices/1-13.7 /dev/bus/usb/001/022

Hi
Is this a desktop system? The easiest if it is would be to add a PCIe USB hub in a spare slot, and then pass that PCIe device through to the VM for your device to plug into. Might be easier to use vfio-pci for this as well…

In virt-manager if you browse the USB device (Add Device), can you see each of the hubs 1a40:0101 Terminus Technology Inc?

Sorry, let me repost my output in a manner that keeps the spaces.

    |__ Port 13: Dev 6, If 0, Class=Hub, Driver=hub/7p, 480M        ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
        /sys/bus/usb/devices/1-13  /dev/bus/usb/001/006
        |__ Port 1: Dev 7, If 0, Class=Hub, Driver=hub/4p, 480M
            ID 1a40:0101 Terminus Technology Inc. Hub
            /sys/bus/usb/devices/1-13.1  /dev/bus/usb/001/007
            |__ Port 4: Dev 21, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
                ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
                /sys/bus/usb/devices/1-13.1.4  /dev/bus/usb/001/021
            |__ Port 2: Dev 14, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
                ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
                /sys/bus/usb/devices/1-13.1.2  /dev/bus/usb/001/014
            |__ Port 3: Dev 18, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
                ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
                /sys/bus/usb/devices/1-13.1.3  /dev/bus/usb/001/018
            |__ Port 1: Dev 10, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
                ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
                /sys/bus/usb/devices/1-13.1.1  /dev/bus/usb/001/010
        |__ Port 2: Dev 8, If 0, Class=Hub, Driver=hub/4p, 480M
            ID 1a40:0101 Terminus Technology Inc. Hub
            /sys/bus/usb/devices/1-13.2  /dev/bus/usb/001/008
            |__ Port 3: Dev 20, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
                ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
                /sys/bus/usb/devices/1-13.2.3  /dev/bus/usb/001/020
            |__ Port 1: Dev 12, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
                ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
                /sys/bus/usb/devices/1-13.2.1  /dev/bus/usb/001/012
            |__ Port 4: Dev 23, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
                ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
                /sys/bus/usb/devices/1-13.2.4  /dev/bus/usb/001/023
            |__ Port 2: Dev 16, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
                ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
                /sys/bus/usb/devices/1-13.2.2  /dev/bus/usb/001/016
        |__ Port 3: Dev 9, If 0, Class=Hub, Driver=hub/4p, 480M
            ID 1a40:0101 Terminus Technology Inc. Hub
            /sys/bus/usb/devices/1-13.3  /dev/bus/usb/001/009
            |__ Port 1: Dev 13, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
                ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
                /sys/bus/usb/devices/1-13.3.1  /dev/bus/usb/001/013
            |__ Port 2: Dev 17, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
                ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
                /sys/bus/usb/devices/1-13.3.2  /dev/bus/usb/001/017
        |__ Port 4: Dev 11, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
            ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
            /sys/bus/usb/devices/1-13.4  /dev/bus/usb/001/011
        |__ Port 5: Dev 15, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
            ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
            /sys/bus/usb/devices/1-13.5  /dev/bus/usb/001/015
        |__ Port 6: Dev 19, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
            ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
            /sys/bus/usb/devices/1-13.6  /dev/bus/usb/001/019
        |__ Port 7: Dev 22, If 0, Class=Vendor Specific Class, Driver=, 480M
            ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
            /sys/bus/usb/devices/1-13.7  /dev/bus/usb/001/022

I would like to do this with laptop functionality. Yes, the hub shows up. With just a few redirectors I can add that device and start the guest.
On the host I have the devices I originally left out of the post and the hub:

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    /sys/bus/usb/devices/usb2  /dev/bus/usb/002/001
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/16p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    /sys/bus/usb/devices/usb1  /dev/bus/usb/001/001
    |__ Port 2: Dev 2, If 2, Class=Audio, Driver=snd-usb-audio, 480M
        ID 046d:085c Logitech, Inc. C922 Pro Stream Webcam
        /sys/bus/usb/devices/1-2  /dev/bus/usb/001/002
    |__ Port 2: Dev 2, If 0, Class=Video, Driver=uvcvideo, 480M
        ID 046d:085c Logitech, Inc. C922 Pro Stream Webcam
        /sys/bus/usb/devices/1-2  /dev/bus/usb/001/002
    |__ Port 2: Dev 2, If 3, Class=Audio, Driver=snd-usb-audio, 480M
        ID 046d:085c Logitech, Inc. C922 Pro Stream Webcam
        /sys/bus/usb/devices/1-2  /dev/bus/usb/001/002
    |__ Port 2: Dev 2, If 1, Class=Video, Driver=uvcvideo, 480M
        ID 046d:085c Logitech, Inc. C922 Pro Stream Webcam
        /sys/bus/usb/devices/1-2  /dev/bus/usb/001/002
    |__ Port 4: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
        ID 03f0:344a HP, Inc 
        /sys/bus/usb/devices/1-4  /dev/bus/usb/001/005
    |__ Port 4: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        ID 03f0:344a HP, Inc 
        /sys/bus/usb/devices/1-4  /dev/bus/usb/001/005
    |__ Port 11: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        ID 046d:c069 Logitech, Inc. M-U0007 [Corded Mouse M500]
        /sys/bus/usb/devices/1-11  /dev/bus/usb/001/004
    |__ Port 13: Dev 60, If 0, Class=Hub, Driver=usbfs/0p, 480M
        ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
        /sys/bus/usb/devices/1-13  /dev/bus/usb/001/060

On the guest I have:

┌──(kali㉿kali)-~]
└─$ lsusb -tvv
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 5000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    /sys/bus/usb/devices/usb2  /dev/bus/usb/002/001
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    /sys/bus/usb/devices/usb1  /dev/bus/usb/001/001
    |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 480M
        ID 0627:0001 Adomax Technology Co., Ltd
        /sys/bus/usb/devices/1-1  /dev/bus/usb/001/002
    |__ Port 4: Dev 3, If 0, Class=Hub, Driver=hub/7p, 480M
        ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
        /sys/bus/usb/devices/1-4  /dev/bus/usb/001/003



So on the guest I can see the hub, but nothing beyond that.

Hi
So can you see the main ones in virt-manager Port 1-4 that say ‘Hub’, not the individual devices RT5370?

In virt-manager when I go to add “USB Host device” I can see everything, hubs and radios. I can only set up 14 devices. If that makes sense.
The example just before with the host and guest is what is visible after I select only the main hub USB and start the VM.

If I add any of the sub terminus element and try to start I get.

Error starting domain: internal error: Did not find USB device 1a40:0101 bus:1 device:25


Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 72, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 108, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1407, in startup
    self._backend.create()
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 1353, in create
    raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: internal error: Did not find USB device 1a40:0101 bus:1 device:25



I hope I am making sense.

Hi
It does, I think that’s a compile time limit on libvirt… consider a bug report, to increase the number of USB devices? Compile it all yourself? Install a USB card and pass that through, maybe a separate hub may work…

Thank you. That makes a lot of sense. I didn’t think about it being a compile issue. That saves me from going down a whole bunch of rabbit holes.

I need to do a fairly standard solution as this is for education purposes in our classes. A wireshark capture across all channels instead of scanning two streams helps to illuminate what is going on. It also helps to illuminate deauths and recoveries in a fairly unique perspective. If we have to do special compiles or other elements off of factory defaults then we will need to add that to our lab imaging. We are currently using OpenSUSE as the lab hosts and kali in VMs. The students manage the data center and the classrooms so they will be trying to keep the hardware to a minimum as they manage the PXE booting on the FOG servers, and manage the image deployments.

Now I at least have a better feel for which direction to run. Thank you so much for your help.