From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Brownell Date: Mon, 08 Jul 2002 15:46:21 +0000 Subject: Re: hotplug scritps calling my app Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Hi, > for some smartcard/token i wrote a user space application > as driver. It could be installed as /sbin/hotplug on systems > without the default hotplug scripts. > > with the default scripts, is this the right thing to do? > - add entry to /etc/hotplug/usb.usermap > - create directory /etc/hotplug/usb > - copy my userspace driver to /et/hotplug/usb/etoken I'd make the /etc/hotplug/usb/etoken a script that invokes a driver/app that lives someplace else, but otherwise yes. > of course debian (as always) needs a special handling: > add entries to /etc/hotplug/usb.usermap.local and call > update-usb.usermap. Actually, if I trust the manpage, add to /usr/lib/hotplug and then the update-usb.usermap regens the /etc/hotplug file. > i noticed a small difference in the driver called > via the true hotplug <-> the init.d startup script: > - DEBUG="kernel" is only set when called via kernel. And then, only when the kernel sets USB debugging on. The flag is basically boolean (set to some value, or otherwise) so far as the hotplug scripts are concerned. > - PRODUCT="0/0/0" (init.d script) versus PRODUCT="529/50c/100" (kernel) That is, the synthesized "coldplug" events aren't quite correct? Right. I'm not sure how to fix that. Not all of the relevant information is readily available, unless something is parsing /proc/bus/usb/devices ... which may be reasonable in Perl, but is not in BASH. Since that path is only happening when "usbmodules" is invoked, I suspect the thing to do might be to teach that program to dump the _right_ values of all the environment variables it's synthesizing. > - TYPE="usb" is only set when called from kernel. ??? No kernel I've seen has that. "TYPE=%d/%d/%d" in the USB hotplug printf strings since 2.4.0-test10 or so. Ah -- I see what's happening. "hotplug.functions" uses TYPE as a non-local variable, and it overrides the environment variable. I'll patch that. > - not called with any parameter (kernel and init.d script, but > /sbin/hotplug is called with "usb" as parameter). Right, /sbin/hotplug strips off the first parameter when it calls /etc/hotplug/$1.agent ... it'd be superfluous! > are these meant to be that way? > setting PRODUCT environment variable would be good IMO. Yes. A patch would be helpful. - Dave ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Oh, it's good to be a geek. http://thinkgeek.com/sf _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel