From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KPB8L-0004r9-R9 for qemu-devel@nongnu.org; Sat, 02 Aug 2008 03:02:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KPB8L-0004qx-6y for qemu-devel@nongnu.org; Sat, 02 Aug 2008 03:02:33 -0400 Received: from [199.232.76.173] (port=59939 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KPB8L-0004qu-17 for qemu-devel@nongnu.org; Sat, 02 Aug 2008 03:02:33 -0400 Received: from mx20.gnu.org ([199.232.41.8]:60606) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KPB8K-0007U6-8L for qemu-devel@nongnu.org; Sat, 02 Aug 2008 03:02:32 -0400 Received: from hera.kernel.org ([140.211.167.34]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KPB4b-0002mg-9C for qemu-devel@nongnu.org; Sat, 02 Aug 2008 02:58:43 -0400 From: Max Krasnyansky Date: Sat, 2 Aug 2008 06:36:40 +0000 Message-Id: <1217659000-4679-1-git-send-email-maxk@kernel.org> Subject: [Qemu-devel] [PATCH] Extra debugging for Linux USB host. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, Max Krasnyansky Print details and status of the control and bulk transfers. Signed-off-by: Max Krasnyansky --- 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