diff options
author | Josef Karthauser <joe@FreeBSD.org> | 2002-04-07 12:42:18 +0000 |
---|---|---|
committer | Josef Karthauser <joe@FreeBSD.org> | 2002-04-07 12:42:18 +0000 |
commit | 58af1b84da9f4d19845bd1eb38bb5e97ae310f87 (patch) | |
tree | dde62dc65565a8c7deba27603b114cbc6fb82eaf /sys/dev/usb | |
parent | 4d20078c4a11c4198094e8f1638debd2a4e02d62 (diff) | |
download | src-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')
-rw-r--r-- | sys/dev/usb/usbdi.c | 23 | ||||
-rw-r--r-- | sys/dev/usb/usbdi.h | 3 |
2 files changed, 23 insertions, 3 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); } diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index ac6048f137d0..f5b345801791 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.h,v 1.56 2001/12/03 01:47:12 augustss Exp $ */ +/* $NetBSD: usbdi.h,v 1.57 2001/12/12 15:24:00 augustss Exp $ */ /* $FreeBSD$ */ /* @@ -201,6 +201,7 @@ const struct usb_devno *usb_match_device(const struct usb_devno *tbl, u_int nentries, u_int sz, u_int16_t vendor, u_int16_t product); #define usb_lookup(tbl, vendor, product) \ usb_match_device((const struct usb_devno *)(tbl), sizeof (tbl) / sizeof ((tbl)[0]), sizeof ((tbl)[0]), (vendor), (product)) +#define USB_PRODUCT_ANY 0xffff /* NetBSD attachment information */ |