All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Krasnyansky <maxk@kernel.org>
To: qemu-devel@nongnu.org
Cc: kvm@vger.kernel.org, Max Krasnyansky <maxk@kernel.org>
Subject: [PATCH] Extra debugging for Linux USB host.
Date: Sat,  2 Aug 2008 06:36:40 +0000	[thread overview]
Message-ID: <1217659000-4679-1-git-send-email-maxk@kernel.org> (raw)

Print details and status of the control and bulk transfers.

Signed-off-by: Max Krasnyansky <maxk@kernel.org>
---
 qemu/usb-linux.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/qemu/usb-linux.c b/qemu/usb-linux.c
index 78f4b2a..97842c9 100644
--- a/qemu/usb-linux.c
+++ b/qemu/usb-linux.c
@@ -207,7 +207,7 @@ static int usb_host_update_interfaces(USBHostDevice *dev, int configuration)
     i += dev_descr_len;
     while (i < dev->descr_len) {
 #ifdef DEBUG
-        printf("i is %d, descr_len is %d, dl %d, dt %d\n", i, dev->descr_len,
+        printf("husb: i is %d, descr_len is %d, dl %d, dt %d\n", i, dev->descr_len,
                dev->descr[i], dev->descr[i+1]);
 #endif
         if (dev->descr[i+1] != USB_DT_CONFIG) {
@@ -217,7 +217,7 @@ static int usb_host_update_interfaces(USBHostDevice *dev, int configuration)
         config_descr_len = dev->descr[i];
 
 #ifdef DEBUG
-	printf("config #%d need %d\n", dev->descr[i + 5], configuration); 
+	printf("husb: config #%d need %d\n", dev->descr[i + 5], configuration); 
 #endif
 
         if (configuration < 0 || configuration == dev->descr[i + 5])
@@ -227,7 +227,7 @@ static int usb_host_update_interfaces(USBHostDevice *dev, int configuration)
     }
 
     if (i >= dev->descr_len) {
-        printf("usb_host: error - device has no matching configuration\n");
+        printf("husb: error. device has no matching configuration\n");
         goto fail;
     }
     nb_interfaces = dev->descr[i + 4];
@@ -264,7 +264,7 @@ static int usb_host_update_interfaces(USBHostDevice *dev, int configuration)
     }
 
 #ifdef DEBUG
-    printf("usb_host: %d interfaces claimed for configuration %d\n",
+    printf("husb: %d interfaces claimed for configuration %d\n",
            nb_interfaces, configuration);
 #endif
 
@@ -322,10 +322,9 @@ static int usb_host_handle_control(USBDevice *dev,
         ret = ioctl(s->fd, USBDEVFS_SETINTERFACE, &si);
         usb_linux_update_endp_table(s);
     } else if (request == (DeviceOutRequest | USB_REQ_SET_CONFIGURATION)) {
-#ifdef DEBUG
-        printf("usb_host_handle_control: SET_CONFIGURATION request - "
-               "config %d\n", value & 0xff);
-#endif
+        #ifdef DEBUG
+        printf("husb: ctrl set config %d\n", value & 0xff);
+        #endif
         if (s->configuration != (value & 0xff)) {
             s->configuration = (value & 0xff);
             intf_update_required = 1;
@@ -341,6 +340,11 @@ static int usb_host_handle_control(USBDevice *dev,
         ct.timeout = 50;
         ct.data = data;
         ret = ioctl(s->fd, USBDEVFS_CONTROL, &ct);
+
+        #ifdef DEBUG
+        printf("husb: ctrl. req 0x%x val 0x%x index %d len %d ret %d errno %d\n",
+            request, value, index, length, ret, errno);
+        #endif
     }
 
     if (ret < 0) {
@@ -383,15 +387,18 @@ static int usb_host_handle_data(USBDevice *dev, USBPacket *p)
     bt.timeout = 50;
     bt.data = p->data;
     ret = ioctl(s->fd, USBDEVFS_BULK, &bt);
+
+#ifdef DEBUG
+    printf("husb: bulk. ep %d len %d ret %d errno %d\n",
+        bt.ep, bt.len, ret, errno);
+#endif
+
     if (ret < 0) {
         switch(errno) {
         case ETIMEDOUT:
             return USB_RET_NAK;
         case EPIPE:
         default:
-#ifdef DEBUG
-            printf("handle_data: errno=%d\n", errno);
-#endif
             return USB_RET_STALL;
         }
     } else {
-- 
1.5.5.1


WARNING: multiple messages have this Message-ID (diff)
From: Max Krasnyansky <maxk@kernel.org>
To: qemu-devel@nongnu.org
Cc: kvm@vger.kernel.org, Max Krasnyansky <maxk@kernel.org>
Subject: [Qemu-devel] [PATCH] Extra debugging for Linux USB host.
Date: Sat,  2 Aug 2008 06:36:40 +0000	[thread overview]
Message-ID: <1217659000-4679-1-git-send-email-maxk@kernel.org> (raw)

Print details and status of the control and bulk transfers.

Signed-off-by: Max Krasnyansky <maxk@kernel.org>
---
 qemu/usb-linux.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/qemu/usb-linux.c b/qemu/usb-linux.c
index 78f4b2a..97842c9 100644
--- a/qemu/usb-linux.c
+++ b/qemu/usb-linux.c
@@ -207,7 +207,7 @@ static int usb_host_update_interfaces(USBHostDevice *dev, int configuration)
     i += dev_descr_len;
     while (i < dev->descr_len) {
 #ifdef DEBUG
-        printf("i is %d, descr_len is %d, dl %d, dt %d\n", i, dev->descr_len,
+        printf("husb: i is %d, descr_len is %d, dl %d, dt %d\n", i, dev->descr_len,
                dev->descr[i], dev->descr[i+1]);
 #endif
         if (dev->descr[i+1] != USB_DT_CONFIG) {
@@ -217,7 +217,7 @@ static int usb_host_update_interfaces(USBHostDevice *dev, int configuration)
         config_descr_len = dev->descr[i];
 
 #ifdef DEBUG
-	printf("config #%d need %d\n", dev->descr[i + 5], configuration); 
+	printf("husb: config #%d need %d\n", dev->descr[i + 5], configuration); 
 #endif
 
         if (configuration < 0 || configuration == dev->descr[i + 5])
@@ -227,7 +227,7 @@ static int usb_host_update_interfaces(USBHostDevice *dev, int configuration)
     }
 
     if (i >= dev->descr_len) {
-        printf("usb_host: error - device has no matching configuration\n");
+        printf("husb: error. device has no matching configuration\n");
         goto fail;
     }
     nb_interfaces = dev->descr[i + 4];
@@ -264,7 +264,7 @@ static int usb_host_update_interfaces(USBHostDevice *dev, int configuration)
     }
 
 #ifdef DEBUG
-    printf("usb_host: %d interfaces claimed for configuration %d\n",
+    printf("husb: %d interfaces claimed for configuration %d\n",
            nb_interfaces, configuration);
 #endif
 
@@ -322,10 +322,9 @@ static int usb_host_handle_control(USBDevice *dev,
         ret = ioctl(s->fd, USBDEVFS_SETINTERFACE, &si);
         usb_linux_update_endp_table(s);
     } else if (request == (DeviceOutRequest | USB_REQ_SET_CONFIGURATION)) {
-#ifdef DEBUG
-        printf("usb_host_handle_control: SET_CONFIGURATION request - "
-               "config %d\n", value & 0xff);
-#endif
+        #ifdef DEBUG
+        printf("husb: ctrl set config %d\n", value & 0xff);
+        #endif
         if (s->configuration != (value & 0xff)) {
             s->configuration = (value & 0xff);
             intf_update_required = 1;
@@ -341,6 +340,11 @@ static int usb_host_handle_control(USBDevice *dev,
         ct.timeout = 50;
         ct.data = data;
         ret = ioctl(s->fd, USBDEVFS_CONTROL, &ct);
+
+        #ifdef DEBUG
+        printf("husb: ctrl. req 0x%x val 0x%x index %d len %d ret %d errno %d\n",
+            request, value, index, length, ret, errno);
+        #endif
     }
 
     if (ret < 0) {
@@ -383,15 +387,18 @@ static int usb_host_handle_data(USBDevice *dev, USBPacket *p)
     bt.timeout = 50;
     bt.data = p->data;
     ret = ioctl(s->fd, USBDEVFS_BULK, &bt);
+
+#ifdef DEBUG
+    printf("husb: bulk. ep %d len %d ret %d errno %d\n",
+        bt.ep, bt.len, ret, errno);
+#endif
+
     if (ret < 0) {
         switch(errno) {
         case ETIMEDOUT:
             return USB_RET_NAK;
         case EPIPE:
         default:
-#ifdef DEBUG
-            printf("handle_data: errno=%d\n", errno);
-#endif
             return USB_RET_STALL;
         }
     } else {
-- 
1.5.5.1

             reply	other threads:[~2008-08-02  6:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-02  6:36 Max Krasnyansky [this message]
2008-08-02  6:36 ` [Qemu-devel] [PATCH] Extra debugging for Linux USB host Max Krasnyansky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1217659000-4679-1-git-send-email-maxk@kernel.org \
    --to=maxk@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.