Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:lrupp
scanbuttond
scanbuttond-buttonpressed.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File scanbuttond-buttonpressed.patch of Package scanbuttond
Index: scripts/buttonpressed.sh =================================================================== --- scripts/buttonpressed.sh.orig +++ scripts/buttonpressed.sh @@ -7,39 +7,46 @@ # more scanners. In this case we can pass the device name to SANE programs # like scanimage. -TMPFILE="/tmp/scan.tiff" -LOCKFILE="/tmp/copy.lock" + +BUTTON="$1" +DEVICE="$2" +PICDIR="/tmp/scanned/" +TMPFILE="${PICDIR}/`date +%Y%m%d%H%M%S`" +LOCKFILE="/var/tmp/${DEVICE}.lock" + +if [ -f ${LOCKFILE} ]; then + echo "Error: Device already in use. It seems that the previous scan has not finished yet. \ + If this is not the case, please execute 'rm -f ${LOCKFILE}'." >&2 + exit 1 +fi + +if [ -d ${PICDIR} ]; then + echo "Error: ${PICDIR} already exist. Please consult the content of the directory and \ + restart" >&2 + exit 1 +fi + +touch ${LOCKFILE} +mkdir -p ${PICDIR} case $1 in - 1) - echo "button 1 has been pressed on $2" - - # This example turns your scanner+printer into a photocopier. - # Fine-tuned for the Epson Perfection 2400, the HP LaserJet 1200 and - # ISO A4 paper size so that the scanned document matches the printer - # output as closely as possible. - # - # if [ -f $LOCKFILE ]; then - # echo "Error: Another scanning operation is currently in progress" - # exit - # fi - # touch $LOCKFILE - # rm -f $TMPFILE - # scanimage --device-name $2 --format tiff --mode Gray --quick-format A4 \ - # --resolution 300 --sharpness 0 --brightness -3 \ - # --gamma-correction "High contrast printing" > $TMPFILE - # tiff2ps -z -w 8.27 -h 11.69 $TMPFILE | lpr - # rm -f $LOCKFILE - # - ;; - 2) - echo "button 2 has been pressed on $2" - ;; - 3) - echo "button 3 has been pressed on $2" - ;; - 4) - echo "button 4 has been pressed on $2" - ;; + 1) + # Button one we'll use for one-touch scanning + /etc/scanbuttond/sbd-scan.sh ${TMPFILE} ${DEVICE} + ;; + 2) + # Button two we'll use for a direct copy via lpr + /etc/scanbuttond/sbd-print.sh ${TMPFILE} ${DEVICE} + ;; + 3) + # Button three we'll use to send to start an e-mail attachment + /etc/scanbuttond/sbd-mail.sh ${TMPFILE} ${DEVICE} + ;; + 4) + # Button four we'll use to start gimp + /etc/scanbuttond/sbd-gimp.sh ${TMPFILE} ${DEVICE} + ;; esac +rm -f ${LOCKFILE} +
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor