[Devel-conf] [gmane.linux.hotplug.devel] RUN rules to enable/disable printer queues

Anton Farygin =?iso-8859-1?q?rider_=CE=C1_altlinux=2Ecom?=
Пт Авг 26 12:54:13 MSD 2005


Кстати, Стас... а что у нас проиходит при
подключении/удалении принтера ?

Надо бы тоже как-то автоматизировать этот процесс.

Rgds,
Rider


On Thu, 25 Aug 2005 17:43:53 -0700, Zack Weinberg wrote:

> 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=add 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




Подробная информация о списке рассылки devel-conf