aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/usbdi.c
diff options
context:
space:
mode:
authorJosef Karthauser <joe@FreeBSD.org>2002-02-11 10:09:29 +0000
committerJosef Karthauser <joe@FreeBSD.org>2002-02-11 10:09:29 +0000
commitd41fcbf0d040ad2a9e7d896d89fdb8cc2eb7c045 (patch)
tree8ae800c939ddd29a04a098c7007a35fe6b3fe01d /sys/dev/usb/usbdi.c
parentfef3edecbb3f7dcdd8153579e3bc95799f77eb50 (diff)
downloadsrc-d41fcbf0d040ad2a9e7d896d89fdb8cc2eb7c045.tar.gz
src-d41fcbf0d040ad2a9e7d896d89fdb8cc2eb7c045.zip
Merge from NetBSD: revs 1.89 and 1.90.
Also, add some 'const's to supress warnings. (Submitted back to NetBSD). The original logs from NetBSD: ---------------------------- revision 1.90 date: 2001/12/03 01:47:12; author: augustss; lines: +4 -4 Handle vendor/product lookup with a common routine. ---------------------------- revision 1.89 date: 2001/12/02 23:25:25; author: augustss; lines: +18 -2 Add a subroutine to search for a vendor/product pair. ----------------------------
Notes
Notes: svn path=/head/; revision=90526
Diffstat (limited to 'sys/dev/usb/usbdi.c')
-rw-r--r--sys/dev/usb/usbdi.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c
index 20d6a036f0cc..c762918f4807 100644
--- a/sys/dev/usb/usbdi.c
+++ b/sys/dev/usb/usbdi.c
@@ -1094,6 +1094,22 @@ usbd_get_endpoint_descriptor(iface, address)
return (0);
}
+/*
+ * Search for a vendor/product pair in an array. The item size is
+ * given as an argument.
+ */
+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)
+{
+ while (nentries-- > 0) {
+ if (tbl->ud_vendor == vendor && tbl->ud_product == product)
+ return (tbl);
+ tbl = (const struct usb_devno *)((const char *)tbl + sz);
+ }
+ return (NULL);
+}
+
#if defined(__FreeBSD__)
int
usbd_driver_load(module_t mod, int what, void *arg)