From owner-freebsd-questions@FreeBSD.ORG Wed Jun 30 07:50:55 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9564F106566C for ; Wed, 30 Jun 2010 07:50:55 +0000 (UTC) (envelope-from nlmills@g.clemson.edu) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 579CA8FC15 for ; Wed, 30 Jun 2010 07:50:54 +0000 (UTC) Received: by qyk32 with SMTP id 32so90659qyk.13 for ; Wed, 30 Jun 2010 00:50:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.36.92 with SMTP id s28mr5716861qad.293.1277884246156; Wed, 30 Jun 2010 00:50:46 -0700 (PDT) Received: by 10.224.60.197 with HTTP; Wed, 30 Jun 2010 00:50:46 -0700 (PDT) In-Reply-To: <201006292037.o5TKbCqm010278@yoda.pixi.com> References: <201006292037.o5TKbCqm010278@yoda.pixi.com> Date: Wed, 30 Jun 2010 03:50:46 -0400 Message-ID: From: Nicholas Mills To: osp@aloha.com Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Roland Smith , freebsd-questions@freebsd.org Subject: Re: How are USB drivers assigned? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: nlmills@clemson.edu List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2010 07:50:55 -0000 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, Nick On Mon, Jun 28, 2010 at 10:37 PM, wrote: > On Tue, 29 Jun 2010 17:56:39 +0200 Roland Smith 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@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" >