allow for vendor-id and product-id properties, passing them

through to child devices
This commit is contained in:
plunky 2010-04-28 06:13:51 +00:00
parent 0b415f4e44
commit 0f7dbb350e
3 changed files with 17 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: btdev.h,v 1.8 2008/03/28 21:17:37 plunky Exp $ */
/* $NetBSD: btdev.h,v 1.9 2010/04/28 06:13:51 plunky Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -39,6 +39,8 @@
#define BTDEV_DETACH _IOW('b', 15, struct plistref)
/* btdev properties */
#define BTDEVvendor "vendor-id"
#define BTDEVproduct "product-id"
#define BTDEVtype "device-type"
#define BTDEVladdr "local-bdaddr"
#define BTDEVraddr "remote-bdaddr"

View File

@ -1,4 +1,4 @@
/* $NetBSD: bthidev.c,v 1.18 2009/08/21 10:01:25 plunky Exp $ */
/* $NetBSD: bthidev.c,v 1.19 2010/04/28 06:13:51 plunky Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.18 2009/08/21 10:01:25 plunky Exp $");
__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.19 2010/04/28 06:13:51 plunky Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@ -181,6 +181,7 @@ bthidev_attach(device_t parent, device_t self, void *aux)
const void *desc;
int locs[BTHIDBUSCF_NLOCS];
int maxid, rep, dlen;
int vendor, product;
/*
* Init softc
@ -205,6 +206,12 @@ bthidev_attach(device_t parent, device_t self, void *aux)
obj = prop_dictionary_get(dict, BTDEVraddr);
bdaddr_copy(&sc->sc_raddr, prop_data_data_nocopy(obj));
obj = prop_dictionary_get(dict, BTDEVvendor);
vendor = (int)prop_number_integer_value(obj);
obj = prop_dictionary_get(dict, BTDEVproduct);
product = (int)prop_number_integer_value(obj);
obj = prop_dictionary_get(dict, BTDEVmode);
if (prop_object_type(obj) == PROP_TYPE_STRING) {
if (prop_string_equals_cstring(obj, BTDEVauth))
@ -279,6 +286,8 @@ bthidev_attach(device_t parent, device_t self, void *aux)
&& hid_report_size(desc, dlen, hid_output, rep) == 0)
continue;
bha.ba_vendor = vendor;
bha.ba_product = product;
bha.ba_desc = desc;
bha.ba_dlen = dlen;
bha.ba_input = bthidev_null;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bthidev.h,v 1.4 2007/11/03 17:41:03 plunky Exp $ */
/* $NetBSD: bthidev.h,v 1.5 2010/04/28 06:13:51 plunky Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -60,6 +60,8 @@ struct bthidev {
/* HID device attach arguments */
struct bthidev_attach_args {
int ba_vendor; /* USB Forum Vendor ID */
int ba_product; /* USB Forum Product ID */
const void *ba_desc; /* descriptor */
int ba_dlen; /* descriptor length */
int ba_id; /* report id */