From mboxrd@z Thu Jan 1 00:00:00 1970 From: Harald Hoyer Date: Thu, 03 Jun 2004 08:34:03 +0000 Subject: Re: Run script when USB scanner unplugged Message-Id: <40BEE27B.60306@redhat.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="------------enigBDCD9DEC4BACFFF64ABF0496" List-Id: References: <40BE3850.8070106@comcast.net> In-Reply-To: <40BE3850.8070106@comcast.net> To: linux-hotplug@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigBDCD9DEC4BACFFF64ABF0496 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Ian Pilcher wrote: > Running Fedora Core 2 here. I've found that the hotplug scripts shipped > with the distribution do a fine job of setting the permissions when a > USB scanner is plugged in *after* a user has logged in. Unfortunately, > this is not the most common usage scenario; I leave my scanner plugged > in pretty much all the time, and I suspect that most other users do the > same. > > What's needed, at least on Red Hat/Fedora Core systems, is a symlink > which will tell PAM to adjust the permissions when a "console" user logs > in. I've hacked /etc/hotplug/usb/libusbscanner to do the following when > a scanner is plugged in: > > DEVID="${REMOVER#/var/run/usb/}" > rm -f "/dev/usb/scanner-${DEVID}" > ln -s "${DEVICE}" "/dev/usb/scanner-${DEVID}" > > So far so good. The link is created when the system boots, and PAM > follows it and sets the device permissions properly when a "console > user" logs in. > > Now I want to remove the link when (if) the scanner is unplugged. I've > tried adding an 'if [ "${ACTION}" = "remove ]' section to > /etc/hotplug/usb/libusbscanner, but that script doesn't appear to get > executed when a USB scanner is unplugged. > > What do I need to do? > > Thanks! > Install the FC2 udev rpm... read the manpage and add a *.rule file to /etc/udev/rules.d . Also add your scanner to /etc/security/console.perms (man 5 console.perms). --------------enigBDCD9DEC4BACFFF64ABF0496 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFAvuJ7t7dFwsVXVUIRAioaAJ968eEgUo0P+bxEURtdnLW5XjmiAgCgptCc ZQ1ZY1R0ZlyBTWkEocydXtI= =L+gA -----END PGP SIGNATURE----- --------------enigBDCD9DEC4BACFFF64ABF0496-- ------------------------------------------------------- This SF.Net email is sponsored by the new InstallShield X. >From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 _______________________________________________ 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