Subject: Re: Pluged : USBd for NetBSD ?
To: Steven M. Bellovin <smb@cs.columbia.edu>
From: Jachym Holecek <freza@liberouter.org>
List: tech-userlevel
Date: 01/19/2005 18:04:06
> >> And if someone inserts a pcmcia card?
> >> 
> >> I think in -current syslogd can handle this (though this might not be
> >> the obvious solution). And of course for network cards there is ifwatchd.
> >
> >If you mean parsing kernel printfs, I don't think that's enough. You
> >can't easily tell a failed attach attempt that way.

Actually, it's enough to clear DVF_ACTIVE when attach fails, as should
be done anyway AFAIU.

> >Or does -current syslogd have a new feature I'm missing?
> >
> The problem isn't syslogd, it's the kernel -- does it print the 
> messages you want for each situation?

For regular devices, autoconf(9) can provide attach/detach/activate/
deactivate events in a straighforward way [*]. For removable media,
the controller would have to inject events manually, say:

	devannounce(&sc->sc_dev, MEDIA, 0); /* media gone */
	devannounce(&sc->sc_dev, MEDIA, 1); /* media inserted */

Are there other important events userland might be interested in?

	Regards,
		-- Jachym Holecek

[*] Network interface drivers are a bit special, but there's already
    an interface covering them.