How are USB drivers assigned?

Nicholas Mills nlmills at
Wed Jun 30 07:50:55 UTC 2010

When the ums driver is loaded (at boot time or through kldload) it registers
itself with the usb "bus" driver. When your mouse is plugged in the bus
driver calls the "probe" routine of every driver that has registered with
it. If the ums probe routine detects that the new device is in fact a mouse
it returns the value BUS_PROBE_GENERIC to the bus driver to indicate that it
supports the new device.

Once all the probe routines have been run the bus driver runs the "attach"
routine of the driver that returned the highest non-error value from its
probe routine. In the case of a mouse the attach routine of ums should be
called. The ums attach routine is responsible for configuring the device for
use by the system. A successful return from the attach routine means the
device is added to the system and ready to be used.

For more info see /sys/dev/usb/input/ums.c especially the functions
ums_probe and ums_attach and the DRIVER_MODULE macro.

Hope this helps,


On Mon, Jun 28, 2010 at 10:37 PM, <osp at> wrote:

> On Tue, 29 Jun 2010 17:56:39 +0200 Roland Smith <rsmith at> wrote:
> > On Mon, Jun 28, 2010 at 11:03:38PM -1000, Gary Dunn wrote:
> > > Is there a file that associates drivers with USB device information?
> > > More specifically, how does a USB mouse get assigned to the ums driver?
> > > This is for FreeBSD 8.0, if it matters.
> >
> > When queried on connection the mouse identifies itself by sending a
> descrip> tor
> > as a Human Interface Device class peripheral, and specifically a mouse.
> The
> > USB driver then knows to attach the ums device driver.
> Thanks for the reply Roland.
> What I am looking for is
> > The USB driver then knows to attach the ums device driver.
> how it "knows."
> Gary Dunn
> Open Slate Project
> _______________________________________________
> freebsd-questions at mailing list
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at"

More information about the freebsd-questions mailing list