diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2006-06-27 09:21:56 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2006-06-27 09:21:56 +0000 |
commit | 1da690cdd04505eb2ceb359438f1e44b21fa89e9 (patch) | |
tree | 610d169a28af180ed383f730d0e28e25cda59d20 | |
parent | a7b06cc7a9876ca0440b5f0b9d5bd3da2ba828a6 (diff) |
Switch from magic numbers to usbdevs for vendor/product pairs.
-rw-r--r-- | sys/dev/usb/if_zyd.c | 34 | ||||
-rw-r--r-- | sys/dev/usb/if_zydreg.h | 23 |
2 files changed, 24 insertions, 33 deletions
diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index fd05588a9eb..018ab7e074e 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zyd.c,v 1.3 2006/06/27 03:49:44 deraadt Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.4 2006/06/27 09:21:55 jsg Exp $ */ /* * Copyright (c) 2006 by Florian Stoehr <ich@florian-stoehr.de> @@ -83,6 +83,26 @@ int zyddebug = 1; #define DPRINTFN(n,x) #endif +static const struct usb_devno zyd_devs[] = { + { USB_VENDOR_3COM2, USB_PRODUCT_3COM2_3CRUSB10075 }, + { USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_WL54 }, + { USB_VENDOR_ASUS, USB_PRODUCT_ASUS_WL159G }, + { USB_VENDOR_CYBERTAN, USB_PRODUCT_CYBERTAN_TG54USB }, + { USB_VENDOR_DRAYTEK, USB_PRODUCT_DRAYTEK_VIGOR550 }, + { USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GWUS54GZL }, + { USB_VENDOR_PLANEX3, USB_PRODUCT_PLANEX3_GWUS54MINI }, + { USB_VENDOR_SAGEM, USB_PRODUCT_SAGEM_XG760A }, + { USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_WL113 }, + { USB_VENDOR_SWEEX, USB_PRODUCT_SWEEX_ZD1211 }, + { USB_VENDOR_TEKRAM, USB_PRODUCT_TEKRAM_QUICKWLAN }, + { USB_VENDOR_TEKRAM, USB_PRODUCT_TEKRAM_ZD1211 }, + { USB_VENDOR_TWINMOS, USB_PRODUCT_TWINMOS_G240 }, + { USB_VENDOR_UMEDIA, USB_PRODUCT_UMEDIA_TEW429UB }, + { USB_VENDOR_WISTRONNEWEB, USB_PRODUCT_WISTRONNEWEB_UR055G }, + { USB_VENDOR_ZYDAS, USB_PRODUCT_ZYDAS_ZD1211 }, + { USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_ZYAIRG220 } +}; + USB_DECLARE_DRIVER(zyd); /* @@ -1438,20 +1458,12 @@ cleanup: USB_MATCH(zyd) { USB_MATCH_START(zyd, uaa); - int i; if (!uaa->iface) return (UMATCH_NONE); - for (i = 0; i < sizeof(zyd_devs)/sizeof(zyd_devs[0]); i++) { - struct zyd_type *t = &zyd_devs[i]; - - if ((uaa->vendor == t->vid) && (uaa->product == t->pid)) { - return (UMATCH_VENDOR_PRODUCT); - } - } - - return (UMATCH_NONE); + return (usb_lookup(zyd_devs, uaa->vendor, uaa->product) != NULL) ? + UMATCH_VENDOR_PRODUCT : UMATCH_NONE; } /* diff --git a/sys/dev/usb/if_zydreg.h b/sys/dev/usb/if_zydreg.h index 15235d1e27a..ada6ffe9530 100644 --- a/sys/dev/usb/if_zydreg.h +++ b/sys/dev/usb/if_zydreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zydreg.h,v 1.3 2006/06/27 03:49:44 deraadt Exp $ */ +/* $OpenBSD: if_zydreg.h,v 1.4 2006/06/27 09:21:55 jsg Exp $ */ /* * Copyright (c) 2006 by Florian Stoehr <ich@florian-stoehr.de> @@ -594,27 +594,6 @@ struct zyd_type { uint16_t pid; }; -struct zyd_type zyd_devs[] = { - { 0x0586, 0x3401 }, /* Zyxel ZyAIR G-220 */ - { 0x0675, 0x0550 }, /* DrayTek Vigor 550 */ - { 0x079b, 0x004a }, /* Sagem XG 760A */ - { 0x07b8, 0x6001 }, /* AOpen 802.11g WL54 */ - { 0x0ace, 0x1211 }, /* Fiberline Networks WL-43OU, Airlink+ AWLL3025, X-Micro XWL-11GUZX, Edimax EW-7317UG, Planet WL-U356, Acer WLAN-G-US1, Trendnet TEW-424UB */ - { 0x0b05, 0x170c }, /* Asus WL-159g */ - { 0x0b3b, 0x5630 }, /* Tekram/Siemens USB adapter */ - { 0x0df6, 0x9071 }, /* Sitecom WL-113 */ - { 0x0b3b, 0x1630 }, /* Yakumo QuickWLAN USB */ - { 0x126f, 0xa006 }, /* TwinMOS G240 */ - { 0x129b, 0x1666 }, /* Telegent TG54USB */ - { 0x1435, 0x0711 }, /* iNexQ UR055g */ - { 0x14ea, 0xab13 }, /* Planex GW-US54Mini */ - { 0x157e, 0x300b }, /* Trendnet TEW-429UB */ - { 0x2019, 0xc007 }, /* Planex GW-US54GZL */ - { 0x5173, 0x1809 }, /* Sweex wireless USB 54 Mbps */ - { 0x6891, 0xa727 }, /* 3COM 3CRUSB10075 */ - { } -}; - static const char *zyd_rfs[] = { "unknown", "unknown", |