linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RUN rules to enable/disable printer queues
@ 2005-08-26  0:43 Zack Weinberg
  2005-08-26  1:01 ` Kay Sievers
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Zack Weinberg @ 2005-08-26  0:43 UTC (permalink / raw)
  To: linux-hotplug

I have a USB printer which is turned off most of the time.  I want to have
the computer automatically run "lpc start" and "lpc stop" on the relevant
print queue when the printer is turned on and off, respectively.

I tried to do this with this rule:

BUS="usb", SYSFS{product}="Lexmark Optra E310", SYSFS{serial}="0101137", \
    SYMLINK="lp_epson", RUN+="/etc/udev/scripts/lpqueue.sh"

where lpqueue.sh is a little script I wrote that maps ACTION­d to lpc
start, and ACTION=remove to lpc stop.

This correctly creates and deletes the lp_epson symlink, but lpqueue.sh is
only invoked on add events, not remove events, so it can only do half of
its job.  I believe that the rule *does* match on both add and remove,
because if it didn't match on remove, it wouldn't know to delete the
symlink; so there must be some quirk with RUN= that is not mentioned in
the manual...  Any ideas?

I am using udev 068 as packaged by Debian unstable, in conjunction with
kernel 2.6.12.5 (prepackaged Debian kernel, linux-image-2.6.12-1-686-smp).

As a side note, it isn't terribly important to me as I only have the one
printer, but I have to hardwire the name of the print queue in lpqueue.sh
because there isn't enough info passed in its environment to tell one USB
printer from another.  If the SYMLINK list were made available to RUN
scripts, the script could then do the right thing for an arbitrary number
of printers.  (This would be useful to someone who had both a color inkjet
and a B/W laser printer attached to the same computer via USB, say.)

zw



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-08-26 19:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-26  0:43 RUN rules to enable/disable printer queues Zack Weinberg
2005-08-26  1:01 ` Kay Sievers
2005-08-26  3:06 ` Zack Weinberg
2005-08-26 11:46 ` Kay Sievers
2005-08-26 15:50 ` Ian Pilcher
2005-08-26 19:36 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).