Extra debugging for Linux USB host.
PATCH 1/1 Extra debugging for Linux USB host.
Print details and status of the control and bulk transfers.
Signed-off-by Max Krasnyansky <[email protected]>
--- qemu/usb-linux.c | 29 ++++++++++++++++++----------- 1 files changed, 18 insertions(+), 11 deletions(-)
qemu/usb-linux.c +18 -11
@@ -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 {
Signature · 1 line
1.5.5.1