tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Longer timeout for getting usb descriptors



Hi folks,

I have a strange usb<->ide thingy that only spins up the ata disk behind
it after being asked for a config descriptor - and does not return the
descriptor before the disk has identified.

This causes a timeout in our code, printing "device problem, disabling port .."
and makes the device unusable.

The patch below works around that. OK to commit?

Martin
Index: usbdi.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdi.h,v
retrieving revision 1.90
diff -u -p -r1.90 usbdi.h
--- usbdi.h	17 Jul 2014 18:42:37 -0000	1.90
+++ usbdi.h	17 Jan 2016 17:59:03 -0000
@@ -84,9 +84,10 @@ typedef void (*usbd_callback)(usbd_xfer_
 #define USBD_SYNCHRONOUS_SIG	0x10	/* if waiting for completion,
 					 * also take signals */
 
-#define USBD_NO_TIMEOUT 0
-#define USBD_DEFAULT_TIMEOUT 5000 /* ms = 5 s */
-#define	USBD_CONFIG_TIMEOUT  (3*USBD_DEFAULT_TIMEOUT)
+#define USBD_NO_TIMEOUT		0
+#define USBD_DEFAULT_TIMEOUT	5000 /* ms = 5 s */
+#define USBD_DESC_TIMEOUT	(2*USBD_DEFAULT_TIMEOUT)
+#define	USBD_CONFIG_TIMEOUT	(3*USBD_DEFAULT_TIMEOUT)
 
 #define DEVINFOSIZE 1024
 
Index: usbdi_util.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdi_util.c,v
retrieving revision 1.64
diff -u -p -r1.64 usbdi_util.c
--- usbdi_util.c	27 Mar 2015 12:46:51 -0000	1.64
+++ usbdi_util.c	17 Jan 2016 17:59:03 -0000
@@ -74,7 +74,8 @@ usbd_get_desc(usbd_device_handle dev, in
 	USETW2(req.wValue, type, index);
 	USETW(req.wIndex, 0);
 	USETW(req.wLength, len);
-	return (usbd_do_request(dev, &req, desc));
+	return (usbd_do_request_flags(dev, &req, desc, 0, 0,
+	    USBD_DESC_TIMEOUT));
 }
 
 usbd_status


Home | Main Index | Thread Index | Old Index