summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorNathan Binkert <nate@cvs.openbsd.org>2002-07-10 03:02:51 +0000
committerNathan Binkert <nate@cvs.openbsd.org>2002-07-10 03:02:51 +0000
commita708e51596bbd1fb458db46dc0c35a8384a1342e (patch)
treecc06a1a90c278c0ec97c2b2f3f1a4bffe091e98a /sys/dev
parent0eb86ebec163b1f07b15e0b5cc2411b8826a05a0 (diff)
New device support
use table lookup use usb_proc_ptr From NetBSD
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/uplcom.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c
index b822f152b01..fb08012ef24 100644
--- a/sys/dev/usb/uplcom.c
+++ b/sys/dev/usb/uplcom.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: uplcom.c,v 1.4 2002/05/07 18:29:18 nate Exp $ */
-/* $NetBSD: uplcom.c,v 1.20 2001/07/31 12:33:11 ichiro Exp $ */
+/* $OpenBSD: uplcom.c,v 1.5 2002/07/10 03:02:50 nate Exp $ */
+/* $NetBSD: uplcom.c,v 1.27 2002/03/16 16:10:19 ichiro Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -131,7 +131,7 @@ Static void uplcom_break(struct uplcom_softc *, int);
Static void uplcom_set_line_state(struct uplcom_softc *);
Static void uplcom_get_status(void *, int portno, u_char *lsr, u_char *msr);
#if TODO
-Static int uplcom_ioctl(void *, int, u_long, caddr_t, int, struct proc *);
+Static int uplcom_ioctl(void *, int, u_long, caddr_t, int, usb_proc_ptr);
#endif
Static int uplcom_param(void *, int, struct termios *);
Static int uplcom_open(void *, int);
@@ -148,10 +148,7 @@ struct ucom_methods uplcom_methods = {
NULL,
};
-static const struct uplcom_product {
- uint16_t vendor;
- uint16_t product;
-} uplcom_products [] = {
+static const struct usb_devno uplcom_devs[] = {
/* I/O DATA USB-RSAQ2 */
{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_RSAQ2 },
/* I/O DATA USB-RSAQ */
@@ -160,26 +157,28 @@ static const struct uplcom_product {
{ USB_VENDOR_ATEN, USB_PRODUCT_ATEN_UC232A },
/* IOGEAR/ATEN UC-232A */
{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303 },
- { 0, 0 }
+ /* ELECOM UC-SGT */
+ { USB_VENDOR_ELECOM, USB_PRODUCT_ELECOM_UCSGT },
+ /* RATOC REX-USB60 */
+ { USB_VENDOR_RATOC, USB_PRODUCT_RATOC_REXUSB60 },
+ /* TDK USB-PHS Adapter UHA6400 */
+ { USB_VENDOR_TDK, USB_PRODUCT_TDK_UHA6400 },
+ /* TDK USB-PDC Adapter UPA9664 */
+ { USB_VENDOR_TDK, USB_PRODUCT_TDK_UPA9664 },
};
+#define uplcom_lookup(v, p) usb_lookup(uplcom_devs, v, p)
USB_DECLARE_DRIVER(uplcom);
USB_MATCH(uplcom)
{
USB_MATCH_START(uplcom, uaa);
- int i;
if (uaa->iface != NULL)
return (UMATCH_NONE);
- for (i = 0; uplcom_products[i].vendor != 0; i++) {
- if (uplcom_products[i].vendor == uaa->vendor &&
- uplcom_products[i].product == uaa->product) {
- return (UMATCH_VENDOR_PRODUCT);
- }
- }
- return (UMATCH_NONE);
+ return (uplcom_lookup(uaa->vendor, uaa->product) != NULL ?
+ UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
USB_ATTACH(uplcom)
@@ -715,7 +714,7 @@ uplcom_get_status(void *addr, int portno, u_char *lsr, u_char *msr)
#if TODO
int
uplcom_ioctl(void *addr, int portno, u_long cmd, caddr_t data, int flag,
- struct proc *p)
+ usb_proc_ptr p)
{
struct uplcom_softc *sc = addr;
int error = 0;