debian/0000755000000000000000000000000012246443264007175 5ustar debian/dirs0000644000000000000000000000001012246443264010050 0ustar usr/bin debian/source/0000755000000000000000000000000012246443264010475 5ustar debian/source/format0000644000000000000000000000001412246443264011703 0ustar 3.0 (quilt) debian/rules0000755000000000000000000000576012246443264010265 0ustar #!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 package = scanbuttond autofiles = include/scanbuttond/config.h.in INSTALL # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) confflags += --build $(DEB_HOST_GNU_TYPE) else confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) endif CFLAGS = -Wall -g INSTALL = install INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644 INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755 INSTALL_SCRIPT = $(INSTALL) -p -o root -g root -m 755 INSTALL_DIR = $(INSTALL) -p -d -o root -g root -m 755 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) MAKEFLAGS += -j$(NUMJOBS) endif configure: configure-stamp configure-stamp: dh_testdir set -e; for f in $(autofiles); do cp "$$f" "$$f.upstream"; done if [ -f /usr/share/libtool/config/ltmain.sh ]; then \ cp /usr/share/libtool/config/ltmain.sh .; \ else \ cp /usr/share/libtool/ltmain.sh .; \ fi -autoreconf -fi automake --add-missing autoconf -test -r /usr/share/misc/config.sub && \ cp -f /usr/share/misc/config.sub config.sub -test -r /usr/share/misc/config.guess && \ cp -f /usr/share/misc/config.guess config.guess ./configure $(confflags) --prefix=/usr --libdir=\$${prefix}/lib/scanbuttond --sysconfdir=/etc touch configure-stamp build: build-arch build-indep build-arch: build-stamp build-indep: build-stamp build-stamp: configure-stamp dh_testdir $(MAKE) touch build-stamp clean: configure-stamp dh_testdir dh_testroot rm -f build-stamp configure-stamp $(MAKE) maintainer-clean rm -f Makefile.in aclocal.m4 backends/Makefile.in config.guess config.sub configure contrib/Makefile.in depcomp install-sh interface/Makefile.in ltmain.sh missing scripts/Makefile.in compile dh_clean set -e; for f in $(autofiles); do if [ -f "$$f.upstream" ]; then mv $$f.upstream $$f; fi; done install: build dh_testdir dh_testroot dh_prep dh_installdirs $(MAKE) install DESTDIR=$(CURDIR)/debian/$(package) find $(CURDIR)/debian/$(package) -name '*.la' | xargs rm -f binary-indep: build install # We have nothing to do by default. binary-arch: build install dh_testdir dh_testroot dh_installchangelogs ChangeLog dh_installdocs dh_installexamples dh_installman dh_installinit dh_link dh_strip dh_compress dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure debian/scanbuttond.default0000644000000000000000000000037312246443264013072 0ustar # Defaults for the scanbuttond initscript, from scanbuttond # Set to yes to start scanbuttond RUN=no # Set to the user scanbuttond should run as RUN_AS_USER=saned # Disable logging of "no supported devices found" in /var/log/daemon.log QUIET_LOG=1 debian/docs0000644000000000000000000000001712246443264010046 0ustar AUTHORS README debian/compat0000644000000000000000000000000212246443264010373 0ustar 7 debian/README.Debian0000644000000000000000000000125512246443264011241 0ustar scanbuttond for Debian ---------------------- In order to make your scanner buttons to do something useful, you must edit the /etc/scanbuttond/buttonpressed.sh script. WARNING: The example code in the script contains just simple examples how things may be 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. IMHO scanbuttond should be best started and stopped by udev. However I'm not a udev expert and my private scripts don't work well enough to be included in Debian. If you'd like to help, please contact me. -- Milan Zamazal , Sun, 02 Dec 2007 debian/patches/0000755000000000000000000000000012246443264010624 5ustar debian/patches/quiet.patch0000644000000000000000000000357712246443264013010 0ustar Index: scanbuttond/scanbuttond.c =================================================================== --- scanbuttond.orig/scanbuttond.c 2010-05-23 17:07:09.000000000 +0200 +++ scanbuttond/scanbuttond.c 2010-05-23 17:07:18.000000000 +0200 @@ -54,6 +54,7 @@ {"retrydelay", required_argument, NULL, 'r'}, {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'v'}, + {"quiet", no_argument, NULL, 'q'}, {NULL, 0, NULL, 0} }; @@ -67,6 +68,7 @@ static int daemonize; static int killed = 0; static char* path; +static int quiet; char* scanbtnd_get_connection_name(int connection) @@ -141,6 +143,7 @@ printf(" -r, --retrydelay=DELAY The retry delay (ms), default: %ld\n", DEF_RETRY_DELAY); printf(" -h, --help Shows this screen\n"); printf(" -v, --version Shows the version\n"); + printf(" -q, --quiet Shut up about not finding any scanners\n"); } @@ -153,8 +156,9 @@ poll_delay = -1; retry_delay = -1; daemonize = 1; + quiet = 0; - while ((c = getopt_long (argc, argv, "fb:s:S:p:r:hv", long_opts, NULL)) != -1) { + while ((c = getopt_long (argc, argv, "fb:s:S:p:r:hvq", long_opts, NULL)) != -1) { switch (c) { case 'f': daemonize = 0; @@ -192,6 +196,9 @@ show_version(); exit(EXIT_SUCCESS); break; + case 'q': + quiet = 1; + break; } } @@ -307,11 +314,13 @@ while (killed == 0) { if (scanners == NULL) { - syslog(LOG_DEBUG, "rescanning devices..."); + if (!quiet) + syslog(LOG_DEBUG, "rescanning devices..."); backend->scanbtnd_rescan(); scanners = backend->scanbtnd_get_supported_devices(); if (scanners == NULL) { - syslog(LOG_DEBUG, "no supported devices found. rescanning in a few seconds..."); + if (!quiet) + syslog(LOG_DEBUG, "no supported devices found. rescanning in a few seconds..."); usleep(retry_delay); continue; } debian/patches/series0000644000000000000000000000021112246443264012033 0ustar perfection1250.patch quiet.patch path-segfault.patch buttonpressed-example.patch hp4500.patch fujitsu.patch xerox-travelscanner100.patch debian/patches/buttonpressed-example.patch0000644000000000000000000000526212246443264016204 0ustar Index: scanbuttond/scripts/buttonpressed.sh.example =================================================================== --- scanbuttond.orig/scripts/buttonpressed.sh.example 2011-02-22 21:54:39.000000000 +0100 +++ scanbuttond/scripts/buttonpressed.sh.example 2011-05-07 21:35:52.000000000 +0200 @@ -7,9 +7,28 @@ # 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" +TMPFILE_PDF="/tmp/scan.pdf" +TMPFILE_PS="/tmp/scan.ps" LOCKFILE="/tmp/copy.lock" +# Lock file handling and GNOME examples for buttons 2, 3, 4 below contributed +# by Lutz Müller . + +if ! lockfile-create --retry 2 $LOCKFILE; then + echo "Error: scanning already in progress for $2" + exit +fi +rm -f $TMPFILE +rm -f $TMPFILE_PDF +rm -f $TMPFILE_PS + case $1 in 1) echo "button 1 has been pressed on $2" @@ -47,15 +66,39 @@ # echo "The print job has been submitted" | festival --tts # rm -f $LOCKFILE # + + # Another example of the same action, but using other tools and + # working with newer scanimage versions. + # It requires sane-utils, lockfile-progs and netpbm. + # Suggested by Francesco Potorti`. + # + # if ! lockfile-create --retry 2 $LOCKFILE; then + # echo "Error: scanning already in progress for $2" + # exit + # fi + # SCAN_OPTIONS="--resolution 300 --contrast 10 --brightness 0" + # scanimage --verbose --device-name $2 \ + # --mode Gray -x 210 -y 297 $SCAN_OPTIONS | + # pnmtops -width=8.27 -height=11.69 | + # lpr -J $2 $PRINTER + # lockfile-remove $LOCKFILE ;; 2) echo "button 2 has been pressed on $2" + # flegita ;; 3) echo "button 3 has been pressed on $2" + # scanimage --resolution 300 --device-name $2 --mode Color -x 210 -y 297 | pnmtops -width=8.27 -height=11.69 > $TMPFILE_PS + # ps2pdf $TMPFILE_PS $TMPFILE_PDF + # evince $TMPFILE_PDF ;; 4) echo "button 4 has been pressed on $2" + # scanimage --resolution 300 --device-name $2 --mode Color -x 210 -y 297 | pnmtops -width=8.27 -height=11.69 > $TMPFILE_PS + # ps2pdf $TMPFILE_PS $TMPFILE_PDF + # nautilus-sendto $TMPFILE_PDF ;; esac +lockfile-remove $LOCKFILE debian/patches/perfection1250.patch0000644000000000000000000000222012246443264014307 0ustar Index: scanbuttond/backends/plustek.c =================================================================== --- scanbuttond/backends/plustek.c.orig 2011-01-13 21:51:45.000000000 +0100 +++ scanbuttond/backends/plustek.c 2011-01-13 21:54:53.000000000 +0100 @@ -29,7 +29,7 @@ static char* backend_name = "Plustek USB"; -#define NUM_SUPPORTED_USB_DEVICES 9 +#define NUM_SUPPORTED_USB_DEVICES 10 static int supported_usb_devices[NUM_SUPPORTED_USB_DEVICES][3] = { // vendor, product, num_buttons @@ -39,6 +39,7 @@ { 0x04a9, 0x220d, 3 }, // CanoScan LiDE 20 { 0x04a9, 0x2220, 3 }, // CanoScan LiDE 25 { 0x04a9, 0x220e, 3 }, // CanoScan LiDE 30 + { 0x04b8, 0x010f, 4 }, // Epson Perfection 1250 { 0x04b8, 0x011d, 4 }, // Epson Perfection 1260 { 0x03f0, 0x0605, 2 }, // HP ScanJet 2200c (maybe only 1 button?) { 0x0458, 0x2007, 5 } // Genius (KYE) ColorPage-HR6 V2 (5 buttons) @@ -51,6 +52,7 @@ { "Canon", "CanoScan LiDE 20" }, { "Canon", "CanoScan LiDE 25" }, { "Canon", "CanoScan LiDE 30" }, + { "Epson", "Perfection 1250" }, { "Epson", "Perfection 1260" }, { "Hewlett-Packard", "ScanJet 2200c" }, { "Genius (KYE)", "ColorPage-HR6 V2" } debian/patches/fujitsu.patch0000644000000000000000000002506712246443264013350 0ustar Index: scanbuttond/backends/fujitsu.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ scanbuttond/backends/fujitsu.c 2013-04-06 19:02:09.000000001 +0200 @@ -0,0 +1,302 @@ +// fujitsu.c: Fujitsu device backend +// This file is part of scanbuttond. +// Copyleft )c( 2005-2006 by Bernhard Stiftner +// Thanks to J. Javier Maestro for sniffing the button codes ;-) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#include +#include +#include +#include +#include +#include +#include "scanbuttond/scanbuttond.h" +#include "scanbuttond/libusbi.h" +#include "fujitsu.h" + +static char* backend_name = "Fujitsu USB"; + +#define NUM_SUPPORTED_USB_DEVICES 5 + +static int supported_usb_devices[NUM_SUPPORTED_USB_DEVICES][3] = { + { 0x04c5, 0x11a2, 1 }, // Fujitsu ScanSnap S1500 + { 0x04c5, 0x1096, 1 }, // Fujitsu fi-5110EOX + { 0x04c5, 0x10e1, 1 }, // Fujitsu fi-5220C + { 0x04c5, 0x114f, 1 }, // Fujitsu fi-6130 + { 0x04c5, 0x11f3, 1 } // Fujitsu fi-6130Z +}; + +// TODO: check if this backend really works on the Epson 2580 too... +static char* usb_device_descriptions[NUM_SUPPORTED_USB_DEVICES][2] = { + { "Fujitsu", "ScanSnap S1500" }, + { "Fujitsu", "fi-5110EOX" }, + { "Fujitsu", "fi-5220C" }, + { "Fujitsu", "fi-6130" }, + { "Fujitsu", "fi-6130Z" } +}; + + +static libusb_handle_t* libusb_handle; +static scanner_t* fujitsu_scanners = NULL; + + +// returns -1 if the scanner is unsupported, or the index of the +// corresponding vendor-product pair in the supported_usb_devices array. +int fujitsu_match_libusb_scanner(libusb_device_t* device) +{ + int index; + for (index = 0; index < NUM_SUPPORTED_USB_DEVICES; index++) { + if (supported_usb_devices[index][0] == device->vendorID && + supported_usb_devices[index][1] == device->productID) { + break; + } + } + if (index >= NUM_SUPPORTED_USB_DEVICES) return -1; + return index; +} + + +void fujitsu_attach_libusb_scanner(libusb_device_t* device) +{ + const char* descriptor_prefix = "fujitsu:libusb:"; + int index = fujitsu_match_libusb_scanner(device); + if (index < 0) return; // unsupported + scanner_t* scanner = (scanner_t*)malloc(sizeof(scanner_t)); + scanner->vendor = usb_device_descriptions[index][0]; + scanner->product = usb_device_descriptions[index][1]; + scanner->connection = CONNECTION_LIBUSB; + scanner->internal_dev_ptr = (void*)device; + scanner->lastbutton = 0; + scanner->sane_device = (char*)malloc(strlen(device->location) + + strlen(descriptor_prefix) + 1); + strcpy(scanner->sane_device, descriptor_prefix); + strcat(scanner->sane_device, device->location); + scanner->num_buttons = supported_usb_devices[index][2]; + scanner->is_open = 0; + scanner->next = fujitsu_scanners; + fujitsu_scanners = scanner; +} + + +void fujitsu_detach_scanners(void) +{ + scanner_t* next; + while (fujitsu_scanners != NULL) { + next = fujitsu_scanners->next; + free(fujitsu_scanners->sane_device); + free(fujitsu_scanners); + fujitsu_scanners = next; + } +} + + +void fujitsu_scan_devices(libusb_device_t* devices) +{ + int index; + libusb_device_t* device = devices; + while (device != NULL) { + index = fujitsu_match_libusb_scanner(device); + if (index >= 0) + fujitsu_attach_libusb_scanner(device); + device = device->next; + } +} + + +int fujitsu_init_libusb(void) +{ + libusb_device_t* devices; + + libusb_handle = libusb_init(); + devices = libusb_get_devices(libusb_handle); + fujitsu_scan_devices(devices); + return 0; +} + + +const char* scanbtnd_get_backend_name(void) +{ + return backend_name; +} + + +int scanbtnd_init(void) +{ + fujitsu_scanners = NULL; + + syslog(LOG_INFO, "fujitsu-backend: init"); + return fujitsu_init_libusb(); +} + + +int scanbtnd_rescan(void) +{ + libusb_device_t* devices; + + fujitsu_detach_scanners(); + fujitsu_scanners = NULL; + libusb_rescan(libusb_handle); + devices = libusb_get_devices(libusb_handle); + fujitsu_scan_devices(devices); + return 0; +} + + +const scanner_t* scanbtnd_get_supported_devices(void) +{ + return fujitsu_scanners; +} + + +int scanbtnd_open(scanner_t* scanner) +{ + int result = -ENOSYS; + if (scanner->is_open) + return -EINVAL; + switch (scanner->connection) { + case CONNECTION_LIBUSB: + // if devices have been added/removed, return -ENODEV to + // make scanbuttond update its device list + if (libusb_get_changed_device_count() != 0) + return -ENODEV; + result = libusb_open((libusb_device_t*)scanner->internal_dev_ptr); + break; + } + if (result == 0) + scanner->is_open = 1; + return result; +} + + +int scanbtnd_close(scanner_t* scanner) +{ + int result = -ENOSYS; + if (!scanner->is_open) + return -EINVAL; + switch (scanner->connection) { + case CONNECTION_LIBUSB: + result = libusb_close((libusb_device_t*)scanner->internal_dev_ptr); + break; + } + if (result == 0) + scanner->is_open = 0; + return result; +} + + +int fujitsu_read(scanner_t* scanner, void* buffer, int bytecount) +{ + switch (scanner->connection) { + case CONNECTION_LIBUSB: + return libusb_read((libusb_device_t*)scanner->internal_dev_ptr, + buffer, bytecount); + break; + } + return -1; +} + + +int fujitsu_write(scanner_t* scanner, void* buffer, int bytecount) +{ + switch (scanner->connection) { + case CONNECTION_LIBUSB: + return libusb_write((libusb_device_t*)scanner->internal_dev_ptr, + buffer, bytecount); + break; + } + return -1; +} + +void fujitsu_flush(scanner_t* scanner) +{ + switch (scanner->connection) { + case CONNECTION_LIBUSB: + libusb_flush((libusb_device_t*)scanner->internal_dev_ptr); + break; + } +} + +static unsigned char CMD[] = { + 0x43, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xc2, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0a, + 0x00, 0x00, 0x00, + }; + +int scanbtnd_get_button(scanner_t* scanner) +{ + unsigned char bytes[20]; + int num_bytes; + int button = 0; + + if (!scanner->is_open) + return -EINVAL; + + num_bytes = fujitsu_write(scanner, (void*)CMD, sizeof CMD ); + if (num_bytes != (sizeof CMD)) { + syslog(LOG_WARNING, "fujitsu-backend: communication error: " + "write length:%d (expected:%d)", num_bytes, sizeof CMD); + fujitsu_flush(scanner); + return 0; + } + + num_bytes = fujitsu_read(scanner, (void*)bytes, 10); + if (num_bytes != 10) { + syslog(LOG_WARNING, "fujitsu-backend: communication error: " + "read length:%d (expected:%d)", + num_bytes, 10); + fujitsu_flush(scanner); + return 0; + } + + if (bytes[4] == 0x01) { + button = bytes[5]; + } + if (bytes[4] == 0x04) { + button = 10+bytes[5]; + } + + num_bytes = fujitsu_read(scanner, (void*)bytes, 13); + if (num_bytes != 13) { + syslog(LOG_WARNING, "fujitsu-backend: communication error: " + "read length:%d (expected:%d)", + num_bytes, 13); + fujitsu_flush(scanner); + return 0; + } + + return button; +} + + +const char* scanbtnd_get_sane_device_descriptor(scanner_t* scanner) +{ + return scanner->sane_device; +} + + +int scanbtnd_exit(void) +{ + syslog(LOG_INFO, "fujitsu-backend: exit"); + fujitsu_detach_scanners(); + libusb_exit(libusb_handle); + return 0; +} + Index: scanbuttond/backends/fujitsu.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ scanbuttond/backends/fujitsu.h 2013-04-06 19:01:11.000000001 +0200 @@ -0,0 +1,25 @@ +// fujitsu.h: Fujitsu device backend +// This file is part of scanbuttond. +// Copyleft )c( 2005 by Bernhard Stiftner +// Thanks to J. Javier Maestro for sniffing the button codes ;-) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#ifndef __FUJITSU_H_INCLUDED +#define __FUJITSU_H_INCLUDED + +#include "scanbuttond/backend.h" + +#endif Index: scanbuttond/backends/Makefile.am =================================================================== --- scanbuttond.orig/backends/Makefile.am 2013-04-06 18:57:36.000000001 +0200 +++ scanbuttond/backends/Makefile.am 2013-04-06 19:01:11.000000001 +0200 @@ -7,6 +7,7 @@ libscanbtnd-backend_plustek.la \ libscanbtnd-backend_plustek_umax.la \ libscanbtnd-backend_snapscan.la \ + libscanbtnd-backend_fujitsu.la \ libscanbtnd-backend_hp3500.la \ libscanbtnd-backend_hp3900.la \ libscanbtnd-backend_hp5590.la \ @@ -34,6 +35,9 @@ libscanbtnd_backend_snapscan_la_SOURCES = snapscan.c snapscan.h libscanbtnd_backend_snapscan_la_LIBADD = ../interface/libscanbtnd-interface_usb.la libscanbtnd_backend_snapscan_la_LDFLAGS = -module -version-info 1:0:0 +libscanbtnd_backend_fujitsu_la_SOURCES = fujitsu.c fujitsu.h +libscanbtnd_backend_fujitsu_la_LIBADD = ../interface/libscanbtnd-interface_usb.la +libscanbtnd_backend_fujitsu_la_LDFLAGS = -module -version-info 1:0:0 libscanbtnd_backend_artec_eplus48u_la_SOURCES = artec_eplus48u.c artec_eplus48u.h libscanbtnd_backend_artec_eplus48u_la_LIBADD = ../interface/libscanbtnd-interface_usb.la libscanbtnd_backend_artec_eplus48u_la_LDFLAGS = -module -version-info 1:0:0 Index: scanbuttond/backends/meta.conf =================================================================== --- scanbuttond.orig/backends/meta.conf 2013-04-06 18:57:36.000000001 +0200 +++ scanbuttond/backends/meta.conf 2013-04-06 19:01:11.000000001 +0200 @@ -9,4 +9,5 @@ libscanbtnd-backend_plustek libscanbtnd-backend_plustek_umax libscanbtnd-backend_snapscan +libscanbtnd-backend_fujitsu libscanbtnd-backend_gt68xx debian/patches/xerox-travelscanner100.patch0000644000000000000000000000264012246443264016102 0ustar --- a/backends/genesys.c +++ b/backends/genesys.c @@ -29,28 +29,34 @@ static char* backend_name = "Genesys USB"; -#define NUM_SUPPORTED_USB_DEVICES 2 +#define NUM_SUPPORTED_USB_DEVICES 3 static int supported_usb_devices[NUM_SUPPORTED_USB_DEVICES][3] = { // vendor, product, num_buttons { 0x04a9, 0x221c, 15 }, // CanoScan LiDE 60 (15 includes combined buttons - only 4 real buttons) - { 0x04a9, 0x2213, 15 } // CanoScan LiDE 35 (15 includes combined buttons - only 4 real buttons) + { 0x04a9, 0x2213, 15 }, // CanoScan LiDE 35 (15 includes combined buttons - only 4 real buttons) + { 0x04a7, 0x04ac, 15 }, // Xerox Travel Scanner 100 (2 real buttons) }; static char* usb_device_descriptions[NUM_SUPPORTED_USB_DEVICES][2] = { { "Canon", "CanoScan LiDE 60" }, - { "Canon", "CanoScan LiDE 35" } + { "Canon", "CanoScan LiDE 35" }, + { "Xerox", "Travel Scanner 100"}, }; static libusb_handle_t* libusb_handle; static scanner_t* genesys_scanners = NULL; // Button Map for CanonScan LiDE 60 -// button 1 = 0x08 copy +// button 1 = 0x08 copy // button 2 = 0x01 scan -// button 3 = 0x02 pdf +// button 3 = 0x02 pdf // button 4 = 0x04 mail // all others are combinations of the above (if pressed together) + +// Button map for Xerox Travel Scanner 100 +// paper insertion = 0x02 +// button = 0x03 static char button_map_lide60[256] = { 0, 2, 3, 5, 4, 6, 7, 8, 1, 9, 10, 11, debian/patches/hp4500.patch0000644000000000000000000000220212246443264012561 0ustar Description: Add support for HP ScanJet 4500 Author: potter000 Reviewed-by: Daniel T Chen Origin: potter000, https://bugs.launchpad.net/ubuntu/+source/scanbuttond/+bug/675326/+attachment/1733623/+files/hp4500.patch Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/scanbuttond/+bug/675326 Forwarded: no Last-Update: 2011-07-28 --- ./backends/hp5590.c +++ ./backends/hp5590.c @@ -27,11 +27,12 @@ static char* backend_name = "HP5590 USB"; -#define NUM_SUPPORTED_USB_DEVICES 4 +#define NUM_SUPPORTED_USB_DEVICES 5 static int supported_usb_devices[NUM_SUPPORTED_USB_DEVICES][3] = { /* vendor, product, num_buttons */ + { 0x03f0, 0x1205, 5 }, /* HP Scanjet 4500 */ { 0x03f0, 0x1305, 5 }, /* HP Scanjet 4570 */ { 0x03f0, 0x1305, 5 }, /* HP Scanjet 5550 */ { 0x03f0, 0x1705, 5 }, /* HP Scanjet 5590 */ @@ -40,6 +41,7 @@ static char* usb_device_descriptions[NUM_SUPPORTED_USB_DEVICES][2] = { + { "Hewlett-Packard", "ScanJet 4500" }, { "Hewlett-Packard", "ScanJet 4570" }, { "Hewlett-Packard", "ScanJet 5550" }, { "Hewlett-Packard", "Scanjet 5590" }, debian/patches/snapscan-s1500.patch0000644000000000000000000000677712246443264014242 0ustar diff -u -ur scanbuttond-0.2.3.cvs20090713/backends/snapscan.c scanbuttond-0.2.3.cvs20090713.nas/backends/snapscan.c --- scanbuttond-0.2.3.cvs20090713/backends/snapscan.c 2007-02-11 18:26:45.000000000 -0600 +++ scanbuttond-0.2.3.cvs20090713.nas/backends/snapscan.c 2011-02-20 16:53:17.374669705 -0600 @@ -29,13 +29,14 @@ static char* backend_name = "Snapscan USB"; -#define NUM_SUPPORTED_USB_DEVICES 4 +#define NUM_SUPPORTED_USB_DEVICES 5 static int supported_usb_devices[NUM_SUPPORTED_USB_DEVICES][3] = { { 0x04b8, 0x0121, 4 }, // Epson Perfection 2480 { 0x04b8, 0x011f, 4 }, // Epson Perfection 1670 { 0x04b8, 0x0122, 4 }, // Epson Perfection 3490 - { 0x04b8, 0x0120, 4 } // Epson Perfection 1270 + { 0x04b8, 0x0120, 4 }, // Epson Perfection 1270 + { 0x04c5, 0x11a2, 1 }, }; // TODO: check if this backend really works on the Epson 2580 too... @@ -43,7 +44,8 @@ { "Epson", "Perfection 2480 / 2580" }, { "Epson", "Perfection 1670" }, { "Epson", "Perfection 3490 / 3590" }, - { "Epson", "Perfection 1270" } + { "Epson", "Perfection 1270" }, + { "Fujitsu", "ScanSnap S1500" }, }; @@ -227,7 +229,16 @@ } } - +static unsigned char CMD[] = { + 0x43, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xc2, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0a, + 0x00, 0x00, 0x00, + }; int scanbtnd_get_button(scanner_t* scanner) { @@ -235,59 +246,33 @@ int num_bytes; int button = 0; - bytes[0] = 0x03; - bytes[1] = 0x00; - bytes[2] = 0x00; - bytes[3] = 0x00; - bytes[4] = 0x14; - bytes[5] = 0x00; - if (!scanner->is_open) return -EINVAL; - num_bytes = snapscan_write(scanner, (void*)bytes, 6); - if (num_bytes != 6) { + num_bytes = snapscan_write(scanner, (void*)CMD, sizeof CMD); + if (num_bytes != (sizeof CMD)) { syslog(LOG_WARNING, "snapscan-backend: communication error: " - "write length:%d (expected:%d)", num_bytes, 6); + "write length:%d (expected:%d)", num_bytes, sizeof CMD); snapscan_flush(scanner); return 0; } - num_bytes = snapscan_read(scanner, (void*)bytes, 8); - if (num_bytes != 8 || bytes[0] != 0xF9) { + num_bytes = snapscan_read(scanner, (void*)bytes, 10); + if (num_bytes != 10) { syslog(LOG_WARNING, "snapscan-backend: communication error: " - "read length:%d (expected:%d), " - "byte[0]:%x (expected:%x)", - num_bytes, 8, bytes[0], 0xF9); + "read length:%d (expected:%d)", + num_bytes, sizeof CMD); snapscan_flush(scanner); return 0; } - - num_bytes = snapscan_read(scanner, (void*)bytes, 20); - if (num_bytes != 20 || bytes[0] != 0xF0) { - syslog(LOG_WARNING, "snapscan-backend: communication error: " - "read length:%d (expected:%d), " - "byte[0]:%x (expected:%x)", - num_bytes, 20, bytes[0], 0xF0); - snapscan_flush(scanner); - return 0; - } - if (bytes[2] == 0x06) { - switch (bytes[18] & 0xF0) { - case 0x10: button = 1; break; - case 0x20: button = 2; break; - case 0x40: button = 3; break; - case 0x80: button = 4; break; - default: button = 0; break; - } + if (bytes[4] == 0x01) { + button = 1; } - - num_bytes = snapscan_read(scanner, (void*)bytes, 8); - if (num_bytes != 8 || bytes[0] != 0xFB) { + num_bytes = snapscan_read(scanner, (void*)bytes, 13); + if (num_bytes != 13) { syslog(LOG_WARNING, "snapscan-backend: communication error: " - "read length:%d (expected:%d), " - "byte[0]:%x (expected:%x)", - num_bytes, 8, bytes[0], 0xFB); + "read length:%d (expected:%d)", + num_bytes, 13); snapscan_flush(scanner); return 0; } debian/patches/path-segfault.patch0000644000000000000000000000234112246443264014411 0ustar Index: scanbuttond/scanbuttond.c =================================================================== --- scanbuttond.orig/scanbuttond.c 2010-05-23 17:07:43.000000000 +0200 +++ scanbuttond/scanbuttond.c 2010-05-23 17:07:44.000000000 +0200 @@ -16,6 +16,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// Modified by Milan Zamazal on 2008-06-06: +// Patch by Thomas Viehweger -- don't segfault when +// PATH is not set. + #include #include #include @@ -276,13 +280,23 @@ // setup the environment char* oldpath = getenv("PATH"); + if (oldpath == NULL) { + oldpath = ""; + } char* dir = dirname(argv[0]); path = (char*)malloc(strlen(oldpath) + strlen(dir) + 1); - strcpy(path, oldpath); - strcat(path, ":"); - strcat(path, dir); - setenv("PATH", path, 1); - free(path); + if (path) { + if (strlen(oldpath)) { + strcpy(path, oldpath); + strcat(path, ":"); + } + else { + path[0] = 0; + } + strcat(path, dir); + setenv("PATH", path, 1); + free(path); + } syslog(LOG_DEBUG, "running scanner initialization script..."); execute_and_wait(initscanner_script); debian/scanbuttond.init0000755000000000000000000000337212246443264012416 0ustar #! /bin/sh # ### BEGIN INIT INFO # Provides: scanbuttond # Required-Start: $syslog $local_fs $remote_fs # Required-Stop: $syslog $local_fs $remote_fs # Should-Start: dbus avahi # Should-Stop: dbus avahi # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Scanner buttons events daemon # Description: scanbuttond associates actions to scanner # buttons ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/scanbuttond NAME=scanbuttond DESC="Scanner buttons events daemon" test -x $DAEMON || exit 0 RUN=no RUN_AS_USER=saned QUIET_LOG=1 # Include scanbuttond defaults if available if [ -f /etc/default/scanbuttond ] ; then . /etc/default/scanbuttond fi if [ "x$RUN" != "xyes" ] ; then echo "$NAME disabled; edit /etc/default/scanbuttond" exit 0 fi DAEMON_OPTS="" if [ "${QUIET_LOG}" = 1 ] then DAEMON_OPTS="${DAEMON_OPTS} --quiet" fi set -e case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --start --quiet \ --chuid $RUN_AS_USER --exec $DAEMON -- $DAEMON_OPTS echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --oknodo --quiet \ --exec $DAEMON echo "$NAME." ;; force-reload) # check whether $DAEMON is running. If so, restart start-stop-daemon --stop --test --quiet \ --exec $DAEMON -- $DAEMON_OPTS \ && $0 restart \ || exit 0 ;; restart) echo -n "Restarting $DESC: " start-stop-daemon --stop --oknodo --quiet \ --exec $DAEMON sleep 1 start-stop-daemon --start --quiet \ --chuid $RUN_AS_USER --exec $DAEMON -- $DAEMON_OPTS echo "$NAME." ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0 debian/control0000644000000000000000000000076112246443264010604 0ustar Source: scanbuttond Section: misc Priority: extra Maintainer: Debian QA Group Build-Depends: debhelper (>= 7.0.0), libusb-dev, libtool, autoconf, automake Standards-Version: 3.9.3 Package: scanbuttond Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libsane Recommends: sane-utils Suggests: lockfile-progs Description: Scanner button daemon It allows you to invoke actions such as shell scripts whenever one of the scanner front panel buttons is pressed. debian/copyright0000644000000000000000000000216112246443264011130 0ustar This package was debianized by Milan Zamazal on Tue, 21 Feb 2006 09:19:57 +0100. It was downloaded from http://scanbuttond.sourceforge.net . Copyright Holder: Copyright (C) 2004-2006 by Bernhard Stiftner Debian changes to upstream sources: 06/2008: Patch by Thomas Viehweger fixing segfault when PATH is not set. 08/2006: Patch by Andrew Barr adding new --quiet command line option added. License: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. On Debian systems, you can find the GNU General Public License in the file /usr/share/common-licenses/GPL. debian/changelog0000644000000000000000000001510612246443264011052 0ustar scanbuttond (0.2.3.cvs20090713-16) unstable; urgency=low * Orphaned. -- Milan Zamazal Sat, 30 Nov 2013 21:11:22 +0100 scanbuttond (0.2.3.cvs20090713-15) unstable; urgency=low * Call autoreconf with -fi; closes: #728638. -- Milan Zamazal Tue, 05 Nov 2013 20:18:38 +0100 scanbuttond (0.2.3.cvs20090713-14) experimental; urgency=low * Support for Fujitsu fi-5220C; thanks to Bernhard Marx; closes: #704276. * Fix of array sizes in fujitsu.c. * Upload to experimental because Debian is frozen. -- Milan Zamazal Sat, 06 Apr 2013 18:58:15 +0200 scanbuttond (0.2.3.cvs20090713-13) experimental; urgency=low * Support for different actions of Fujitsu fi-6130 panel; thanks to jan.bofh@gmail.com. * Upload to experimental because Debian is frozen. -- Milan Zamazal Sat, 19 Jan 2013 20:02:55 +0100 scanbuttond (0.2.3.cvs20090713-12) experimental; urgency=low * Support for Fujitsu fi-6130 and fi-6130Z; thanks to Andreas Jochens; closes: #696392. * Upload to experimental because Debian is frozen. -- Milan Zamazal Fri, 21 Dec 2012 20:15:01 +0100 scanbuttond (0.2.3.cvs20090713-11) experimental; urgency=low * Support for Xerox Travel Scanner; thanks to Rodolphe Pelloux-Prayer; closes: #694165. * Suggest lockfile-progs; closes: #694166. * Standards 3.9.3 (no real change). * Upload to experimental because Debian is frozen. -- Milan Zamazal Tue, 27 Nov 2012 21:32:02 +0100 scanbuttond (0.2.3.cvs20090713-10) experimental; urgency=low * Upload to experimental because Debian is frozen. * Fujitsu fi-5110EOX support added; thanks to Nicholas Romero. -- Milan Zamazal Wed, 07 Nov 2012 21:01:27 +0100 scanbuttond (0.2.3.cvs20090713-9) experimental; urgency=low * Upload to experimental because Debian is frozen. * New Fujitsu ScanSnap patch added; thanks to R. M. Thomas . -- Milan Zamazal Sat, 29 Sep 2012 18:50:24 +0200 scanbuttond (0.2.3.cvs20090713-8) unstable; urgency=low * Revert configure changes on cleanup in order to make dpkg 1.16.1 happy; closes: #643272. -- Milan Zamazal Wed, 28 Sep 2011 17:22:18 +0200 scanbuttond (0.2.3.cvs20090713-7) unstable; urgency=low * Disable snapscan-s1500.patch -- it breaks scanbuttond at least with my Epson Perfection 2480. -- Milan Zamazal Tue, 30 Aug 2011 21:45:43 +0200 scanbuttond (0.2.3.cvs20090713-6) unstable; urgency=low * HP ScanJet 4500 support added; closes: #635725. * *.la files removed. * Missing build-* targets added to debian/rules. * Standards 3.9.2 (no real change). -- Milan Zamazal Sat, 06 Aug 2011 09:57:45 +0200 scanbuttond (0.2.3.cvs20090713-5) unstable; urgency=low * Lock file handling and GNOME examples added to buttonpressed.sh script; thanks to Lutz Müller ; closes: #624482. -- Milan Zamazal Sat, 07 May 2011 21:37:07 +0200 scanbuttond (0.2.3.cvs20090713-4) unstable; urgency=low * snapscan-s1500.patch by Neil Schemenauer added; closes: #614312. -- Milan Zamazal Tue, 22 Feb 2011 21:53:06 +0100 scanbuttond (0.2.3.cvs20090713-3) experimental; urgency=low * Upload to experimental because Debian is frozen. * perfection1250.patch added from SourceForge. * Standards 3.9.1 (no real change). -- Milan Zamazal Thu, 13 Jan 2011 22:14:29 +0100 scanbuttond (0.2.3.cvs20090713-2) unstable; urgency=low * Switch to dpkg-source 3.0 (quilt) format. * Move Debian patches to quilt. * Add $remote_fs to Required-Start/Stop init.d dependencies. * Standards 3.8.4 (no real change). -- Milan Zamazal Sun, 23 May 2010 16:27:29 +0200 scanbuttond (0.2.3.cvs20090713-1) unstable; urgency=low * New upstream snapshot. * Updated to debhelper 7. * Standards 3.8.2 (no real change). -- Milan Zamazal Sun, 19 Jul 2009 21:25:59 +0200 scanbuttond (0.2.3-10) unstable; urgency=low * Bashism in the init.d script fixed; closes: #530183. -- Milan Zamazal Wed, 27 May 2009 09:14:24 +0200 scanbuttond (0.2.3-9) unstable; urgency=low * Upload to unstable. -- Milan Zamazal Sat, 07 Mar 2009 22:46:49 +0100 scanbuttond (0.2.3-8) experimental; urgency=low * Provide init script for optional startup; thanks to Tuomas Noraef ; closes: #503259. * DEB_BUILD_OPTIONS setup updated as described in the current policy. * Standards 3.8.0. * Upload to experimental because lenny is frozen. -- Milan Zamazal Mon, 03 Nov 2008 08:43:36 +0100 scanbuttond (0.2.3-7) unstable; urgency=low * Patch to avoid segfault when PATH is not set applied; thanks to Thomas Viehweger ; closes: #484361. * Standards 3.7.3 (no real change). * config.{sub,guess} updated. * FSF address removed from debian/copyright. * "Copyright (C)" added to debian/copyright. -- Milan Zamazal Fri, 06 Jun 2008 12:43:57 +0200 scanbuttond (0.2.3-6) unstable; urgency=low * Warning about security implications related to simple uncommenting example scripts; CVE-2007-6131; closes: #453239. -- Milan Zamazal Sun, 2 Dec 2007 15:54:10 +0100 scanbuttond (0.2.3-5) unstable; urgency=low * Support for Silitek ScanJet 4300c added, thanks to Daniel van Eeden ; closes: #409071. * debian/rules: Copy config.* files in configure-stamp instead of clean. * debian/rules: In clean, depend on configure-stamp and don't ignore `make distclean' errors. -- Milan Zamazal Thu, 23 Aug 2007 01:57:40 +0200 scanbuttond (0.2.3-4) unstable; urgency=low * Patch by Andrew Barr adding new `--quiet' command line option applied; closes: #384400. -- Milan Zamazal Sat, 26 Aug 2006 20:15:13 +0200 scanbuttond (0.2.3-3) unstable; urgency=low * Another example of a button-press action, suggested by Francesco Potorti`, added to the buttonpressed.sh script; closes: #370428. * Standards 3.7.2 (no real change). -- Milan Zamazal Thu, 15 Jun 2006 20:28:03 +0200 scanbuttond (0.2.3-2) unstable; urgency=low * debian/rules: configure invocation improvements. * debian/rules: Call `make distclean' instead of `make clean'. -- Milan Zamazal Mon, 27 Feb 2006 10:58:26 +0100 scanbuttond (0.2.3-1) unstable; urgency=low * Initial release; closes: #352504. -- Milan Zamazal Tue, 21 Feb 2006 09:19:57 +0100