From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Just Keijser Date: Tue, 27 Mar 2007 14:40:09 +0000 Subject: Fedora Core 5, Aladdin eToken PRO32 and udev hotplug Message-Id: <46092CC9.9000106@nikhef.nl> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org hi all, I've got a weird problem with the udev-way of hotplugging things. here's=20 my setup. It's a bit long, so please bear with me ;-) - Fedora Core 5, kernel 2.6.20, i686 - udev-084-13.fc5.2 (FC5 default) - Aladdin eToken PRO32 with CardOS 4.21 (*NOT* recognized by=20 OpenCT/OpenSC); this is a USB stick that acts as a smart card for=20 storing certificates, private keys etc etc. - Aladdin RTE 3.65 eToken software (binaries only). Here's what happens: The RTE eToken software installs a daemon, /usr/local/sbin/etokend,=20 which listens on a UNIX socket /var/tmp/.etoken It also installs a perl script /etc/hotplug.d/usb/etoken.hotplug which you're suppose to call when an eToken is inserted or removed; the=20 Perl script talks to the etokend daemon using the /var/tmp/.etoken UNIX=20 socket. This mechanism works fine on CentOS 4 , with the older 'hotplug'=20 mechanism installed. I can plug the token in and out as many times as I=20 like, and it will be recognized every time. With FC5 and udev, things get hairier: first , I added a rule in /etc/udev/rules.d/20-etoken.rules --- # add rule ACTION=3D"add", BUS=3D"usb", SUBSYSTEM=3D"usb", \ SYSFS{idVendor}=3D"0529", SYSFS{idProduct}=3D"0600", \ RUN=3D"/etc/hotplug.d/usb/etoken.hotplug" --- to make sure the Perl thingie is called when I plug in a token. I've=20 added debug statements to the etoken.hotplug script and can see that it=20 is actually being called when I plug in the token (not when I remove it,=20 however). First gripe: how do I add a rule to call the same script when the token=20 in unplugged? When the token is unplugged the SYSFS vars seem to be=20 gone.... so how do I create a rule that matches this usb device only? The script is called, and the very first time I insert the token, it=20 works. Yippee for udev! However... if I switch tokens, or take it out and put it back in a=20 couple of times, then sooner or later it will no longer be recognized. I did some tracing and digging and am now stuck: - calling the /etc/hotplug.d/usb/etoken.hotplug by hand *ALWAYS* causes=20 the thing to come up, e.g. # ACTION=ADd DEVICE=3D/proc/bus/usb/001/003=20 /etc/hotplug.d/usb/etoken.hotplug works - calling the script from within the udev rules file causes it to=20 sometimes work and sometimes not. - if I stick 'socat' in between the hotplug script and the etokend=20 daemon I can see what data is sent to the etokend daemon. It's the same=20 from the command line as it is from within the udev framework. Also,=20 with 'socat' in the middle it seems to always work from the commandline=20 and merely sometimes from within the udev framework - the same script works fine on a CentOS4 box (kernel 2.6.9,=20 hotplug-2004_04_01-7.7) Of course, I'd like the eToken to be recognized by the OS without user=20 intervention... So the big question for me is: what's so different about how scripts are=20 called from within the udev manager vs calling them from the=20 commandline? I've checked all environment variables and tried to mimick=20 the 'udev' env var set as much as possible on the command line (e.g. no=20 PATH, MANPATH, LANG, LC_ALL etc etc) but on the command-line, the script=20 always works... thanks for your time, JJ Keijser System Integrator NIKHEF Amsterdam ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=DEVD= EV _______________________________________________ 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