Subject: Re: USB device attachment
To: Warner Losh <>
From: Lennart Augustsson <>
List: tech-kern
Date: 07/25/1999 20:26:26
Warner Losh wrote:

> In message <> Lennart Augustsson writes:
> : First, a minor one: It looks funny to have all the interfaces of a
> : compound device (ukbd1&ums1) attach to the hub when in reality they
> : are the same USB device.  But the current solution works, even if
> : it's not the prettiest one.
> But don't multi-function PCI card/chips attach multiple drivers to
> that one hunk of hardware?  I don't see how this is any different from
> that case.

No, it's the same.  And maybe PCI should have the same extra level.
I think it's a little more useful for USB though, because there are meaningful
things you can do to the generic device even if it has a driver attached
to it (like getting descriptors, suspending it, etc.)

> : Second, what about LKMs?  Assume that a new device is plugged in.
> : If it is a new kind of device it will become an ugen device.
> : A little later a LKM driver for this device is loaded.  But now
> : it is too late.  The ugen driver will already have claimed the
> : device and AFAIK a LKM cannot grab a device that there is already
> : a driver for.  This point is, IMO, really bad, because it means
> : that LKMs cannot be used in a nice way.
> I think that you are going to want to have a generic solution to LKMs.
> USB can't be the only subsystem that needs to have something like
> this.  You effectively want to reprobe the USB bus when you load a new
> USB driver and detach anything that changes.  The generic USB driver
> would lose on the second probe for the newly loaded device (unew), and
> the newly loaded driver would claim the device.  When this happens,
> you'd need to detach the ugen device instance and attach the unew to
> that device.

You're right it is a general problem.  And the mechanism to handle it
are almost there.  I guess what we need is some extra stuff in the LKM
loader that lets it probe and then take over devices that it has a higher
priority for than the current driver.  The priority stuff is there (USB has
more levels than any other :), but I'm not sure what the status of the LKM
loading is.

    -- Lennart