thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-usb-host-libusb-Configuration-0-may-be-a-valid-confi.patch

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