From 7867c1b262fdca068cc088244b1b4d034fc95f57 Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 16 Aug 2009 13:20:40 +0000 Subject: [PATCH] Use a separately defined USBD_CONFIG_TIMEOUT when requesting a device descriptor. I have a USB ATA device that spins up it's (removable) hard disk and only returns the real descriptor if the disk is present - this takes too long with the default 5 seconds timeout, so we were unable to properly attach this device. --- sys/dev/usb/usbdi.h | 3 ++- sys/dev/usb/usbdi_util.c | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index 4b0396f8e1e7..294ac389d6be 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.h,v 1.77 2008/12/12 05:35:11 jmorse Exp $ */ +/* $NetBSD: usbdi.h,v 1.78 2009/08/16 13:20:40 martin Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $ */ /* @@ -83,6 +83,7 @@ typedef void (*usbd_callback)(usbd_xfer_handle, usbd_private_handle, #define USBD_NO_TIMEOUT 0 #define USBD_DEFAULT_TIMEOUT 5000 /* ms = 5 s */ +#define USBD_CONFIG_TIMEOUT (3*USBD_DEFAULT_TIMEOUT) #if defined(__FreeBSD__) #define USB_CDEV_MAJOR 108 diff --git a/sys/dev/usb/usbdi_util.c b/sys/dev/usb/usbdi_util.c index 9bef62f86005..58e3979b0189 100644 --- a/sys/dev/usb/usbdi_util.c +++ b/sys/dev/usb/usbdi_util.c @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi_util.c,v 1.51 2008/05/26 18:00:33 drochner Exp $ */ +/* $NetBSD: usbdi_util.c,v 1.52 2009/08/16 13:20:40 martin Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.51 2008/05/26 18:00:33 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.52 2009/08/16 13:20:40 martin Exp $"); #include #include @@ -68,7 +68,8 @@ usbd_get_desc(usbd_device_handle dev, int type, int index, int len, void *desc) 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_CONFIG_TIMEOUT)); } usbd_status