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.
This commit is contained in:
parent
32884f59a7
commit
562af56e62
@ -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$ */
|
||||
|
||||
/*
|
||||
@ -765,6 +765,14 @@ usb_transfer_complete(usbd_xfer_handle xfer)
|
||||
DPRINTFN(5, ("usb_transfer_complete: pipe=%p xfer=%p status=%d "
|
||||
"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);
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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 */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user