* [Qemu-devel] [PATCH] Extra debugging for Linux USB host.
@ 2008-08-02 6:36 Max Krasnyansky
0 siblings, 0 replies; only message in thread
From: Max Krasnyansky @ 2008-08-02 6:36 UTC (permalink / raw)
To: qemu-devel; +Cc: kvm, Max Krasnyansky
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-08-02 7:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-02 6:36 [Qemu-devel] [PATCH] Extra debugging for Linux USB host Max Krasnyansky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).