aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/usbdi.c
diff options
context:
space:
mode:
authorJosef Karthauser <joe@FreeBSD.org>2002-04-07 12:42:18 +0000
committerJosef Karthauser <joe@FreeBSD.org>2002-04-07 12:42:18 +0000
commit58af1b84da9f4d19845bd1eb38bb5e97ae310f87 (patch)
treedde62dc65565a8c7deba27603b114cbc6fb82eaf /sys/dev/usb/usbdi.c
parent4d20078c4a11c4198094e8f1638debd2a4e02d62 (diff)
downloadsrc-58af1b84da9f4d19845bd1eb38bb5e97ae310f87.tar.gz
src-58af1b84da9f4d19845bd1eb38bb5e97ae310f87.zip
MFNetBSD: usbdi.c (1.93), usbdi.h (1.59)
date: 2001/12/24 21:36:15; author: augustss; Add some more DIAGNOSTIC tests. Make usb_match_device() match on USB_PRODUCT_ANY.
Notes
Notes: svn path=/head/; revision=94083
Diffstat (limited to 'sys/dev/usb/usbdi.c')
-rw-r--r--sys/dev/usb/usbdi.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c
index 9723e048bc39..0316bdc583b1 100644
--- a/sys/dev/usb/usbdi.c
+++ b/sys/dev/usb/usbdi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.c,v 1.92 2001/12/12 15:38:58 augustss Exp $ */
+/* $NetBSD: usbdi.c,v 1.93 2001/12/24 21:36:15 augustss Exp $ */
/* $FreeBSD$ */
/*
@@ -766,6 +766,14 @@ usb_transfer_complete(usbd_xfer_handle xfer)
"actlen=%d\n", pipe, xfer, xfer->status, xfer->actlen));
#ifdef DIAGNOSTIC
+ if (xfer->busy_free != XFER_ONQU) {
+ printf("usb_transfer_complete: xfer=%p not busy 0x%08x\n",
+ xfer, xfer->busy_free);
+ return;
+ }
+#endif
+
+#ifdef DIAGNOSTIC
if (pipe == NULL) {
printf("usbd_transfer_cb: pipe==0, xfer=%p\n", xfer);
return;
@@ -803,6 +811,7 @@ usb_transfer_complete(usbd_xfer_handle xfer)
if (xfer != SIMPLEQ_FIRST(&pipe->queue))
printf("usb_transfer_complete: bad dequeue %p != %p\n",
xfer, SIMPLEQ_FIRST(&pipe->queue));
+ xfer->busy_free = XFER_BUSY;
#endif
SIMPLEQ_REMOVE_HEAD(&pipe->queue, xfer, next);
}
@@ -856,6 +865,14 @@ usb_insert_transfer(usbd_xfer_handle xfer)
DPRINTFN(5,("usb_insert_transfer: pipe=%p running=%d timeout=%d\n",
pipe, pipe->running, xfer->timeout));
+#ifdef DIAGNOSTIC
+ if (xfer->busy_free != XFER_BUSY) {
+ printf("usb_insert_transfer: xfer=%p not busy 0x%08x\n",
+ xfer, xfer->busy_free);
+ return (USBD_INVAL);
+ }
+ xfer->busy_free = XFER_ONQU;
+#endif
s = splusb();
SIMPLEQ_INSERT_TAIL(&pipe->queue, xfer, next);
if (pipe->running)
@@ -1112,7 +1129,9 @@ usb_match_device(const struct usb_devno *tbl, u_int nentries, u_int sz,
u_int16_t vendor, u_int16_t product)
{
while (nentries-- > 0) {
- if (tbl->ud_vendor == vendor && tbl->ud_product == product)
+ u_int16_t tproduct = tbl->ud_product;
+ if (tbl->ud_vendor == vendor &&
+ (tproduct == product || tproduct == USB_PRODUCT_ANY))
return (tbl);
tbl = (const struct usb_devno *)((const char *)tbl + sz);
}