From d41fcbf0d040ad2a9e7d896d89fdb8cc2eb7c045 Mon Sep 17 00:00:00 2001 From: Josef Karthauser Date: Mon, 11 Feb 2002 10:09:29 +0000 Subject: 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. ---------------------------- --- sys/dev/usb/usbdi.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sys/dev') diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index 20d6a036f0ccc..c762918f4807c 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) -- cgit v1.3