scanbuttond stalls after first button pressed
Status: Alpha
Brought to you by:
root84
I've followed the gentoo wiki instructions to install it with ubuntu 6.10 and it worked as expected.
After upgrading to ubuntu 7.05, scanbuttond (version 0.2.3) exhibits a strange behavior.
if the buttonpressed.sh script does not take time in longer activities such as scanning, it works.
running scanbuttond -f, I get each button press reported by the script.
the moment something is executed which takes time, e.g. a sleep 5, scanbuttond stops to do anything (at least it looks so).
test case: a simple sleep 5 in buttonpressed.sh, the script is only executed once.
I've been able to work-around this by executing a separate scan shell script in the background.
Logged In: YES
user_id=914010
Originator: NO
#!/bin/sh
# This script is started by scanbuttond whenever a scanner 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.
exec >> /var/log/scanbuttond.log
exec 2>&1
echo
echo -- $0 started on `date`
LOCKFILE="/tmp/$2.lock"
PRINTER="-P bn"
case $1 in
1)
echo "button 1 has been pressed on $2"
;;
2)
echo "button 2 has been pressed on $2"
# Turn your scanner+printer into an A4 photocopier.
# 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
RES="--resolution 300 --contrast 10 --brightness 0"
scanimage --verbose --device-name $2 \
--mode Gray -x 210 -y 297 $RES |
pnmtops -width=8.27 -height=11.69 |
lpr -J $2 $PRINTER
lockfile-remove $LOCKFILE
;;
3)
echo "button 3 has been pressed on $2"
;;
4)
echo "button 4 has been pressed on $2"
;;
esac
Logged In: YES
user_id=914010
Originator: NO
Script author: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=370428