summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorpooka <pooka@NetBSD.org>2010-02-02 23:18:49 +0000
committerpooka <pooka@NetBSD.org>2010-02-02 23:18:49 +0000
commit068898b44dc00f78207810be3db3d336e378d431 (patch)
treeca75734b1f1c5a5cb1e7f54f36667532368bbf25 /sys/dev
parentc41b967aeaf9e7fef77869df1bbf62175a90cdc3 (diff)
Introduce the uhub_ubermatch variable. Setting it to 1 makes sure
than a uhub attaches even at higher priority than ugen when ugen_override is set to 1. This allows to probe the whole USB bus and attach its functions with ugen. A better infrastructure to control this would be nice ....
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/uhub.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index ff94128e4cf..fcdf095888b 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uhub.c,v 1.108 2009/11/12 20:11:35 dyoung Exp $ */
+/* $NetBSD: uhub.c,v 1.109 2010/02/02 23:18:49 pooka Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
/*
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.108 2009/11/12 20:11:35 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.109 2010/02/02 23:18:49 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -105,10 +105,23 @@ CFATTACH_DECL3_NEW(uhub, sizeof(struct uhub_softc), uhub_match,
CFATTACH_DECL2_NEW(uroothub, sizeof(struct uhub_softc), uhub_match,
uhub_attach, uhub_detach, NULL, uhub_rescan, uhub_childdet);
+/*
+ * Setting this to 1 makes sure than an uhub attaches even at higher
+ * priority than ugen when ugen_override is set to 1. This allows to
+ * probe the whole USB bus and attach functions with ugen.
+ */
+int uhub_ubermatch = 0;
+
int
uhub_match(device_t parent, cfdata_t match, void *aux)
{
struct usb_attach_arg *uaa = aux;
+ int matchvalue;
+
+ if (uhub_ubermatch)
+ matchvalue = UMATCH_HIGHEST+1;
+ else
+ matchvalue = UMATCH_DEVCLASS_DEVSUBCLASS;
DPRINTFN(5,("uhub_match, uaa=%p\n", uaa));
/*
@@ -116,7 +129,7 @@ uhub_match(device_t parent, cfdata_t match, void *aux)
* so we just ignore the subclass.
*/
if (uaa->class == UDCLASS_HUB)
- return (UMATCH_DEVCLASS_DEVSUBCLASS);
+ return (matchvalue);
return (UMATCH_NONE);
}