Browse Source

usb-host: set ifs.detached as true if kernel driver is not active

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>
linzhecheng 6 năm trước cách đây
mục cha
commit
933d2d4bf2
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      hw/usb/host-libusb.c

+ 3 - 0
hw/usb/host-libusb.c

@@ -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);