This is the port of scanbuttond, an utility to monitor the various buttons

found on many modern scanners which are intended to trigger certain actions
like copying, faxing or mailing the scanned document.
This daemon queries the scanner button state several times per second via
libusb and if it detects that a button is pressed it runs a shell script with
the button number as an argument.

The supported scanner backends currently are: epson, niash, plustek, snapscan

Author:	Bernhard Stiftner <root84@users.sourceforge.net>
WWW:	http://scanbuttond.sourceforge.net/

PR:		ports/95386
Submitted by:	Daniel Thiele
Approvel by:	lawrance (mentor, implicit)
This commit is contained in:
Ion-Mihai Tetcu
2006-06-06 18:06:50 +00:00
parent 2dd0d11c99
commit d8502e1999
9 changed files with 176 additions and 0 deletions

View File

@@ -498,6 +498,7 @@
SUBDIR += sb16config
SUBDIR += sbniconfig
SUBDIR += scan_ffs
SUBDIR += scanbuttond
SUBDIR += screen
SUBDIR += sdd
SUBDIR += sec

View File

@@ -0,0 +1,39 @@
# New ports collection makefile for: scanbuttond
# Date created: 31 March 2006
# Whom: Daniel Thiele
#
# $FreeBSD$
#
PORTNAME= scanbuttond
PORTVERSION= 0.2.3
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
MAINTAINER= dthiele@gmx.net
COMMENT= A daemon to monitor and configure modern scanner's buttons
LIB_DEPENDS= usb-0.1.8:${PORTSDIR}/devel/libusb
GNU_CONFIGURE= yes
CONFIGURE_ENV= CFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"
CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
INSTALLS_SHLIB= yes
SUB_FILES+= pkg-message
.include <bsd.port.pre.mk>
.if ${OSVERSION} < 500000
BROKEN= does not build
.endif
pre-configure:
@${FIND} ${WRKSRC} -name Makefile.in | ${XARGS} \
${REINPLACE_CMD} -e 's|-ldl||g'
post-install:
@${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>

View File

@@ -0,0 +1,3 @@
MD5 (scanbuttond-0.2.3.tar.gz) = 548e6451b398bd95d14f008b4d39ca79
SHA256 (scanbuttond-0.2.3.tar.gz) = 93b060a363fef069548a49cb151da53ac6071dc0569f9a07d68751a28dffebee
SIZE (scanbuttond-0.2.3.tar.gz) = 333743

View File

@@ -0,0 +1,11 @@
--- lib/loader.c.orig Wed Feb 15 18:00:12 2006
+++ lib/loader.c Fri Mar 31 10:35:41 2006
@@ -27,7 +27,7 @@
backend_t* load_backend(const char* filename)
{
- char* error;
+ const char* error;
void* dll_handle = dlopen(filename, RTLD_NOW|RTLD_LOCAL);
if (!dll_handle) {
syslog(LOG_ERR, "loader: failed to load \"%s\". Error message: \"%s\"",

View File

@@ -0,0 +1,35 @@
--- scanbuttond.c.orig Fri Feb 17 00:23:53 2006
+++ scanbuttond.c Thu Apr 6 00:52:29 2006
@@ -223,8 +223,15 @@
exit(EXIT_FAILURE);
}
+ openlog(NULL, 0, LOG_DAEMON);
+
// daemonize
if (daemonize) {
+ if (daemon(0, 0) != 0) {
+ syslog(LOG_ERR, "daemon() failed.");
+ }
+ }
+/*
pid = fork();
if (pid < 0) {
printf("Can't fork!\n");
@@ -259,6 +266,7 @@
close(STDOUT_FILENO);
close(STDERR_FILENO);
}
+*/
// setup the environment
char* oldpath = getenv("PATH");
@@ -292,7 +300,7 @@
signal(SIGHUP, &sighandler);
signal(SIGINT, &sighandler);
signal(SIGSEGV, &sighandler);
- signal(SIGCLD, SIG_IGN);
+ signal(SIGCHLD, SIG_IGN);
syslog(LOG_INFO, "scanbuttond started");

View File

@@ -0,0 +1,9 @@
--- scripts/initscanner.sh.orig Sat Jun 4 12:37:24 2005
+++ scripts/initscanner.sh Fri Mar 31 01:46:29 2006
@@ -9,5 +9,5 @@
# Example:
# scanimage -n
# or
-# sane-find-scanners
+# sane-find-scanner > /dev/null 2> /dev/null

View File

@@ -0,0 +1,37 @@
-------------------------------------------------------------------------------
scanbuttond has been installed, but is not quite ready to be used yet.
To make scanbuttond actually do something you have to edit
%%PREFIX%%/etc/scanbuttond/buttonpressed.sh and change it to your needs.
If you are having trouble getting your scanner detected try uncommenting one
of the following lines in %%PREFIX%%/etc/scanbuttond/initscanner.sh:
scanimage -n
or
sane-find-scanner > /dev/null 2> /dev/null
If your scanner is connected via a hot-plug capable technology (e.g. USB)
you can conveniently enable scanbuttond every time you attach you scanner by
using devd. In order to do so you may add the following lines to your
/etc/devd.conf and restart devd after you are done.
(Make sure to replace device-name, vendor, product and back-end name to
something that matches your environment)
attach 20 {
device-name "ugen[0-9]+";
match "vendor" "0x04a9";
match "product" "0x220e";
action "%%PREFIX%%/bin/scanbuttond \
-s %%PREFIX%%/etc/scanbuttond/buttonpressed.sh \
-S %%PREFIX%%/etc/scanbuttond/initscanner.sh \
-b %%PREFIX%%/lib/libscanbtnd-backend_plustek.so";
};
detach 20 {
device-name "ugen[0-9]+";
match "vendor" "0x04a9";
match "product" "0x220e";
action "/usr/bin/killall scanbuttond";
};
-------------------------------------------------------------------------------

View File

@@ -0,0 +1,12 @@
This is the port of scanbuttond, an utility to monitor the various buttons
found on many modern scanners which are intended to trigger certain actions
like copying, faxing or mailing the scanned document.
This daemon queries the scanner button state several times per second via
libusb and if it detects that a button is pressed it runs a shell script with
the button number as an argument.
The supported scanner backends currently are: epson, niash, plustek, snapscan
Author: Bernhard Stiftner <root84@users.sourceforge.net>
WWW: http://scanbuttond.sourceforge.net/

View File

@@ -0,0 +1,29 @@
bin/scanbuttond
etc/scanbuttond/buttonpressed.sh
etc/scanbuttond/initscanner.sh
etc/scanbuttond/meta.conf
lib/libscanbtnd-backend_epson.la
lib/libscanbtnd-backend_epson.so
lib/libscanbtnd-backend_epson.so.1
lib/libscanbtnd-backend_meta.la
lib/libscanbtnd-backend_meta.so
lib/libscanbtnd-backend_meta.so.1
lib/libscanbtnd-backend_mustek.la
lib/libscanbtnd-backend_mustek.so
lib/libscanbtnd-backend_mustek.so.1
lib/libscanbtnd-backend_niash.la
lib/libscanbtnd-backend_niash.so
lib/libscanbtnd-backend_niash.so.1
lib/libscanbtnd-backend_plustek.la
lib/libscanbtnd-backend_plustek.so
lib/libscanbtnd-backend_plustek.so.1
lib/libscanbtnd-backend_plustek_umax.la
lib/libscanbtnd-backend_plustek_umax.so
lib/libscanbtnd-backend_plustek_umax.so.1
lib/libscanbtnd-backend_snapscan.la
lib/libscanbtnd-backend_snapscan.so
lib/libscanbtnd-backend_snapscan.so.1
lib/libscanbtnd-interface_usb.la
lib/libscanbtnd-interface_usb.so
lib/libscanbtnd-interface_usb.so.1
@dirrm etc/scanbuttond