Commit 0fe94fc2 authored by Igor Pečovnik's avatar Igor Pečovnik
Browse files

patched source

parent f1b7b622
// plustek_umax.c: Plustek device backend for UMAX models
// This file is part of scanbuttond.
// Copyleft )c( 2005 by Hans Verkuil
// Copyleft )c( 2005-2006 by Bernhard Stiftner
//
// 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <syslog.h>
#include "scanbuttond/scanbuttond.h"
#include "scanbuttond/libusbi.h"
#include "plustek_umax.h"
static char* backend_name = "Plustek USB for UMAX";
#define NUM_SUPPORTED_USB_DEVICES 1
static int supported_usb_devices[NUM_SUPPORTED_USB_DEVICES][3] = {
// vendor, product, num_buttons
{ 0x1606, 0x0060, 4 } // UMAX Astra 3400 (3450?)
};
static char* usb_device_descriptions[NUM_SUPPORTED_USB_DEVICES][2] = {
{ "UMAX", "Astra 3400/3450" }
};
libusb_handle_t* libusb_handle;
scanner_t* plustek_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 plustek_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 plustek_attach_libusb_scanner(libusb_device_t* device)
{
const char* descriptor_prefix = "plustek:libusb:";
int index = plustek_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 = plustek_scanners;
plustek_scanners = scanner;
}
void plustek_detach_scanners(void)
{
scanner_t* next;
while (plustek_scanners != NULL) {
next = plustek_scanners->next;
free(plustek_scanners->sane_device);
free(plustek_scanners);
plustek_scanners = next;
}
}
void plustek_scan_devices(libusb_device_t* devices)
{
int index;
libusb_device_t* device = devices;
while (device != NULL) {
index = plustek_match_libusb_scanner(device);
if (index >= 0)
plustek_attach_libusb_scanner(device);
device = device->next;
}
}
int plustek_init_libusb(void)
{
libusb_device_t* devices;
libusb_handle = libusb_init();
devices = libusb_get_devices(libusb_handle);
plustek_scan_devices(devices);
return 0;
}
const char* scanbtnd_get_backend_name(void)
{
return backend_name;
}
int scanbtnd_init(void)
{
plustek_scanners = NULL;
syslog(LOG_INFO, "plustek-umax-backend: init");
return plustek_init_libusb();
}
int scanbtnd_rescan(void)
{
libusb_device_t* devices;
plustek_detach_scanners();
plustek_scanners = NULL;
libusb_rescan(libusb_handle);
devices = libusb_get_devices(libusb_handle);
plustek_scan_devices(devices);
return 0;
}
const scanner_t* scanbtnd_get_supported_devices(void)
{
return plustek_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 plustek_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 plustek_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 plustek_flush(scanner_t* scanner)
{
switch (scanner->connection) {
case CONNECTION_LIBUSB:
libusb_flush((libusb_device_t*)scanner->internal_dev_ptr);
break;
}
}
int scanbtnd_get_button(scanner_t* scanner)
{
unsigned char bytes[255];
int num_bytes;
int button = 0;
bytes[0] = 1;
bytes[1] = 2;
bytes[2] = 0;
bytes[3] = 1;
if (!scanner->is_open)
return -EINVAL;
num_bytes = plustek_write(scanner, (void*)bytes, 4);
if (num_bytes != 4) {
plustek_flush(scanner);
return 0;
}
num_bytes = plustek_read(scanner, (void*)bytes, 1);
if (num_bytes != 1) {
plustek_flush(scanner);
return 0;
}
switch (scanner->num_buttons) {
case 1: // not tested
if ((bytes[0] & 0x04) != 0) button = 1;
break;
case 2: // not tested
if ((bytes[0] & 0x08) != 0) button = 1;
if ((bytes[0] & 0x04) != 0) button = 2;
break;
case 3: // not tested
if ((bytes[0] & 0x10) != 0) button = 1;
if ((bytes[0] & 0x08) != 0) button = 2;
if ((bytes[0] & 0x04) != 0) button = 3;
break;
case 4: // only tested on UMAX Astra 3400
if ((bytes[0] & 0x04) != 0) button = 1;
if ((bytes[0] & 0x08) != 0) button = 2;
if ((bytes[0] & 0x40) != 0) button = 3;
if ((bytes[0] & 0x20) != 0) button = 4;
break;
}
return button;
}
const char* scanbtnd_get_sane_device_descriptor(scanner_t* scanner)
{
return scanner->sane_device;
}
int scanbtnd_exit(void)
{
syslog(LOG_INFO, "plustek-umax-backend: exit");
plustek_detach_scanners();
libusb_exit(libusb_handle);
return 0;
}
// plustek_umax.h: Plustek device backend for UMAX models
// This file is part of scanbuttond.
// Copyleft )c( 2005 by Hans Verkuil
// Copyleft )c( 2005 by Bernhard Stiftner
//
// 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 __PLUSTEK_UMAX_H_INCLUDED
#define __PLUSTEK_UMAX_H_INCLUDED
#include "scanbuttond/backend.h"
#endif
// snapscan.c: Snapscan 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <syslog.h>
#include "scanbuttond/scanbuttond.h"
#include "scanbuttond/libusbi.h"
#include "snapscan.h"
static char* backend_name = "Snapscan USB";
#define NUM_SUPPORTED_USB_DEVICES 3
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
};
// TODO: check if this backend really works on the Epson 2580 too...
static char* usb_device_descriptions[NUM_SUPPORTED_USB_DEVICES][2] = {
{ "Epson", "Perfection 2480 / 2580" },
{ "Epson", "Perfection 1670" },
{ "Epson", "Perfection 3490" }
};
libusb_handle_t* libusb_handle;
scanner_t* snapscan_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 snapscan_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 snapscan_attach_libusb_scanner(libusb_device_t* device)
{
const char* descriptor_prefix = "snapscan:libusb:";
int index = snapscan_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 = snapscan_scanners;
snapscan_scanners = scanner;
}
void snapscan_detach_scanners(void)
{
scanner_t* next;
while (snapscan_scanners != NULL) {
next = snapscan_scanners->next;
free(snapscan_scanners->sane_device);
free(snapscan_scanners);
snapscan_scanners = next;
}
}
void snapscan_scan_devices(libusb_device_t* devices)
{
int index;
libusb_device_t* device = devices;
while (device != NULL) {
index = snapscan_match_libusb_scanner(device);
if (index >= 0)
snapscan_attach_libusb_scanner(device);
device = device->next;
}
}
int snapscan_init_libusb(void)
{
libusb_device_t* devices;
libusb_handle = libusb_init();
devices = libusb_get_devices(libusb_handle);
snapscan_scan_devices(devices);
return 0;
}
const char* scanbtnd_get_backend_name(void)
{
return backend_name;
}
int scanbtnd_init(void)
{
snapscan_scanners = NULL;
syslog(LOG_INFO, "snapscan-backend: init");
return snapscan_init_libusb();
}
int scanbtnd_rescan(void)
{
libusb_device_t* devices;
snapscan_detach_scanners();
snapscan_scanners = NULL;
libusb_rescan(libusb_handle);
devices = libusb_get_devices(libusb_handle);
snapscan_scan_devices(devices);
return 0;
}
const scanner_t* scanbtnd_get_supported_devices(void)
{
return snapscan_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 snapscan_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 snapscan_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 snapscan_flush(scanner_t* scanner)
{
switch (scanner->connection) {
case CONNECTION_LIBUSB:
libusb_flush((libusb_device_t*)scanner->internal_dev_ptr);
break;
}
}
int scanbtnd_get_button(scanner_t* scanner)
{
unsigned char bytes[255];
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) {
snapscan_flush(scanner);
return 0;
}
num_bytes = snapscan_read(scanner, (void*)bytes, 8);
if (num_bytes != 8 || bytes[0] != 0xF9) {
snapscan_flush(scanner);
return 0;
}
num_bytes = snapscan_read(scanner, (void*)bytes, 20);
if (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;
}
}
num_bytes = snapscan_read(scanner, (void*)bytes, 8);
if (num_bytes != 8 || bytes[0] != 0xFB) {
snapscan_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, "snapscan-backend: exit");
snapscan_detach_scanners();
libusb_exit(libusb_handle);
return 0;
}
// snapscan.h: Snapscan 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 __SNAPSCAN_H_INCLUDED
#define __SNAPSCAN_H_INCLUDED
#include "scanbuttond/backend.h"
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
AC_INIT([scanbuttond], [0.2.3], [root84@users.soureforge.net])
AC_CONFIG_HEADERS([include/scanbuttond/config.h])
AM_INIT_AUTOMAKE
AC_DISABLE_STATIC
AC_LANG_C
AC_PROG_CC
AC_PROG_LIBTOOL
AC_CHECK_HEADERS(errno.h string.h syslog.h unistd.h dlfcn.h usb.h)
CFLAGS="${CFLAGS} -DCFG_DIR=\$(pkgsysconfdir) -DLIB_DIR=\$(libdir)"
AC_OUTPUT(Makefile contrib/Makefile interface/Makefile backends/Makefile scripts/Makefile)
EXTRA_DIST = initscript.gentoo
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = contrib
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/scanbuttond/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
EXTRA_DIST = initscript.gentoo
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu contrib/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
#!/sbin/runscript
# scanbuttond init script for Gentoo
# copy it to /etc/init.d/scanbuttond
#
# Copyright 2005 by Bernhard Stiftner
# Distributed under the terms of the GNU General Public License v2
depend() {
need hotplug
}
start() {
ebegin "Starting scanner button daemon"
start-stop-daemon --chuid scanner:scanner --start --quiet --exec /usr/local/bin/scanbuttond
eend $?
}
stop() {
ebegin "Stopping scanner button daemon"
start-stop-daemon --stop --quiet --exec /usr/local/bin/scanbuttond
eend $?
}
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2005-07-09.11
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mecanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
// backend.h: specification of the mandatory backend functions
// This file is part of scanbuttond.
// Copyleft )c( 2004-2005 by Bernhard Stiftner
//
// 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 __BACKEND_H_INCLUDED
#define __BACKEND_H_INCLUDED
#include "scanbuttond/scanbuttond.h"
/**
* \file backend.h
* \brief Backend function specification.
*
* This file specifies which functions a scanbuttond backend has to
* provide and how it is supposed to interact with with the rest
* of the system.
*/
/**
* Gets the name of this backend.
* \return the backend name
*/
const char* scanbtnd_get_backend_name(void);
/**
* Initializes the backend.
* This function makes the backend ready to operate and searches for supported
* devices (see scanbtnd_get_supported_devices()).
* \return 0 if successful, <0 otherwise
*/
int scanbtnd_init(void);
/**
* Refreshes the list of supported devices.
* After this function has been called, scanbtnd_get_supported_devices()
* should only return devices which are currently present on this system.
* \return 0 if successful, <0 otherwise
*/
int scanbtnd_rescan(void);
/**
* Returns a list of devices which are currently driven by this backend.
* The devices are stored in a single-linked list.
* Note that the device list does not automagically refresh after pluggin in or
* unplugging a device. You have to explicitly call scanbtnd_rescan() to do
* that.
* \return a linked list of supported scanner devices
*/
const scanner_t* scanbtnd_get_supported_devices(void);
/**
* Opens the given scanner device.
* This function must be called before using scanbtnd_get_button().
* After calling this function, it is usually not possible for another process
* to access the scanner until scanbtnd_close() is called.
* \param scanner the scanner device to be opened
* \return 0 if successful, <0 otherwise
* \retval -ENODEV if the device is no longer present (or the device list has to
* be refreshed). In this case, call scanbtnd_rescan() and try again.
* \retval -EBUSY if the device is currently used by another process.
* \retval -EINVAL if the device is already open
* \retval -ENOSYS if there is no connection method to communicate with the device
*/
int scanbtnd_open(scanner_t* scanner);
/**
* Closes the given scanner device.
* This function must be called when you've finished querying the scanner button
* status using scanbtnd_get_button().
* After calling this function, other processes may access the device again.
* \param scanner the scanner device to be closed
* \return 0 if successful, <0 otherwise
* \retval -EINVAL if the device is already closed
* \retval -ENOSYS if there is no connection method to communicate with the device
*/
int scanbtnd_close(scanner_t* scanner);
/**
* Queries the scanner's button status.
* \param scanner the scanner device
* \return the number of the currently pressed button, 0 if no button is currently
* pressed, or <0 if there was an error.
* \retval -EINVAL if the scanner device has not been opened before
*/
int scanbtnd_get_button(scanner_t* scanner);
/**
* Gets the SANE device name of this scanner.
* The returned string should look like "epson:libusb:003:017".
* \param scanner the scanner device
* \return the SANE device name, or NULL if the SANE device name cannot be determined.
*/
const char* scanbtnd_get_sane_device_descriptor(scanner_t* scanner);
/**
* Shuts down this backend.
* Cleans up some internal data structures and frees some memory.
* \return 0 if successful, <0 otherwise
*/
int scanbtnd_exit(void);
#endif
// common.h: useful stuff
// This file is part of scanbuttond.
// Copyleft )c( 2006 by Bernhard Stiftner
//
// 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 __COMMON_H_INCLUDED
#define __COMMON_H_INCLUDED
#define STRINGIFY1(x) #x
#define STRINGIFY(x) STRINGIFY1(x)
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
lib_LTLIBRARIES = libscanbtnd-interface_usb.la
libscanbtnd_interface_usb_la_SOURCES = libusbi.c ../include/scanbuttond/libusbi.h
libscanbtnd_interface_usb_la_LDFLAGS = -lusb -version-info 1:0:0
INCLUDES = $(all_includes) -I$(top_builddir)/include -I.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment