Subject: Re: Pluged : USBd for NetBSD ?
To: M. Warner Losh <imp@bsdimp.com>
From: Jachym Holecek <freza@liberouter.org>
List: tech-kern
Date: 01/23/2005 06:18:23
> : > Something like usbd is doubtlessly needed.  It would be
> : > nice if it could be common for all hot pluggable devices.
> : 
> : The recently-introduced /dev/drvctl seems to be a good place to
> : communicate driver attach/detach messages from the kernel to
> : userland. We have attach and detach sufficently centralized that it
> : shouldn't be hard to cause a message to be generated for a listener
> : there.
> 
> For FreeBSD, I was able to add about 200 lines of code to the kernel
> to newbus' centeralized location for each device's attach, detach and
> failure to probe.  I then wrote devd to cope with the events from the
> kernel.  At first, I tried to allow devd to 'vote' on what to do for
> unknown devices, but abadoned that idea in favor of having it just
> load a new kernel driver, which would then claim the device.
> 
> NetBSD's centralized attach/detach stuff should prove sufficient.

Yes, kernel changes needed for that are trivial. Event daemon based solely
on autoconf(9) isn't strong enough though -- additional interfaces (such as
/dev/usb) may provide more information about the device, that may help you
distinguish between different usb flash disks for instance and mount them
at different locations. I think that would be what users expect.

I'm currently playing around with a daemon that listens to several device
event sources [*] and takes actions according to a config file, much like
usbd does -- just a bit more general. [This seems more reasonable approach
then trying to invent some Kernel Unified Device Notification Theory, which
I was thinking about for a few minutes.] Not that I got something terribly
useful yet...

	Regards,
		-- Jachym Holecek

[*] Seems better then having a per-source daemon, each rolling its own
    config syntax.