hotplugger icon indicating copy to clipboard operation
hotplugger copied to clipboard

No Devices Connect

Open VladislavF opened this issue 4 years ago • 4 comments

Hello,

I am not sure where else to ask, so I'm just opening an issue here.

Problem: TL;DR upon following all instructions, no devices connect to my Windows 10 VM. I have tried with a USB kvm switch as well as a USB3.0 thumb drive with the same results.

Detail: I am trying to switch a mouse and keyboard with a USB KVM switch. I realize this may be mildly more complicated than the intended purpose here, but since the switch is basically just a hub, I figured adding all the ports that show up in the monitor script should work. Heck, even just a single device hot-plugging would be good, but I can't get that either.

It seems to be failing to remove the USB devices, but I imagine that maybe be because they never attach in the first place. Like I mentioned above, result is the same with just a single USB drive.

Windows sees the xhci controllers added by the command line, but has absolutely no reaction upon connecting or disconnecting USB devices from the ports I've added to the config. The QMP socket file shows up and the scripts don't seem to have any issues with it. I'm just confused since there doesn't seem to be any indication of any issues anywhere except for the disconnect failures. The devices in question always just end up connecting to the host.

OS: I'm on Ubuntu 20.04 with KVM/QEMU 5.0.

Steps to reproduce: Simply follow all instructions, and attempt to connect a USB device via hotplug.

Logs are attached. Thank you for your help! udev.log hotplugger.log win10.xml.txt config.yml.txt

VladislavF avatar Dec 28 '21 23:12 VladislavF

Did you ever resolve this? I encountered the same error from your logs in the middle of many other errors so I am not sure exactly what fixed it but I now have no errors - although still no USB visible on Debian. More here: darkguy2008/hotplugger#4

AnonymousAard avatar Jun 27 '22 23:06 AnonymousAard

This is broken because the qmp commands did not return anything. In the current QEMU master branch @ https://github.com/qemu/qemu/blob/9a99f964b152f8095949bbddca7841744ad418da/hmp-commands-info.hx#L336-L359, we can see that only info usb is handled (by https://github.com/qemu/qemu/commit/fc30920731470a44c69c8359be45b72ac7314fb6) whereas info usbhost does nothing.

Attempting to call info usbhost will now throw the following error:

$ printf "{'execute':'qmp_capabilities'}\n{'execute':'human-monitor-command', 'arguments':{'command-line':'info usbhost'}}" | sudo socat - unix-connect:/tmp/.qmp-sock 
{
    "QMP": {
        "version": {
            "qemu": {
                "micro": 0,
                "minor": 0,
                "major": 7
            },
            "package": ""
        },
        "capabilities": [
            "oob"
        ]
    }
}
{
    "return": {
    }
}
{
    "return": "Command \"info usbhost\" is not available.\r\n"
}

hansemro avatar Aug 28 '22 07:08 hansemro

I replaced call to info usbhost with pyusb/libusb1 device queries to get port number here: https://github.com/hansemro/hotplugger/commit/8f3443ad28a5852cf8c7269746efc813be0c7b60

hansemro avatar Aug 28 '22 09:08 hansemro

I hate to bump a year-old thread, but this isn't working. I applied the diff from @hansemro and now my hotplugger.py doesn't generate any output at all. I'm still getting the "info usbhost" is not available error.

themaskedcrusader avatar Jun 16 '23 22:06 themaskedcrusader