Use the buttons on a scanner for Linux scanbuttond Scanbbuttond can use and configure a scanner's buttons on Linux. Here's a tutorial to install and configure the buttons on an Epson Perfection 1240U scanner under Ubuntu.
This tutorial has been tested on Ubuntu 9.10 "Karmic Koala" and an Epson Perfection 1240U.
Installation
- must install the package scanbuttond (click on the link to install it).
Test buttons
scanbuttond Launch in a terminal (menu Applications> Accessories> Terminal ), type:
scanbuttond-r 500000
Press ( s) button (s) of the scanner, and check (s) is (are) recognized (s) by typing in a terminal:
scanbuttond grep-R / var / log
The terminal should return the number (s) button (s) hurry (s) with a timestamp.
Configuration scanbuttond
Attention is the hardest part! Indeed we will have to adapt each button to a specific use, depending on what is marked on the buttons or after each selection. This example is for the Epson Perfection 1240U, which has three buttons configured for:
Button 1: scanner with Single-Scan (from Ubuntu 10.04);
No Button 2: photocopied black and white 150 dpi (requires installation of package libtiff-tools )
Button 3: scan and edit with Gimp in 600 dpi.
All with saving the file with date in the personnel file. To configure
scanbuttond, we will have edit / etc / scanbuttond / buttonpressed.sh (requires password):
- press Alt + F2 and type: gksudo gedit / etc / scanbuttond / buttonpressed.sh
- file for an Epson Perfection 1240U, which has three buttons is as follows (this file is not perfect but works):
# / bin / sh
# This script IS
Started by scanbuttond Whenever a scan button has been "pressed.
# Scanbuttond passes the following parameters to us:
# $1 ... the button number
# $2 ... 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.
# *** WARNING ***
# The example code below contains just simple examples how things may get done.
# Don't simply uncomment the code on systems with untrusted users! This would
# make your button scanning vulnerable to various kinds of attacks by local users.
# *** WARNING ***
#TMPFILE="/tmp/scan.tiff"
#LOCKFILE="/tmp/copy.lock"
BUTTON="$1"
DEVICE = "epson: libusb: 003:003"
Picdi = "/ home / laurent /"
TMPFILE = "$ {Picdi} /` date Numérisation_du_ `_`+% Y% m% d% H% M% S `"
LockFile = "/ tmp / $ {DEVICE}. lock"
if [-f $ {} LockFile] Then
zenity - error - title = "Error: Device is busy." - Text = "The previous scan is complete. \\
If not, run the following command 'rm-f $ {LockFile}'." commande suivante 'rm -f ${LOCKFILE}'."
exit
fi
case $1 in
1)
echo "button 1 has been pressed on $2"
simple-scan
;;
2)
echo "button 2 has been pressed on $2"
scanimage -d epson:libusb:003:003 --format=tiff --mode=Gray --depth=8 --resolution=150 > $TMPFILE && \
tiff2ps -z -w 8.27 -h 11.69 $TMPFILE 4 has-been pressed on $ 2 "
;;
esac chgrp scanner $ {TMPFILE} .*
chmod g + rw $ {TMPFILE} .*
rm-f $ {} LockFile
change the line
Picdi = "/ home / username /"
with the proper user name (or directory of your choice)
change the DEVICE parameter
for each button (- epson: libusb: 003:003
for my case, check with the command: grep-R - scanbuttond / var / log ) after changes are made, click Save on and close the text editor.
The buttons should be recognized, according to the assigned options. - Note: Do not forget to make the file executable buttonpressed.sh! To do this, open the browser with administrative rights (be careful what you do):
press Alt + F2
and type: gksudo nautilus
navigate to - / etc / scanbuttond and right click on buttonpressed.sh, choose Properties tab Permissions
, check box: Allow - executing the file as a program . close the window.
- Automatically start scanbuttond
- scanbuttond Finally we must add at startup:
go to the menu System> Preferences> Startup Applications
click the Add button return - scanbuttond in box Name
and put - / usr / local / bin /-r 500000 scanbuttond in box Order
- click on Close. Source
- http://en.gentoo-wiki.com/wiki/Scanner_buttons_and_one-touch_scanning