Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb extend the match function, to match devices from...
details: https://anonhg.NetBSD.org/src/rev/575eb543af11
branches: trunk
changeset: 343626:575eb543af11
user: plunky <plunky%NetBSD.org@localhost>
date: Wed Feb 17 10:52:55 2016 +0000
description:
extend the match function, to match devices from a selection of
manufacturers that use modern Broadcom chips, and which represent
as a vendor-specific device class.
diffstat:
sys/dev/usb/ubt.c | 182 ++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 149 insertions(+), 33 deletions(-)
diffs (217 lines):
diff -r e65d26d3d691 -r 575eb543af11 sys/dev/usb/ubt.c
--- a/sys/dev/usb/ubt.c Wed Feb 17 01:48:36 2016 +0000
+++ b/sys/dev/usb/ubt.c Wed Feb 17 10:52:55 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ubt.c,v 1.52 2016/02/17 00:49:28 riastradh Exp $ */
+/* $NetBSD: ubt.c,v 1.53 2016/02/17 10:52:55 plunky Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ubt.c,v 1.52 2016/02/17 00:49:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubt.c,v 1.53 2016/02/17 10:52:55 plunky Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -297,51 +297,167 @@
static void ubt_abortdealloc(struct ubt_softc *);
/*
- * To match or ignore forcibly, add
- *
- * { { VendorID, ProductID } , UMATCH_VENDOR_PRODUCT|UMATCH_NONE }
- *
- * to the ubt_dev list.
+ * To match or ignore, add details to the ubt_dev list.
+ * Use value of -1 to indicate a wildcard
+ * To override another entry, add details earlier
*/
const struct ubt_devno {
- struct usb_devno devno;
+ int vendor;
+ int product;
+ int class;
+ int subclass;
+ int proto;
int match;
} ubt_dev[] = {
- { { USB_VENDOR_BROADCOM, USB_PRODUCT_BROADCOM_BCM2033NF },
- UMATCH_NONE },
- { { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HOST_1 },
- UMATCH_VENDOR_PRODUCT },
- { { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HOST_2 },
- UMATCH_VENDOR_PRODUCT },
- { { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HOST_3 },
- UMATCH_VENDOR_PRODUCT },
- { { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HOST_4 },
- UMATCH_VENDOR_PRODUCT },
- { { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HOST_5 },
- UMATCH_VENDOR_PRODUCT },
- { { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HOST_6 },
- UMATCH_VENDOR_PRODUCT },
- { { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HOST_7 },
- UMATCH_VENDOR_PRODUCT },
+ { /* ignore Broadcom 2033 without firmware */
+ USB_VENDOR_BROADCOM,
+ USB_PRODUCT_BROADCOM_BCM2033NF,
+ -1,
+ -1,
+ -1,
+ UMATCH_NONE
+ },
+ { /* Apple Bluetooth Host Controller MacbookPro 7,1 */
+ USB_VENDOR_APPLE,
+ USB_PRODUCT_APPLE_BLUETOOTH_HOST_1,
+ -1,
+ -1,
+ -1,
+ UMATCH_VENDOR_PRODUCT
+ },
+ { /* Apple Bluetooth Host Controller iMac 11,1 */
+ USB_VENDOR_APPLE,
+ USB_PRODUCT_APPLE_BLUETOOTH_HOST_2,
+ -1,
+ -1,
+ -1,
+ UMATCH_VENDOR_PRODUCT
+ },
+ { /* Apple Bluetooth Host Controller MacBookPro 8,2 */
+ USB_VENDOR_APPLE,
+ USB_PRODUCT_APPLE_BLUETOOTH_HOST_3,
+ -1,
+ -1,
+ -1,
+ UMATCH_VENDOR_PRODUCT
+ },
+ { /* Apple Bluetooth Host Controller MacBookAir 3,1 3,2*/
+ USB_VENDOR_APPLE,
+ USB_PRODUCT_APPLE_BLUETOOTH_HOST_4,
+ -1,
+ -1,
+ -1,
+ UMATCH_VENDOR_PRODUCT
+ },
+ { /* Apple Bluetooth Host Controller MacBookAir 4,1 */
+ USB_VENDOR_APPLE,
+ USB_PRODUCT_APPLE_BLUETOOTH_HOST_5,
+ -1,
+ -1,
+ -1,
+ UMATCH_VENDOR_PRODUCT
+ },
+ { /* Apple Bluetooth Host Controller MacMini 5,1 */
+ USB_VENDOR_APPLE,
+ USB_PRODUCT_APPLE_BLUETOOTH_HOST_6,
+ -1,
+ -1,
+ -1,
+ UMATCH_VENDOR_PRODUCT
+ },
+ { /* Apple Bluetooth Host Controller MacBookAir 6,1 */
+ USB_VENDOR_APPLE,
+ USB_PRODUCT_APPLE_BLUETOOTH_HOST_7,
+ -1,
+ -1,
+ -1,
+ UMATCH_VENDOR_PRODUCT
+ },
+ { /* Broadcom chips with PatchRAM support */
+ USB_VENDOR_BROADCOM,
+ -1,
+ UDCLASS_VENDOR,
+ UDSUBCLASS_RF,
+ UDPROTO_BLUETOOTH,
+ UMATCH_VENDOR_DEVCLASS_DEVPROTO
+ },
+ { /* Broadcom based device with PatchRAM support */
+ USB_VENDOR_FOXCONN,
+ -1,
+ UDCLASS_VENDOR,
+ UDSUBCLASS_RF,
+ UDPROTO_BLUETOOTH,
+ UMATCH_VENDOR_DEVCLASS_DEVPROTO
+ },
+ { /* Broadcom based device with PatchRAM support */
+ USB_VENDOR_LITEON,
+ -1,
+ UDCLASS_VENDOR,
+ UDSUBCLASS_RF,
+ UDPROTO_BLUETOOTH,
+ UMATCH_VENDOR_DEVCLASS_DEVPROTO
+ },
+ { /* Broadcom based device with PatchRAM support */
+ USB_VENDOR_BELKIN,
+ -1,
+ UDCLASS_VENDOR,
+ UDSUBCLASS_RF,
+ UDPROTO_BLUETOOTH,
+ UMATCH_VENDOR_DEVCLASS_DEVPROTO
+ },
+ { /* Broadcom based device with PatchRAM support */
+ USB_VENDOR_TOSHIBA,
+ -1,
+ UDCLASS_VENDOR,
+ UDSUBCLASS_RF,
+ UDPROTO_BLUETOOTH,
+ UMATCH_VENDOR_DEVCLASS_DEVPROTO
+ },
+ { /* Broadcom based device with PatchRAM support */
+ USB_VENDOR_ASUSTEK,
+ -1,
+ UDCLASS_VENDOR,
+ UDSUBCLASS_RF,
+ UDPROTO_BLUETOOTH,
+ UMATCH_VENDOR_DEVCLASS_DEVPROTO
+ },
+ { /* Generic Bluetooth SIG compliant devices */
+ -1,
+ -1,
+ UDCLASS_WIRELESS,
+ UDSUBCLASS_RF,
+ UDPROTO_BLUETOOTH,
+ UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO
+ },
};
-#define ubt_lookup(vendor, product) \
- ((const struct ubt_devno *)usb_lookup(ubt_dev, vendor, product))
int
ubt_match(device_t parent, cfdata_t match, void *aux)
{
struct usb_attach_arg *uaa = aux;
- const struct ubt_devno *dev;
+ size_t i;
DPRINTFN(50, "ubt_match\n");
- if ((dev = ubt_lookup(uaa->vendor, uaa->product)) != NULL)
- return dev->match;
+ for (i = 0; i < __arraycount(ubt_dev); i++) {
+ if (ubt_dev[i].vendor != -1
+ && ubt_dev[i].vendor != (int)uaa->vendor)
+ continue;
+ if (ubt_dev[i].product != -1
+ && ubt_dev[i].product != (int)uaa->product)
+ continue;
+ if (ubt_dev[i].class != -1
+ && ubt_dev[i].class != uaa->class)
+ continue;
+ if (ubt_dev[i].subclass != -1
+ && ubt_dev[i].subclass != uaa->subclass)
+ continue;
+ if (ubt_dev[i].proto != -1
+ && ubt_dev[i].proto != uaa->proto)
+ continue;
- if (uaa->class == UDCLASS_WIRELESS
- && uaa->subclass == UDSUBCLASS_RF
- && uaa->proto == UDPROTO_BLUETOOTH)
- return UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO;
+ return ubt_dev[i].match;
+ }
return UMATCH_NONE;
}
Home |
Main Index |
Thread Index |
Old Index