|
|
9ae3a8 |
From 50120520c3ec6385d2d36f5f0fe37acf8d230e91 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 6 Nov 2013 12:16:59 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 64/81] usb-host-libusb: Configuration 0 may be a valid configuration
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1383740220-2049-3-git-send-email-kraxel@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55512
|
|
|
9ae3a8 |
O-Subject: [RHEL-7 qemu-kvm PATCH 2/3] usb-host-libusb: Configuration 0 may be a valid configuration
|
|
|
9ae3a8 |
Bugzilla: 980383
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Bandan Das <bsd@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Quoting from: linux/Documentation/ABI/stable/sysfs-bus-usb:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Note that some devices, in violation of the USB spec, have a
|
|
|
9ae3a8 |
configuration with a value equal to 0. Writing 0 to
|
|
|
9ae3a8 |
bConfigurationValue for these devices will install that
|
|
|
9ae3a8 |
configuration, rather then unconfigure the device.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
So don't compare the configuration value against 0 to check for unconfigured
|
|
|
9ae3a8 |
devices, instead check for a LIBUSB_ERROR_NOT_FOUND return from
|
|
|
9ae3a8 |
libusb_get_active_config_descriptor().
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 1294ca797c6bee39d4dbc3e92010873ce4047e0e)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/usb/host-libusb.c | 9 ++++-----
|
|
|
9ae3a8 |
1 file changed, 4 insertions(+), 5 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/usb/host-libusb.c | 9 ++++-----
|
|
|
9ae3a8 |
1 files changed, 4 insertions(+), 5 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
|
|
|
9ae3a8 |
index 9c8905e..9b226e4 100644
|
|
|
9ae3a8 |
--- a/hw/usb/host-libusb.c
|
|
|
9ae3a8 |
+++ b/hw/usb/host-libusb.c
|
|
|
9ae3a8 |
@@ -992,15 +992,14 @@ static int usb_host_claim_interfaces(USBHostDevice *s, int configuration)
|
|
|
9ae3a8 |
udev->ninterfaces = 0;
|
|
|
9ae3a8 |
udev->configuration = 0;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (configuration == 0) {
|
|
|
9ae3a8 |
- /* address state - ignore */
|
|
|
9ae3a8 |
- return USB_RET_SUCCESS;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
usb_host_detach_kernel(s);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
rc = libusb_get_active_config_descriptor(s->dev, &conf;;
|
|
|
9ae3a8 |
if (rc != 0) {
|
|
|
9ae3a8 |
+ if (rc == LIBUSB_ERROR_NOT_FOUND) {
|
|
|
9ae3a8 |
+ /* address state - ignore */
|
|
|
9ae3a8 |
+ return USB_RET_SUCCESS;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
return USB_RET_STALL;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|