qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 05/14] usb-linux: Don't call usb_host_close when usb


From: Hans de Goede
Subject: [Qemu-devel] [PATCH 05/14] usb-linux: Don't call usb_host_close when usb_host_open fails
Date: Tue, 31 May 2011 11:35:21 +0200

---
 usb-linux.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/usb-linux.c b/usb-linux.c
index e6c6138..544aea3 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -363,13 +363,16 @@ static int usb_host_claim_interfaces(USBHostDevice *dev, 
int configuration)
     const char *op = NULL;
     int dev_descr_len, config_descr_len;
     int interface, nb_interfaces;
-    int ret, i;
+    int ret, i, close_on_nodev;
 
     if (configuration == 0) /* address state - ignore */
         return 1;
 
     DPRINTF("husb: claiming interfaces. config %d\n", configuration);
 
+    /* Don't close on nodev when called from usb_host_open (which passes -1) */
+    close_on_nodev = (configuration == -1) ? 0 : 1;
+
     i = 0;
     dev_descr_len = dev->descr[0];
     if (dev_descr_len > dev->descr_len) {
@@ -445,7 +448,7 @@ static int usb_host_claim_interfaces(USBHostDevice *dev, 
int configuration)
     return 1;
 
 fail:
-    if (errno == ENODEV) {
+    if (errno == ENODEV && close_on_nodev) {
         do_disconnect(dev);
     }
     perror(op);
-- 
1.7.5.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]