]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
usb-host: set ifs.detached as true if kernel driver is not active
authorlinzhecheng <linzhecheng@huawei.com>
Tue, 20 Nov 2018 08:34:19 +0000 (16:34 +0800)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 27 Nov 2018 06:47:57 +0000 (07:47 +0100)
If no kernel driver is active, we can already claim and perform I/O on
it without detaching it.

Signed-off-by: linzhecheng <linzhecheng@huawei.com>
Message-id: 20181120083419.17716-1-linzhecheng@huawei.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/host-libusb.c

index f31e9cbbb8d190b277b1fe8bdcca7b5d2e858872..b6602ded4e1a93e1cb97a62de5fe199b73d9559b 100644 (file)
@@ -1120,6 +1120,9 @@ static void usb_host_detach_kernel(USBHostDevice *s)
         rc = libusb_kernel_driver_active(s->dh, i);
         usb_host_libusb_error("libusb_kernel_driver_active", rc);
         if (rc != 1) {
+            if (rc == 0) {
+                s->ifs[i].detached = true;
+            }
             continue;
         }
         trace_usb_host_detach_kernel(s->bus_num, s->addr, i);