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.
This commit is contained in:
martin 2009-08-16 13:20:40 +00:00
parent 20078a6d9f
commit 7867c1b262
2 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/systm.h>
@ -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