[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/7] usb-host-libusb: Configuration 0 may be a valid
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 2/7] usb-host-libusb: Configuration 0 may be a valid configuration |
Date: |
Thu, 24 Oct 2013 15:11:02 +0200 |
From: Hans de Goede <address@hidden>
Quoting from: linux/Documentation/ABI/stable/sysfs-bus-usb:
Note that some devices, in violation of the USB spec, have a
configuration with a value equal to 0. Writing 0 to
bConfigurationValue for these devices will install that
configuration, rather then unconfigure the device.
So don't compare the configuration value against 0 to check for unconfigured
devices, instead check for a LIBUSB_ERROR_NOT_FOUND return from
libusb_get_active_config_descriptor().
Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/host-libusb.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 428c7c5..35bae55 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -992,15 +992,14 @@ static int usb_host_claim_interfaces(USBHostDevice *s,
int configuration)
udev->ninterfaces = 0;
udev->configuration = 0;
- if (configuration == 0) {
- /* address state - ignore */
- return USB_RET_SUCCESS;
- }
-
usb_host_detach_kernel(s);
rc = libusb_get_active_config_descriptor(s->dev, &conf);
if (rc != 0) {
+ if (rc == LIBUSB_ERROR_NOT_FOUND) {
+ /* address state - ignore */
+ return USB_RET_SUCCESS;
+ }
return USB_RET_STALL;
}
--
1.8.3.1
- [Qemu-devel] [PULL for-1.7 0/7] usb fixes, Gerd Hoffmann, 2013/10/24
- [Qemu-devel] [PATCH 7/7] usb-hcd-xhci: Update endpoint context dequeue pointer for streams too, Gerd Hoffmann, 2013/10/24
- [Qemu-devel] [PATCH 1/7] usb-host-libusb: Fix reset handling, Gerd Hoffmann, 2013/10/24
- [Qemu-devel] [PATCH 6/7] usb-hcd-xhci: Report completion of active transfer with CC_STOPPED on ep stop, Gerd Hoffmann, 2013/10/24
- [Qemu-devel] [PATCH 2/7] usb-host-libusb: Configuration 0 may be a valid configuration,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 5/7] usb-hcd-xhci: Remove unused cancelled member from XHCITransfer, Gerd Hoffmann, 2013/10/24
- [Qemu-devel] [PATCH 3/7] usb-host-libusb: Detach kernel drivers earlier, Gerd Hoffmann, 2013/10/24
- [Qemu-devel] [PATCH 4/7] usb-hcd-xhci: Remove unused sstreamsm member from XHCIStreamContext, Gerd Hoffmann, 2013/10/24