In<nobr> <wbr></nobr>/etc/scanbuttond/initscanner.sh I have this. I am not sure whether this is needed, but it solved some mysterious problem for me, and apparently it does no harm:
<tt>#!/bin/sh
# This script is executed whenever scanbuttond # finds new devices. # If your scanner needs a firmware upload or any other kind # of special action to be taken on initialization, put # the appropriate command here.
scanimage -n</tt>
And this is my<nobr> <wbr></nobr>/etc/scanbuttond/buttonpressed.sh. I configured three buttons to respectively fax, photocopy in b&w, and photocopy in colour. The script contains a comment detailing the packages that you need to install in order to have it work. Additionally, you need an installed and working cups system. The script logs what it does and possible errors at<nobr> <wbr></nobr>/var/log/scanbuttond.log. Additional explanations are below.
<tt>#!/bin/sh
# This script is started by scanbuttond whenever a scanner button has been pressed. # Scanbuttond passes the following parameters to us: # $1<nobr> <wbr></nobr>... the button number # $2<nobr> <wbr></nobr>... the scanner's SANE device name, which comes in handy if there are two or # more scanners. In this case we can pass the device name to SANE programs # like scanimage.
FAXPRINTER="-P fax" # a fax printer COLPRINTER="-P HP" # a colour printer BWPRINTER="-P bn" # a B&W printer PRES="--resolution 300 --contrast 15 --brightness 0" FRES="--resolution 400 --contrast 30 --brightness 0"
USER=me # access to the X server XD=:0 # which X server display
case $1 in 3) echo "button 3 has been pressed on $2 (fax)"
# Fax. # Requires efax-gtk, sane-utils, lockfile-progs and netpbm. DISPLAY=$XD su $USER -c 'efax-gtk -s' & # start the fax server if ! lockfile-create --retry 2 $LOCKFILE; then echo "Error: scanning already in progress for $2" exit fi #set -x scanimage --verbose --device-name $2 \ --mode Gray -x 210 -y 297 $FRES | pnmtops -width=8.27 -height=11.69 | lpr -J $2 $FAXPRINTER lockfile-remove $LOCKFILE <nobr> <wbr></nobr>;; 2) echo "button 2 has been pressed on $2 (b&w copy)"
# B^W photocopy. # Requires sane-utils, lockfile-progs and netpbm. if ! lockfile-create --retry 2 $LOCKFILE; then echo "Error: scanning already in progress for $2" exit fi #set -x scanimage --verbose --device-name $2 \ --mode Gray -x 210 -y 297 $PRES | pnmtops -width=8.27 -height=11.69 | lpr -J $2 $BWPRINTER lockfile-remove $LOCKFILE <nobr> <wbr></nobr>;; 1) echo "button 1 has been pressed on $2 (color copy)"
# Color photocopy. # Requires sane-utils, lockfile-progs and netpbm. if ! lockfile-create --retry 2 $LOCKFILE; then echo "Error: scanning already in progress for $2" exit fi #set -x scanimage --verbose --device-name $2 \ --mode Color -x 210 -y 297 $PRES | pnmtops -width=8.27 -height=11.69 | lpr -J $2 $COLPRINTER lockfile-remove $LOCKFILE <nobr> <wbr></nobr>;; 4) echo "button 4 has been pressed on $2" <nobr> <wbr></nobr>;; esac</tt>
The B&W and colour phtocopies work by sending the print job to different printers. You must configure your cups with two printers, and in the printer options configure one of them to print in B&W. The only reason to do that is to save colour ink, so don't bother to do that if you don't care about ink saving.
The fax works by using efax-gtk together with cups. First install efax-gtk, configure it for your modem, then create a cups printer: call it <tt>fax</tt>, then choose a network printer of type <tt>HP JetDirect</tt>, host <tt>localhost</tt>, port <tt>9900</tt>. When you print anything to that printer, it goes to the efax-gtk daemon. In the above script, the daemon is called as the user <tt>me</tt>, which you should change to the user that most often is using the X server. If that user is not logged, the daemon will not start, and the print job will stay queued at the printer until the daemon comes up, perhaps because you call it explicitly from a terminal or from the menu.
The daemon by default pops up a window asking for the telephone number when it receives a fax request from the 9900 socket. If you configured your modem correctly, once you give the number everything should go on, and the fax should be sent.
Note for Italian users: in Italy phones do not use a tone. So X3 should be added to the modem initialisation string. This is the string I use, in the Initialization Params box of the efax-gtk settings:
some more ideas and how to fax
Posted by: Administrator on January 25, 2007 07:29 PMI run scanbuttond at boot time. You should save the following script as<nobr> <wbr></nobr>/etc/init.d/scanbuttond, then run
Next time you reboot, scanbuttond will be started automatically. If you want to start or stop it manually, do
orrespectively. Here is the boot script:In<nobr> <wbr></nobr>/etc/scanbuttond/initscanner.sh I have this. I am not sure whether this is needed, but it solved some mysterious problem for me, and apparently it does no harm:
And this is my<nobr> <wbr></nobr>/etc/scanbuttond/buttonpressed.sh. I configured three buttons to respectively fax, photocopy in b&w, and photocopy in colour. The script contains a comment detailing the packages that you need to install in order to have it work. Additionally, you need an installed and working cups system. The script logs what it does and possible errors at<nobr> <wbr></nobr>/var/log/scanbuttond.log. Additional explanations are below.
The B&W and colour phtocopies work by sending the print job to different printers. You must configure your cups with two printers, and in the printer options configure one of them to print in B&W. The only reason to do that is to save colour ink, so don't bother to do that if you don't care about ink saving.
The fax works by using efax-gtk together with cups. First install efax-gtk, configure it for your modem, then create a cups printer: call it <tt>fax</tt>, then choose a network printer of type <tt>HP JetDirect</tt>, host <tt>localhost</tt>, port <tt>9900</tt>. When you print anything to that printer, it goes to the efax-gtk daemon. In the above script, the daemon is called as the user <tt>me</tt>, which you should change to the user that most often is using the X server. If that user is not logged, the daemon will not start, and the print job will stay queued at the printer until the daemon comes up, perhaps because you call it explicitly from a terminal or from the menu.
The daemon by default pops up a window asking for the telephone number when it receives a fax request from the 9900 socket. If you configured your modem correctly, once you give the number everything should go on, and the fax should be sent.
Note for Italian users: in Italy phones do not use a tone. So X3 should be added to the modem initialisation string. This is the string I use, in the Initialization Params box of the efax-gtk settings:
#