qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 4/5] usb-linux.c: more improved debugging messages (


From: Ian Jackson
Subject: [Qemu-devel] [PATCH 4/5] usb-linux.c: more improved debugging messages (endpoint table)
Date: Wed, 4 Feb 2009 15:31:15 +0000

Use dprintf to dump some debugging output while we walk the endpoint
table in usb_linux_update_endp_table.

Signed-off-by: Ian Jackson <address@hidden>
---
 usb-linux.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/usb-linux.c b/usb-linux.c
index 8498b1d..b592514 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -800,6 +800,8 @@ static int usb_linux_update_endp_table(USBHostDevice *s)
     ct.data = &configuration;
     ct.timeout = 50;
 
+    dprintf("husb: updating endpoint table for %d.%d\n", s->bus_num, s->addr);
+
     ret = ioctl(s->fd, USBDEVFS_CONTROL, &ct);
     if (ret < 0) {
         perror("usb_linux_update_endp_table");
@@ -807,8 +809,10 @@ static int usb_linux_update_endp_table(USBHostDevice *s)
     }
 
     /* in address state */
-    if (configuration == 0)
+    if (configuration == 0) {
+        dprintf("husb: ... in address state\n");
         return 1;
+    }
 
     /* get the desired configuration, interface, and endpoint descriptors
      * from device description */
@@ -824,6 +828,8 @@ static int usb_linux_update_endp_table(USBHostDevice *s)
     i += descriptors[i];
 
     while (i < length) {
+        dprintf("husb:  descriptor offset 0x%x\n", i);
+
         if (descriptors[i + 1] != USB_DT_INTERFACE ||
             (descriptors[i + 1] == USB_DT_INTERFACE &&
              descriptors[i + 4] == 0)) {
@@ -841,6 +847,8 @@ static int usb_linux_update_endp_table(USBHostDevice *s)
         ct.data = &alt_interface;
         ct.timeout = 50;
 
+        dprintf("husb:   interface 0x%x\n", interface);
+
         ret = ioctl(s->fd, USBDEVFS_CONTROL, &ct);
         if (ret < 0) {
             perror("usb_linux_update_endp_table");
@@ -851,6 +859,7 @@ static int usb_linux_update_endp_table(USBHostDevice *s)
          * and has endpoints */
         if (descriptors[i + 3] != alt_interface) {
             i += descriptors[i];
+            dprintf("husb:   ... active, with endpoints\n");
             continue;
         }
 
@@ -862,11 +871,19 @@ static int usb_linux_update_endp_table(USBHostDevice *s)
             break;
 
         while (i < length) {
+            dprintf("husb:    endpoint offset 0x%x\n", i);
             if (descriptors[i + 1] != USB_DT_ENDPOINT)
                 break;
 
             devep = descriptors[i + 2];
-            switch (descriptors[i + 3] & 0x3) {
+            int eptype = descriptors[i + 3] & 0x3;
+            
+            dprintf("husb:     %02x%02x%02x%02x... devep=0x%x type=0x%x\n",
+                    descriptors[i], descriptors[i+1],
+                    descriptors[i+2], descriptors[i+3],
+                    devep, eptype);
+            
+            switch (eptype) {
             case 0x00:
                 type = USBDEVFS_URB_TYPE_CONTROL;
                 break;
@@ -889,6 +906,7 @@ static int usb_linux_update_endp_table(USBHostDevice *s)
             i += descriptors[i];
         }
     }
+    dprintf("husb: endpoint table update complete.\n");
     return 0;
 }
 
-- 
1.4.4.4





reply via email to

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