From 12e455f905854f4f8db77fa1561626de6543e9c6 Mon Sep 17 00:00:00 2001 From: sborrill Date: Tue, 20 Nov 2007 10:43:01 +0000 Subject: [PATCH] Some manufacturers use the same vendor and product id for different devices. We need to sanity check the DeviceClass in this case. Currently known guilty products: 0x050d/0x0121 Belkin Bluetooth and USB2LAN If this turns out to be more common, we could use a quirk table. --- sys/dev/usb/if_aue.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index 861aa1b90a65..c2bf680c5f0b 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_aue.c,v 1.104 2007/09/01 07:32:32 dyoung Exp $ */ +/* $NetBSD: if_aue.c,v 1.105 2007/11/20 10:43:01 sborrill Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul . All rights reserved. @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.104 2007/09/01 07:32:32 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.105 2007/11/20 10:43:01 sborrill Exp $"); #if defined(__NetBSD__) #include "opt_inet.h" @@ -713,6 +713,26 @@ USB_MATCH(aue) { USB_MATCH_START(aue, uaa); + /* + * Some manufacturers use the same vendor and product id for + * different devices. We need to sanity check the DeviceClass + * in this case + * Currently known guilty products: + * 0x050d/0x0121 Belkin Bluetooth and USB2LAN + * + * If this turns out to be more common, we could use a quirk + * table. + */ + if (uaa->vendor == USB_VENDOR_BELKIN && + uaa->product == USB_PRODUCT_BELKIN_USB2LAN) { + usb_device_descriptor_t *dd; + + dd = usbd_get_device_descriptor(uaa->device); + if (dd != NULL && + dd->bDeviceClass != UDCLASS_IN_INTERFACE) + return (UMATCH_NONE); + } + return (aue_lookup(uaa->vendor, uaa->product) != NULL ? UMATCH_VENDOR_PRODUCT : UMATCH_NONE); }