Subject: Re: USB device attachment
To: Lennart Augustsson <email@example.com>
From: Warner Losh <firstname.lastname@example.org>
Date: 07/25/1999 11:38:22
In message <37986F97.EA386692@augustsson.net> 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
: 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
I know that in FreeBSD there were some difficulties similar to this
with the pci code and the generic chip driver grabbing things before
the loaded driver had a chance to say anything. That's why FreeBSD
implements a priority scheme for device drivers (the identify routine
returns a number indicating how interested in the device it is), at
least in -current.
At least that's my understanding of how config.new(8) is supposed to
work, or at least how its future growth direction was viewed. I must
admit that I've not done this with config.new(8), but instead have
been busy with FreeBSD's new-bus stuff which was designed for this
sort of thing. It is my understanding that there has been some work
in this direction by the FreeBSD-newconfig project (the generic device
loading and such, not necessarily the usb stuff), so you might want to
check their work out.