usb-host: set ifs.detached as true if kernel driver is not active
PATCH 1/1 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.
hw/usb/host-libusb.c +4 -0
@@ -1119,6 +1119,10 @@ static void usb_host_detach_kernel(USBHostDevice *s)for (i =0 ; i <USB_MAX_INTERFACES ; i++) { rc =libusb_kernel_driver_active (s->dh, i);usb_host_libusb_error ("libusb_kernel_driver_active" , rc); +if (rc ==0 ) { + s->ifs[i].detached = true; +continue ; + }if (rc !=1 ) {continue ; }
Signature · 1 line
2.12.2.windows.2
Quoted 10 lines · linzhecheng
If no kernel driver is active, we can already claim and perform I/O on it without detaching it.
Signed-off-by linzhecheng <[email protected]>hw/usb/host-libusb.c +0
-0
hw/usb/host-libusb.c static void usb_host_detach_kernel(USBHostDevice *s) · line 1126
Quoted 8 lines
hw/usb/host-libusb.c +4
-0@@ -1119,6 +1119,10 @@ static void usb_host_detach_kernel(USBHostDevice *s)for (i =0 ; i <USB_MAX_INTERFACES ; i++) { rc =libusb_kernel_driver_active (s->dh, i);usb_host_libusb_error ("libusb_kernel_driver_active" , rc); +if (rc ==0 ) { + s->ifs[i].detached = true; +continue ; + }if (rc !=1 ) {
Can't we just add detached = true here?
hw/usb/host-libusb.c static void usb_host_detach_kernel(USBHostDevice *s) · line 1128
Quoted 2 lines
hw/usb/host-libusb.c +0
-0continue ; }
cheers,
Gerd
Quoted 32 lines
-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Tuesday, November 20, 2018 4:25 PM
To: linzhecheng <[email protected]>
Cc: [email protected]; Zhoujian (jay) <[email protected]>; wangxin (U) <[email protected]>
Subject: Re: [PATCH] usb-host: set ifs.detached as true if kernel driver is not activehw/usb/host-libusb.c static void
Quoted 10 lines · linzhecheng
If no kernel driver is active, we can already claim and perform I/O on it without detaching it.
Signed-off-by linzhecheng <[email protected]>hw/usb/host-libusb.c index renamed from hw/usb/host-libusb.c +0
-0
f31e9cbbb8..db4ae1e6e8100644hw/usb/host-libusb.c +0
-0@@ -1119,6 +1119,10 @@ static void
usb_host_detach_kernel(USBHostDevice *s)hw/usb/host-libusb.c static void usb_host_detach_kernel(USBHostDevice *s) · line 1126
Quoted 8 lines
hw/usb/host-libusb.c +4
-0for (i =0 ; i <USB_MAX_INTERFACES ; i++) { rc =libusb_kernel_driver_active (s->dh, i);usb_host_libusb_error ("libusb_kernel_driver_active" , rc); +if (rc ==0 ) { + s->ifs[i].detached = true; +continue ; + }if (rc !=1 ) {
Quoted 1 line
Can't we just add detached = true here?
Yes, it's better.
Quoted 6 lines
hw/usb/host-libusb.c static void usb_host_detach_kernel(USBHostDevice *s) · line 1128
Quoted 3 lines
hw/usb/host-libusb.c +0
-0continue ; }cheers,
Gerd