File libusb0-debug-more.patch of Package libusb
Index: libusb-0.1.12/linux.c
===================================================================
--- libusb-0.1.12.orig/linux.c
+++ libusb-0.1.12/linux.c
@@ -149,6 +149,8 @@ int usb_control_msg(usb_dev_handle *dev,
ctrl.data = bytes;
ctrl.timeout = timeout;
+ if (usb_debug >= 3)
+ fprintf(stderr, "usb_control_msg: type %d size %d timeout %d\n", requesttype, size, timeout);
ret = ioctl(dev->fd, IOCTL_USB_CONTROL, &ctrl);
if (ret < 0)
USB_ERROR_STR(-errno, "error sending control message: %s", strerror(errno));
@@ -181,6 +183,8 @@ static int usb_urb_transfer(usb_dev_hand
* Get actual time, and add the timeout value. The result is the absolute
* time where we have to quit waiting for an message.
*/
+ if (usb_debug >= 3)
+ fprintf(stderr, "usb_urb_transfer: endpoint %02x type %d size %d timeout %d\n", ep, urbtype, size, timeout);
gettimeofday(&tv_ref, NULL);
tv_ref.tv_sec = tv_ref.tv_sec + timeout / 1000;
tv_ref.tv_usec = tv_ref.tv_usec + (timeout % 1000) * 1000;
@@ -207,6 +211,8 @@ static int usb_urb_transfer(usb_dev_hand
urb.number_of_packets = 0; /* don't do isochronous yet */
urb.usercontext = NULL;
+ if (usb_debug >= 3)
+ fprintf(stderr, "usb_urb_transfer: IOCTL_USB_SUBMITURB endpoint %02x size %d actual lenght %d\n", urb.endpoint, urb.buffer_length, urb.actual_length);
ret = ioctl(dev->fd, IOCTL_USB_SUBMITURB, &urb);
if (ret < 0) {
USB_ERROR_STR(-errno, "error submitting URB: %s", strerror(errno));
@@ -260,6 +266,8 @@ restart:
else
rc = urb.status;
+ if (usb_debug >= 3)
+ fprintf(stderr, "usb_urb_transfer: sending IOCTL_USB_DISCARDURB\n");
ret = ioctl(dev->fd, IOCTL_USB_DISCARDURB, &urb);
if (ret < 0 && errno != EINVAL && usb_debug >= 1)
fprintf(stderr, "error discarding URB: %s", strerror(errno));
@@ -269,11 +277,15 @@ restart:
* then we need to reap it or else the next time we call this function,
* we'll get the previous completion and exit early
*/
+ if (usb_debug >= 3)
+ fprintf(stderr, "usb_urb_transfer: sending IOCTL_USB_REAPURB\n");
ioctl(dev->fd, IOCTL_USB_REAPURB, &context);
return rc;
}
+ if (usb_debug >= 3)
+ fprintf(stderr, "usb_urb_transfer: done %d bytes\n", bytesdone);
return bytesdone;
}