Subject: re: prototype in GENERIC for APC UPS?
To: Bill Stouder-Studenmund <wrstuden@netbsd.org>
From: matthew green <mrg@eterna.com.au>
List: tech-kern
Date: 04/24/2007 06:21:51
On Mon, Apr 23, 2007 at 10:57:46AM -0400, Steven M. Bellovin wrote:
> On Mon, 23 Apr 2007 16:50:29 +0200
> Martin Husemann <martin@duskware.de> wrote:
>
> > On Mon, Apr 23, 2007 at 10:43:12AM -0400, Steven M. Bellovin wrote:
> > >
> > > # Detect APC UPS as ugen instead of uhid
> > > #ugen* at uhub? port ? vendor "0x051d" flags 1
> > >
> > > and perhaps others if appropriate.
> >
> > Why don't we have a list inside ugen.c that it matches against the
> > device and returns UMATCH_GENERIC+1 if it finds a known "this should
> > be ugen" device?
> >
> Wouldn't we have to change a bit more? Ugen is currently scanned
> last, I thought; for that, we'd have to have it scanned first for
> cases like these, and again at the end for devices not matched by
> something else, right?
It's not supposed to matter. Our autoconfig code supports the concept of
quality of match. The first "best" match wins. That means that if a match
routine returns better than the previous best match code, it becomes the
match, otherwise things stay as they were.
Put another way, we scan all posibilities then decide. We don't stop the
moment somethign returns any sort of positive match.
note that ugen is handled Specially. in the normal case if any other
usb driver wants to claim a device ugen isn't even probed for it.
this has the additional failure that if you have a multi-function
device and you need a real driver for function 0 and ugen for function
1, ugen won't get there at all.
it's all kind of gross. grep for "usegeneric" in sys/dev/usb.
.mrg.