summaryrefslogtreecommitdiff
path: root/include/sane
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-10-06 14:00:40 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-10-06 14:00:40 +0200
commit6e9c41a892ed0e0da326e0278b3221ce3f5713b8 (patch)
tree2e301d871bbeeb44aa57ff9cc070fcf3be484487 /include/sane
Initial import of sane-backends version 1.0.24-1.2
Diffstat (limited to 'include/sane')
-rw-r--r--include/sane/config.h.in698
-rw-r--r--include/sane/sane.h248
-rw-r--r--include/sane/sanei.h160
-rw-r--r--include/sane/sanei_ab306.h58
-rw-r--r--include/sane/sanei_access.h97
-rw-r--r--include/sane/sanei_auth.h98
-rw-r--r--include/sane/sanei_backend.h179
-rw-r--r--include/sane/sanei_cderror.h132
-rw-r--r--include/sane/sanei_codec_ascii.h62
-rw-r--r--include/sane/sanei_codec_bin.h61
-rw-r--r--include/sane/sanei_config.h175
-rw-r--r--include/sane/sanei_debug.h153
-rw-r--r--include/sane/sanei_jinclude.h91
-rw-r--r--include/sane/sanei_jpeg.h55
-rw-r--r--include/sane/sanei_lm983x.h150
-rw-r--r--include/sane/sanei_magic.h222
-rw-r--r--include/sane/sanei_net.h144
-rw-r--r--include/sane/sanei_pa4s2.h220
-rw-r--r--include/sane/sanei_pio.h55
-rw-r--r--include/sane/sanei_pp.h172
-rw-r--r--include/sane/sanei_pv8630.h96
-rw-r--r--include/sane/sanei_scsi.h329
-rw-r--r--include/sane/sanei_tcp.h37
-rw-r--r--include/sane/sanei_thread.h164
-rw-r--r--include/sane/sanei_udp.h40
-rw-r--r--include/sane/sanei_usb.h525
-rw-r--r--include/sane/sanei_wire.h132
-rw-r--r--include/sane/saneopts.h461
28 files changed, 5014 insertions, 0 deletions
diff --git a/include/sane/config.h.in b/include/sane/config.h.in
new file mode 100644
index 0000000..c62938b
--- /dev/null
+++ b/include/sane/config.h.in
@@ -0,0 +1,698 @@
+/* include/sane/config.h.in. Generated from configure.in by autoheader. */
+
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+#undef CRAY_STACKSEG_END
+
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
+/* Should we disable SCSI generic v3? */
+#undef DISABLE_LINUX_SG_IO
+
+/* Define to 1 if the system supports IPv6 */
+#undef ENABLE_IPV6
+
+/* Define to 1 if device locking should be enabled. */
+#undef ENABLE_LOCKING
+
+/* Define to 1 if struct sockaddr_storage has an ss_family member */
+#undef HAS_SS_FAMILY
+
+/* Define to 1 if struct sockaddr_storage has __ss_family instead of ss_family
+ */
+#undef HAS___SS_FAMILY
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+#undef HAVE_ALLOCA_H
+
+/* Define to 1 if you have the <apollo/scsi.h> header file. */
+#undef HAVE_APOLLO_SCSI_H
+
+/* Define to 1 if you have the <asm/io.h> header file. */
+#undef HAVE_ASM_IO_H
+
+/* Define to 1 if you have the <asm/types.h> header file. */
+#undef HAVE_ASM_TYPES_H
+
+/* Define to 1 if you have the `atexit' function. */
+#undef HAVE_ATEXIT
+
+/* Define to 1 if you have the <be/drivers/USB_scanner.h> header file. */
+#undef HAVE_BE_DRIVERS_USB_SCANNER_H
+
+/* Define to 1 if you have the <be/kernel/OS.h> header file. */
+#undef HAVE_BE_KERNEL_OS_H
+
+/* Define to 1 if you have the <bsd/dev/scsireg.h> header file. */
+#undef HAVE_BSD_DEV_SCSIREG_H
+
+/* Define to 1 if you have the <camlib.h> header file. */
+#undef HAVE_CAMLIB_H
+
+/* Define to 1 if you have the `cfmakeraw' function. */
+#undef HAVE_CFMAKERAW
+
+/* Is /usr/include/cups/cups.h available? */
+#undef HAVE_CUPS
+
+/* Define to 1 if you have the <ddk/ntddscsi.h> header file. */
+#undef HAVE_DDK_NTDDSCSI_H
+
+/* Define to 1 if you have the <dev/ppbus/ppi.h> header file. */
+#undef HAVE_DEV_PPBUS_PPI_H
+
+/* Is /dev/urandom available? */
+#undef HAVE_DEV_URANDOM
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the `dlopen' function. */
+#undef HAVE_DLOPEN
+
+/* Define to 1 if you have the <dl.h> header file. */
+#undef HAVE_DL_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#undef HAVE_GETADDRINFO
+
+/* Define to 1 if you have the `getenv' function. */
+#undef HAVE_GETENV
+
+/* Define to 1 if you have the `getnameinfo' function. */
+#undef HAVE_GETNAMEINFO
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define to 1 if you have the `getopt_long' function. */
+#undef HAVE_GETOPT_LONG
+
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define to 1 if you have the `getpass' function. */
+#undef HAVE_GETPASS
+
+/* Define to 1 if you have the `getuid' function. */
+#undef HAVE_GETUID
+
+/* Define to 1 if you have the `gp_camera_init' function. */
+#undef HAVE_GP_CAMERA_INIT
+
+/* Define to 1 if you have the `gp_port_info_get_path' function. */
+#undef HAVE_GP_PORT_INFO_GET_PATH
+
+/* Define to 1 if you have the `i386_set_ioperm' function. */
+#undef HAVE_I386_SET_IOPERM
+
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+#undef HAVE_IFADDRS_H
+
+/* Define to 1 if you have the `inet_addr' function. */
+#undef HAVE_INET_ADDR
+
+/* Define to 1 if you have the `inet_aton' function. */
+#undef HAVE_INET_ATON
+
+/* Define to 1 if you have the `inet_ntoa' function. */
+#undef HAVE_INET_NTOA
+
+/* Define to 1 if you have the `inet_ntop' function. */
+#undef HAVE_INET_NTOP
+
+/* Define to 1 if you have the `inet_pton' function. */
+#undef HAVE_INET_PTON
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <IOKit/cdb/IOSCSILib.h> header file. */
+#undef HAVE_IOKIT_CDB_IOSCSILIB_H
+
+/* Define to 1 if you have the
+ <IOKit/scsi-commands/SCSICommandOperationCodes.h> header file. */
+#undef HAVE_IOKIT_SCSI_COMMANDS_SCSICOMMANDOPERATIONCODES_H
+
+/* Define to 1 if you have the <IOKit/scsi/SCSICommandOperationCodes.h> header
+ file. */
+#undef HAVE_IOKIT_SCSI_SCSICOMMANDOPERATIONCODES_H
+
+/* Define to 1 if you have the <IOKit/scsi/SCSITaskLib.h> header file. */
+#undef HAVE_IOKIT_SCSI_SCSITASKLIB_H
+
+/* Define to 1 if you have the `ioperm' function. */
+#undef HAVE_IOPERM
+
+/* Define to 1 if you have the `iopl' function. */
+#undef HAVE_IOPL
+
+/* Define to 1 if you have the <io/cam/cam.h> header file. */
+#undef HAVE_IO_CAM_CAM_H
+
+/* Define to 1 if you have the `isfdtype' function. */
+#undef HAVE_ISFDTYPE
+
+/* Define to 1 if you have the <libc.h> header file. */
+#undef HAVE_LIBC_H
+
+/* Define to 1 if you have the `ieee1284' library (-lcam). */
+#undef HAVE_LIBIEEE1284
+
+/* Define to 1 if you have the libjpeg library. */
+#undef HAVE_LIBJPEG
+
+/* Define to 1 if you have the net-snmp library. */
+#undef HAVE_LIBSNMP
+
+/* Define to 1 if you have libusb. */
+#undef HAVE_LIBUSB
+
+/* Define to 1 if you have libusb-1.0. */
+#undef HAVE_LIBUSB_1_0
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the <linux/ppdev.h> header file. */
+#undef HAVE_LINUX_PPDEV_H
+
+/* Define if the long long type is available. */
+#undef HAVE_LONG_LONG
+
+/* Define to 1 if you have the <lusb0_usb.h> header file. */
+#undef HAVE_LUSB0_USB_H
+
+/* Define to 1 if you have the <machine/cpufunc.h> header file. */
+#undef HAVE_MACHINE_CPUFUNC_H
+
+/* Define to 1 if you have the <mach-o/dyld.h> header file. */
+#undef HAVE_MACH_O_DYLD_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `mkdir' function. */
+#undef HAVE_MKDIR
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* Define to 1 if you have the `NSLinkModule' function. */
+#undef HAVE_NSLINKMODULE
+
+/* Define to 1 if you have the <ntddscsi.h> header file. */
+#undef HAVE_NTDDSCSI_H
+
+/* Define to 1 if you have the <os2.h> header file. */
+#undef HAVE_OS2_H
+
+/* Define to 1 if you have the `poll' function. */
+#undef HAVE_POLL
+
+/* Define to 1 if you have the `pthread_cancel' function. */
+#undef HAVE_PTHREAD_CANCEL
+
+/* Define to 1 if you have the `pthread_create' function. */
+#undef HAVE_PTHREAD_CREATE
+
+/* Define to 1 if you have the `pthread_detach' function. */
+#undef HAVE_PTHREAD_DETACH
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#undef HAVE_PTHREAD_H
+
+/* Define to 1 if you have the `pthread_join' function. */
+#undef HAVE_PTHREAD_JOIN
+
+/* Define to 1 if you have the `pthread_kill' function. */
+#undef HAVE_PTHREAD_KILL
+
+/* Define to 1 if you have the `pthread_testcancel' function. */
+#undef HAVE_PTHREAD_TESTCANCEL
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#undef HAVE_PWD_H
+
+/* define if you have the resmgr library */
+#undef HAVE_RESMGR
+
+/* Define to 1 if you have the <scdds.h> header file. */
+#undef HAVE_SCDDS_H
+
+/* Define to 1 if you have the `scsireq_enter' function. */
+#undef HAVE_SCSIREQ_ENTER
+
+/* Define if SCSITaskSGElement is available. */
+#undef HAVE_SCSITASKSGELEMENT
+
+/* Define to 1 if you have the <scsi.h> header file. */
+#undef HAVE_SCSI_H
+
+/* Define to 1 if you have the <scsi/sg.h> header file. */
+#undef HAVE_SCSI_SG_H
+
+/* Define to 1 if you have the `setitimer' function. */
+#undef HAVE_SETITIMER
+
+/* Define if sg_header.target_status is available. */
+#undef HAVE_SG_TARGET_STATUS
+
+/* Define to 1 if you have the `shl_load' function. */
+#undef HAVE_SHL_LOAD
+
+/* Define to 1 if you have the `sigprocmask' function. */
+#undef HAVE_SIGPROCMASK
+
+/* Define to 1 if you have the `sleep' function. */
+#undef HAVE_SLEEP
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strcasestr' function. */
+#undef HAVE_STRCASESTR
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strftime' function. */
+#undef HAVE_STRFTIME
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#undef HAVE_STRNCASECMP
+
+/* Define to 1 if you have the `strndup' function. */
+#undef HAVE_STRNDUP
+
+/* Define to 1 if you have the `strsep' function. */
+#undef HAVE_STRSEP
+
+/* Define to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
+
+/* Define to 1 if you have the `strtod' function. */
+#undef HAVE_STRTOD
+
+/* Define if struct flock is available. */
+#undef HAVE_STRUCT_FLOCK
+
+/* Define to 1 if you have the `syslog' function. */
+#undef HAVE_SYSLOG
+
+/* Is /usr/include/systemd/sd-daemon.h available? */
+#undef HAVE_SYSTEMD
+
+/* Define to 1 if you have the <sys/bitypes.h> header file. */
+#undef HAVE_SYS_BITYPES_H
+
+/* Define to 1 if you have the <sys/dsreq.h> header file. */
+#undef HAVE_SYS_DSREQ_H
+
+/* Define to 1 if you have the <sys/hw.h> header file. */
+#undef HAVE_SYS_HW_H
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define to 1 if you have the <sys/io.h> header file. */
+#undef HAVE_SYS_IO_H
+
+/* Define to 1 if you have the <sys/ipc.h> header file. */
+#undef HAVE_SYS_IPC_H
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/passthrudef.h> header file. */
+#undef HAVE_SYS_PASSTHRUDEF_H
+
+/* Define to 1 if you have the <sys/poll.h> header file. */
+#undef HAVE_SYS_POLL_H
+
+/* Define to 1 if you have the <sys/scanio.h> header file. */
+#undef HAVE_SYS_SCANIO_H
+
+/* Define to 1 if you have the <sys/scsicmd.h> header file. */
+#undef HAVE_SYS_SCSICMD_H
+
+/* Define to 1 if you have the <sys/scsiio.h> header file. */
+#undef HAVE_SYS_SCSIIO_H
+
+/* Define to 1 if you have the <sys/scsi.h> header file. */
+#undef HAVE_SYS_SCSI_H
+
+/* Define to 1 if you have the <sys/scsi/scsi.h> header file. */
+#undef HAVE_SYS_SCSI_SCSI_H
+
+/* Define to 1 if you have the <sys/scsi/sgdefs.h> header file. */
+#undef HAVE_SYS_SCSI_SGDEFS_H
+
+/* Define to 1 if you have the <sys/scsi/targets/scgio.h> header file. */
+#undef HAVE_SYS_SCSI_TARGETS_SCGIO_H
+
+/* Define to 1 if you have the <sys/sdi_comm.h> header file. */
+#undef HAVE_SYS_SDI_COMM_H
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/sem.h> header file. */
+#undef HAVE_SYS_SEM_H
+
+/* Define to 1 if you have the <sys/shm.h> header file. */
+#undef HAVE_SYS_SHM_H
+
+/* Define to 1 if you have the <sys/signal.h> header file. */
+#undef HAVE_SYS_SIGNAL_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the `tcsendbreak' function. */
+#undef HAVE_TCSENDBREAK
+
+/* Define to 1 if you have the <tiffio.h> header file. */
+#undef HAVE_TIFFIO_H
+
+/* Define if union semun is available. */
+#undef HAVE_UNION_SEMUN
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have usbcall.dll. */
+#undef HAVE_USBCALLS
+
+/* Define to 1 if you have the `usleep' function. */
+#undef HAVE_USLEEP
+
+/* Define to 1 if the system has the type `u_char'. */
+#undef HAVE_U_CHAR
+
+/* Define to 1 if the system has the type `u_int'. */
+#undef HAVE_U_INT
+
+/* Define to 1 if the system has the type `u_long'. */
+#undef HAVE_U_LONG
+
+/* Define to 1 if the system has the type `u_short'. */
+#undef HAVE_U_SHORT
+
+/* Define to 1 if you have the `vsyslog' function. */
+#undef HAVE_VSYSLOG
+
+/* Define to 1 if you have the <windows.h> header file. */
+#undef HAVE_WINDOWS_H
+
+/* Define to 1 if you have the <winsock2.h> header file. */
+#undef HAVE_WINSOCK2_H
+
+/* Define to 1 if you have the `_portaccess' function. */
+#undef HAVE__PORTACCESS
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Define to the name of the distribution. */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* SANE DLL revision number */
+#undef SANE_DLL_V_BUILD
+
+/* SANE DLL major number */
+#undef SANE_DLL_V_MAJOR
+
+/* SANE DLL minor number */
+#undef SANE_DLL_V_MINOR
+
+/* SCSI command buffer size */
+#undef SCSIBUFFERSIZE
+
+/* The size of `char', as computed by sizeof. */
+#undef SIZEOF_CHAR
+
+/* The size of `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* The size of `short', as computed by sizeof. */
+#undef SIZEOF_SHORT
+
+/* The size of `void*', as computed by sizeof. */
+#undef SIZEOF_VOIDP
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at runtime.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define if pthreads should be used instead of forked processes. */
+#undef USE_PTHREAD
+
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Define to the version of the distribution. */
+#undef VERSION
+
+/* define if Avahi support is enabled for saned and the net backend */
+#undef WITH_AVAHI
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define scsireq_t as \'struct scsireq\' if necessary. */
+#undef scsireq_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define socklen_t as \'int\' if necessary. */
+#undef socklen_t
+
+/* Define to `long' if <sys/types.h> does not define. */
+#undef ssize_t
+
+/* Define for OS/2 only */
+#undef strcasecmp
+
+/* Define for OS/2 only */
+#undef strncasecmp
+
+
+
+#if defined(__MINGW32__)
+#define _BSDTYPES_DEFINED
+#endif
+
+#ifndef HAVE_U_CHAR
+#define u_char unsigned char
+#endif
+#ifndef HAVE_U_SHORT
+#define u_short unsigned short
+#endif
+#ifndef HAVE_U_INT
+#define u_int unsigned int
+#endif
+#ifndef HAVE_U_LONG
+#define u_long unsigned long
+#endif
+
+/* Prototype for getenv */
+#ifndef HAVE_GETENV
+#define getenv sanei_getenv
+char * getenv(const char *name);
+#endif
+
+/* Prototype for inet_ntop */
+#ifndef HAVE_INET_NTOP
+#define inet_ntop sanei_inet_ntop
+#include <sys/types.h>
+const char * inet_ntop (int af, const void *src, char *dst, size_t cnt);
+#endif
+
+/* Prototype for inet_pton */
+#ifndef HAVE_INET_PTON
+#define inet_pton sanei_inet_pton
+int inet_pton (int af, const char *src, void *dst);
+#endif
+
+/* Prototype for isfdtype */
+#ifndef HAVE_ISFDTYPE
+#define isfdtype sanei_isfdtype
+int isfdtype(int fd, int fdtype);
+#endif
+
+/* Prototype for sigprocmask */
+#ifndef HAVE_SIGPROCMASK
+#define sigprocmask sanei_sigprocmask
+int sigprocmask (int how, int *new, int *old);
+#endif
+
+/* Prototype for snprintf */
+#ifndef HAVE_SNPRINTF
+#define snprintf sanei_snprintf
+#include <sys/types.h>
+int snprintf (char *str,size_t count,const char *fmt,...);
+#endif
+
+/* Prototype for strcasestr */
+#ifndef HAVE_STRCASESTR
+#define strcasestr sanei_strcasestr
+char * strcasestr (const char *phaystack, const char *pneedle);
+#endif
+
+/* Prototype for strdup */
+#ifndef HAVE_STRDUP
+#define strdup sanei_strdup
+char *strdup (const char * s);
+#endif
+
+/* Prototype for strndup */
+#ifndef HAVE_STRNDUP
+#define strndup sanei_strndup
+#include <sys/types.h>
+char *strndup(const char * s, size_t n);
+#endif
+
+/* Prototype for strsep */
+#ifndef HAVE_STRSEP
+#define strsep sanei_strsep
+char *strsep(char **stringp, const char *delim);
+#endif
+
+/* Prototype for usleep */
+#ifndef HAVE_USLEEP
+#define usleep sanei_usleep
+unsigned int usleep (unsigned int useconds);
+#endif
+
+/* Prototype for vsyslog */
+#ifndef HAVE_VSYSLOG
+#include <stdarg.h>
+void vsyslog(int priority, const char *format, va_list args);
+#endif
+
diff --git a/include/sane/sane.h b/include/sane/sane.h
new file mode 100644
index 0000000..5320b4a
--- /dev/null
+++ b/include/sane/sane.h
@@ -0,0 +1,248 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 1997-1999 David Mosberger-Tang and Andreas Beck
+ This file is part of the SANE package.
+
+ This file is in the public domain. You may use and modify it as
+ you see fit, as long as this copyright message is included and
+ that there is an indication as to what modifications have been
+ made (if any).
+
+ SANE 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.
+
+ This file declares SANE application interface. See the SANE
+ standard for a detailed explanation of the interface. */
+#ifndef sane_h
+#define sane_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * SANE types and defines
+ */
+
+#define SANE_CURRENT_MAJOR 1
+#define SANE_CURRENT_MINOR 0
+
+#define SANE_VERSION_CODE(major, minor, build) \
+ ( (((SANE_Word) (major) & 0xff) << 24) \
+ | (((SANE_Word) (minor) & 0xff) << 16) \
+ | (((SANE_Word) (build) & 0xffff) << 0))
+
+#define SANE_VERSION_MAJOR(code) ((((SANE_Word)(code)) >> 24) & 0xff)
+#define SANE_VERSION_MINOR(code) ((((SANE_Word)(code)) >> 16) & 0xff)
+#define SANE_VERSION_BUILD(code) ((((SANE_Word)(code)) >> 0) & 0xffff)
+
+#define SANE_FALSE 0
+#define SANE_TRUE 1
+
+typedef unsigned char SANE_Byte;
+typedef int SANE_Word;
+typedef SANE_Word SANE_Bool;
+typedef SANE_Word SANE_Int;
+typedef char SANE_Char;
+typedef SANE_Char *SANE_String;
+typedef const SANE_Char *SANE_String_Const;
+typedef void *SANE_Handle;
+typedef SANE_Word SANE_Fixed;
+
+#define SANE_FIXED_SCALE_SHIFT 16
+#define SANE_FIX(v) ((SANE_Word) ((v) * (1 << SANE_FIXED_SCALE_SHIFT)))
+#define SANE_UNFIX(v) ((double)(v) / (1 << SANE_FIXED_SCALE_SHIFT))
+
+typedef enum
+ {
+ SANE_STATUS_GOOD = 0, /* everything A-OK */
+ SANE_STATUS_UNSUPPORTED, /* operation is not supported */
+ SANE_STATUS_CANCELLED, /* operation was cancelled */
+ SANE_STATUS_DEVICE_BUSY, /* device is busy; try again later */
+ SANE_STATUS_INVAL, /* data is invalid (includes no dev at open) */
+ SANE_STATUS_EOF, /* no more data available (end-of-file) */
+ SANE_STATUS_JAMMED, /* document feeder jammed */
+ SANE_STATUS_NO_DOCS, /* document feeder out of documents */
+ SANE_STATUS_COVER_OPEN, /* scanner cover is open */
+ SANE_STATUS_IO_ERROR, /* error during device I/O */
+ SANE_STATUS_NO_MEM, /* out of memory */
+ SANE_STATUS_ACCESS_DENIED /* access to resource has been denied */
+ }
+SANE_Status;
+
+/* following are for later sane version, older frontends wont support */
+#if 0
+#define SANE_STATUS_WARMING_UP 12 /* lamp not ready, please retry */
+#define SANE_STATUS_HW_LOCKED 13 /* scanner mechanism locked for transport */
+#endif
+
+typedef enum
+ {
+ SANE_TYPE_BOOL = 0,
+ SANE_TYPE_INT,
+ SANE_TYPE_FIXED,
+ SANE_TYPE_STRING,
+ SANE_TYPE_BUTTON,
+ SANE_TYPE_GROUP
+ }
+SANE_Value_Type;
+
+typedef enum
+ {
+ SANE_UNIT_NONE = 0, /* the value is unit-less (e.g., # of scans) */
+ SANE_UNIT_PIXEL, /* value is number of pixels */
+ SANE_UNIT_BIT, /* value is number of bits */
+ SANE_UNIT_MM, /* value is millimeters */
+ SANE_UNIT_DPI, /* value is resolution in dots/inch */
+ SANE_UNIT_PERCENT, /* value is a percentage */
+ SANE_UNIT_MICROSECOND /* value is micro seconds */
+ }
+SANE_Unit;
+
+typedef struct
+ {
+ SANE_String_Const name; /* unique device name */
+ SANE_String_Const vendor; /* device vendor string */
+ SANE_String_Const model; /* device model name */
+ SANE_String_Const type; /* device type (e.g., "flatbed scanner") */
+ }
+SANE_Device;
+
+#define SANE_CAP_SOFT_SELECT (1 << 0)
+#define SANE_CAP_HARD_SELECT (1 << 1)
+#define SANE_CAP_SOFT_DETECT (1 << 2)
+#define SANE_CAP_EMULATED (1 << 3)
+#define SANE_CAP_AUTOMATIC (1 << 4)
+#define SANE_CAP_INACTIVE (1 << 5)
+#define SANE_CAP_ADVANCED (1 << 6)
+
+#define SANE_OPTION_IS_ACTIVE(cap) (((cap) & SANE_CAP_INACTIVE) == 0)
+#define SANE_OPTION_IS_SETTABLE(cap) (((cap) & SANE_CAP_SOFT_SELECT) != 0)
+
+#define SANE_INFO_INEXACT (1 << 0)
+#define SANE_INFO_RELOAD_OPTIONS (1 << 1)
+#define SANE_INFO_RELOAD_PARAMS (1 << 2)
+
+typedef enum
+ {
+ SANE_CONSTRAINT_NONE = 0,
+ SANE_CONSTRAINT_RANGE,
+ SANE_CONSTRAINT_WORD_LIST,
+ SANE_CONSTRAINT_STRING_LIST
+ }
+SANE_Constraint_Type;
+
+typedef struct
+ {
+ SANE_Word min; /* minimum (element) value */
+ SANE_Word max; /* maximum (element) value */
+ SANE_Word quant; /* quantization value (0 if none) */
+ }
+SANE_Range;
+
+typedef struct
+ {
+ SANE_String_Const name; /* name of this option (command-line name) */
+ SANE_String_Const title; /* title of this option (single-line) */
+ SANE_String_Const desc; /* description of this option (multi-line) */
+ SANE_Value_Type type; /* how are values interpreted? */
+ SANE_Unit unit; /* what is the (physical) unit? */
+ SANE_Int size;
+ SANE_Int cap; /* capabilities */
+
+ SANE_Constraint_Type constraint_type;
+ union
+ {
+ const SANE_String_Const *string_list; /* NULL-terminated list */
+ const SANE_Word *word_list; /* first element is list-length */
+ const SANE_Range *range;
+ }
+ constraint;
+ }
+SANE_Option_Descriptor;
+
+typedef enum
+ {
+ SANE_ACTION_GET_VALUE = 0,
+ SANE_ACTION_SET_VALUE,
+ SANE_ACTION_SET_AUTO
+ }
+SANE_Action;
+
+typedef enum
+ {
+ SANE_FRAME_GRAY, /* band covering human visual range */
+ SANE_FRAME_RGB, /* pixel-interleaved red/green/blue bands */
+ SANE_FRAME_RED, /* red band only */
+ SANE_FRAME_GREEN, /* green band only */
+ SANE_FRAME_BLUE /* blue band only */
+ }
+SANE_Frame;
+
+/* push remaining types down to match existing backends */
+/* these are to be exposed in a later version of SANE */
+/* most front-ends will require updates to understand them */
+#if 0
+#define SANE_FRAME_TEXT 0x0A /* backend specific textual data */
+#define SANE_FRAME_JPEG 0x0B /* complete baseline JPEG file */
+#define SANE_FRAME_G31D 0x0C /* CCITT Group 3 1-D Compressed (MH) */
+#define SANE_FRAME_G32D 0x0D /* CCITT Group 3 2-D Compressed (MR) */
+#define SANE_FRAME_G42D 0x0E /* CCITT Group 4 2-D Compressed (MMR) */
+
+#define SANE_FRAME_IR 0x0F /* bare infrared channel */
+#define SANE_FRAME_RGBI 0x10 /* red+green+blue+infrared */
+#define SANE_FRAME_GRAYI 0x11 /* gray+infrared */
+#define SANE_FRAME_XML 0x12 /* undefined schema */
+#endif
+
+typedef struct
+ {
+ SANE_Frame format;
+ SANE_Bool last_frame;
+ SANE_Int bytes_per_line;
+ SANE_Int pixels_per_line;
+ SANE_Int lines;
+ SANE_Int depth;
+ }
+SANE_Parameters;
+
+struct SANE_Auth_Data;
+
+#define SANE_MAX_USERNAME_LEN 128
+#define SANE_MAX_PASSWORD_LEN 128
+
+typedef void (*SANE_Auth_Callback) (SANE_String_Const resource,
+ SANE_Char *username,
+ SANE_Char *password);
+
+extern SANE_Status sane_init (SANE_Int * version_code,
+ SANE_Auth_Callback authorize);
+extern void sane_exit (void);
+extern SANE_Status sane_get_devices (const SANE_Device *** device_list,
+ SANE_Bool local_only);
+extern SANE_Status sane_open (SANE_String_Const devicename,
+ SANE_Handle * handle);
+extern void sane_close (SANE_Handle handle);
+extern const SANE_Option_Descriptor *
+ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option);
+extern SANE_Status sane_control_option (SANE_Handle handle, SANE_Int option,
+ SANE_Action action, void *value,
+ SANE_Int * info);
+extern SANE_Status sane_get_parameters (SANE_Handle handle,
+ SANE_Parameters * params);
+extern SANE_Status sane_start (SANE_Handle handle);
+extern SANE_Status sane_read (SANE_Handle handle, SANE_Byte * data,
+ SANE_Int max_length, SANE_Int * length);
+extern void sane_cancel (SANE_Handle handle);
+extern SANE_Status sane_set_io_mode (SANE_Handle handle,
+ SANE_Bool non_blocking);
+extern SANE_Status sane_get_select_fd (SANE_Handle handle,
+ SANE_Int * fd);
+extern SANE_String_Const sane_strstatus (SANE_Status status);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* sane_h */
diff --git a/include/sane/sanei.h b/include/sane/sanei.h
new file mode 100644
index 0000000..ece1beb
--- /dev/null
+++ b/include/sane/sanei.h
@@ -0,0 +1,160 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 1996 David Mosberger-Tang and Andreas Beck
+ Copyright (C) 2002, 2003 Henning Meier-Geinitz
+
+ This file is part of the SANE package.
+
+ SANE 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.
+
+ SANE 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 sane; see the file COPYING. If not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+*/
+
+/** @file sanei.h
+ * Convenience macros and function declarations for backends
+ * @sa sanei_backend.h sanei_thread.h
+ */
+
+/* Doxygen documentation */
+
+/** @mainpage SANEI (SANE internal routines) documentation
+ *
+ * @image html sane-logo2.jpg
+ * @section intro Introduction
+ *
+ * The header files in the include/sane/ directory named sanei_*.h provide
+ * function declarations and macros that can be used by every SANE backend.
+ * Their implementations can be found in the sanei/ directory. The code aims
+ * to be platform-independent to avoid lots of \#ifdef code in the backends.
+ * Please use the SANEI functions wherever possible.
+ *
+ * This documentation was created by the use of doxygen, the
+ * doc/doxygen-sanei.conf configuration file and documentation in the sanei_*.h
+ * files.
+ *
+ * This documentation is far from complete. Any help is appreciated.
+ *
+ * @section additional Additional documentation
+ * - The SANE standard can be found at <a
+ * href="http://www.sane-project.org/html/">the SANE webserver</a>,
+ * though the PostScript version produced from the source may be more recent.
+ * - Information on how to write a backend: <a
+ * href="../backend-writing.txt">backend-writing.txt</a>.
+ * - General SANE documentation is on <a
+ * href="http://www.sane-project.org/docs.html">the SANE documentation
+ * page</a>.
+ *
+ * @section contact Contact
+ *
+ * The common way to contact the developers of SANE is the sane-devel
+ * mailing list. See the <a
+ * href="http://www.sane-project.org/mailing-lists.html">mailing list webpage</a>
+ * for details. That's the place to ask questions, report bugs, or announce
+ * a new backend.
+ *
+ */
+
+#ifndef sanei_h
+#define sanei_h
+
+#include <sane/sane.h>
+
+/** @name Public macros and functions
+ * @{
+ */
+/** @def STRINGIFY(x)
+ * Turn parameter into string.
+ */
+/** @def PASTE(x,y)
+ * Concatenate parameters.
+ *
+ */
+/** @def NELEMS(a)
+ * Return number of elements of an array.
+ *
+ */
+
+/** @fn extern SANE_Status sanei_check_value (const SANE_Option_Descriptor * opt, void * value);
+ * Check the constraints of a SANE option.
+ *
+ * @param opt option to check
+ * @param value value of the option
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_INVAL - if the value doesn't fit inside the constraint
+ * or any other error occured
+ * @sa sanei_constrain_value()
+ */
+
+/** @fn extern SANE_Status sanei_constrain_value (const SANE_Option_Descriptor * opt, void * value, SANE_Word * info);
+ * Check the constraints of a SANE option and adjust its value if necessary.
+ *
+ * Depending on the type of the option and constraint, value is modified
+ * to fit inside constraint.
+ *
+ * @param opt option to check
+ * @param value value of the option
+ * @param info info is set to SANE_INFO_INEXACT if value was changed
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_INVAL - if the function wasn't able to fit value into the
+ * constraint or any other error occured
+ * @sa sanei_check_value()
+ */
+
+/* @} */
+
+/* A few convenience macros: */
+/** @hideinitializer */
+#define NELEMS(a) ((int)(sizeof (a) / sizeof (a[0])))
+
+/** @hideinitializer */
+#define STRINGIFY1(x) #x
+/** @hideinitializer */
+#define STRINGIFY(x) STRINGIFY1(x)
+
+/** @hideinitializer */
+#define PASTE1(x,y) x##y
+/** @hideinitializer */
+#define PASTE(x,y) PASTE1(x,y)
+
+extern SANE_Status sanei_check_value (const SANE_Option_Descriptor * opt,
+ void * value);
+
+extern SANE_Status sanei_constrain_value (const SANE_Option_Descriptor * opt,
+ void * value, SANE_Word * info);
+
+
+#endif /* sanei_h */
diff --git a/include/sane/sanei_ab306.h b/include/sane/sanei_ab306.h
new file mode 100644
index 0000000..dacfd84
--- /dev/null
+++ b/include/sane/sanei_ab306.h
@@ -0,0 +1,58 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 1997 Andreas Czechanowski
+ This file is part of the SANE package.
+
+ 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., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice. */
+#ifndef sanei_ab306_h
+#define sanei_ab306_h
+
+#include <sys/types.h>
+
+#include <sane/sane.h>
+
+SANE_Status sanei_ab306_open (const char *dev, int *fd);
+void sanei_ab306_close (int fd);
+void sanei_ab306_exit (void);
+
+SANE_Status sanei_ab306_get_io_privilege (int fd);
+SANE_Status sanei_ab306_test_ready (int fd);
+SANE_Status sanei_ab306_cmd (int fd, const void *src, size_t src_size,
+ void *dst, size_t *dst_size);
+SANE_Status sanei_ab306_rdata (int fd, int planes,
+ SANE_Byte *buf, int lines, int bpl);
+
+#endif /* sanei_ab306_h */
diff --git a/include/sane/sanei_access.h b/include/sane/sanei_access.h
new file mode 100644
index 0000000..d668b98
--- /dev/null
+++ b/include/sane/sanei_access.h
@@ -0,0 +1,97 @@
+/* sane - Scanner Access Now Easy.
+
+ Copyright (C) 2005 Gerhard Jaeger <gerhard@gjaeger.de>
+
+ This file is part of the SANE package.
+
+ 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., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+
+*/
+
+/** @file sanei_access.h
+ * Interface file for the sanei_access functions.
+ *
+ * The idea is to provide some simple locking/unlocking mecanism, which
+ * can be used to protect device access from more than one frontend
+ * simultaneously.
+ */
+
+#ifndef sanei_access_h
+#define sanei_access_h
+
+#include "../include/sane/config.h"
+#include "../include/sane/sane.h"
+
+/** Initialize sanei_access.
+ *
+ * This function must be called before any other sanei_access function.
+ *
+ * @param backend - backend name, who uses this lib
+ */
+extern void sanei_access_init( const char * backend );
+
+/** Set a lock.
+ *
+ * The function tries to open/create exclusively a lock file in
+ * $PATH_SANE_LOCK_DIR.
+ * If the file could be created successfully, the function fills in the
+ * process ID.
+ * The complete filename of the lockfile is created as follows:
+ * $PATH_SANE_LOCK_DIR/LCK..&lt;devicename&gt;
+ * If the lock could not be set, the function tries it until the timeout
+ * period has been elapsed.
+ *
+ * @param devicename - unique part of the lockfile name
+ * @param timeout - time in seconds to try to set a lock
+ * @return
+ * - SANE_STATUS_GOOD - if the lock has been successfully set
+ * - SANE_STATUS_ACCESS_DENIED - the lock could not set
+ */
+extern SANE_Status sanei_access_lock( const char * devicename, SANE_Word timeout );
+
+/** Unlock a previously set lock.
+ *
+ * The function tries to unlock a previously created lock. The lockfile will be
+ * closed and removed.
+ *
+ * @param devicename - part of the lockfile name, use for sanei_acess_lock()
+ * @return
+ * - SANE_STATUS_GOOD - currently the one and only return value
+ */
+extern SANE_Status sanei_access_unlock( const char * devicename );
+
+#endif /* sanei_access_h */
diff --git a/include/sane/sanei_auth.h b/include/sane/sanei_auth.h
new file mode 100644
index 0000000..1fd240d
--- /dev/null
+++ b/include/sane/sanei_auth.h
@@ -0,0 +1,98 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 2000 Jochen Eisinger <jochen.eisinger@gmx.net>
+ This file is part of the SANE package.
+
+ 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., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+*/
+
+/** @file sanei_auth.h
+ * Interface for authorization of resources
+ *
+ * This file implements an interface for user authorization. The authorization
+ * call is forwarded to the frontend which asks for a username and password.
+ * An MD5 digest is used if supported by the frontend.
+ *
+ * @sa sanei.h sanei_backend.h
+ */
+
+#ifndef sanei_auth_h
+#define sanei_auth_h
+
+#include "../include/sane/sane.h"
+
+/** Check authorization for a resource
+ *
+ * This function looks for the file SANE_CONFIG_DIR/backend.users.
+ * If this file doesn't exist, sanei_authorize always returns SANE_STATUS_GOOD.
+ * The file backend.users contains a list of usernames, passwords, and
+ * resources:
+ *
+ * username:password:resource
+ * username:password:resource
+ *
+ * If the requested resource isn't listed in this file, sanei_authorize
+ * return SANE_SATUS_GOOD. In all other cases, sanei_authorize sends a
+ * challenge to the frontend of the form
+ *
+ * resource$MD5$randomstring
+ *
+ * where randomstring consists of the PID, the time, and some random
+ * characters. It accepts two forms of answers
+ *
+ * std: username:password
+ * md5: username:$MD5$m5digest
+ *
+ * where md5digest is md5(randomstring password).
+ *
+ * If this username/password/resource triple is listed in backend.users
+ * sanei_authorize returns SANE_STATUS_GOOD, in all other cases it returns
+ * SANE_STATUS_ACCESS_DENIED.
+ *
+ * @param resource resource to authorize
+ * @param backend backend name
+ * @param authorize auth callback
+ *
+ * @return
+ * - SANE_STATUS_GOOD - access is granted
+ * - SANE_STATUS_ACCESS_DENIED - access is denied
+ */
+
+SANE_Status
+sanei_authorize (const char *resource,
+ const char *backend, SANE_Auth_Callback authorize);
+
+#endif /* sanei_auth_h */
diff --git a/include/sane/sanei_backend.h b/include/sane/sanei_backend.h
new file mode 100644
index 0000000..1b5afe2
--- /dev/null
+++ b/include/sane/sanei_backend.h
@@ -0,0 +1,179 @@
+/** @file sanei_backend.h
+ * Compatibility header file for backends
+ *
+ * This file provides some defines for macros missing on some platforms.
+ * It also has the SANE API entry points. sanei_backend.h must be included
+ * by every backend.
+ *
+ * @sa sanei.h sanei_thread.h
+ */
+
+
+/*
+ * Compiler related options
+ */
+
+/** Mark unused variables/parameters
+ *
+ * Tells the compiler a variable is unused, so the compiler doesn't spit a warning.
+ */
+#ifdef __GNUC__
+#define __sane_unused__ __attribute__((unused))
+#else
+#define __sane_unused__
+#endif
+
+/** @name Compatibility macros
+ * @{
+ */
+#include <sane/sanei_debug.h>
+
+#ifdef HAVE_SYS_HW_H
+ /* OS/2 i/o-port access compatibility macros: */
+# define inb(p) _inp8 (p)
+# define outb(v,p) _outp8 ((p),(v))
+# define ioperm(b,l,o) _portaccess ((b),(b)+(l)-1)
+# define HAVE_IOPERM 1
+#endif
+
+#ifndef HAVE_OS2_H
+#include <fcntl.h>
+#ifndef O_NONBLOCK
+# ifdef O_NDELAY
+# define O_NONBLOCK O_NDELAY
+# else
+# ifdef FNDELAY
+# define O_NONBLOCK FNDELAY /* last resort */
+# endif
+# endif
+#endif
+#endif /* HAVE_OS2_H */
+
+#include <limits.h>
+#ifndef PATH_MAX
+# define PATH_MAX 1024
+#endif
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+#ifndef MM_PER_INCH
+#define MM_PER_INCH 25.4
+#endif
+
+#ifdef HAVE_SIGPROCMASK
+# define SIGACTION sigaction
+#else
+
+/* Just enough backwards compatibility that we get by in the backends
+ without making handstands. */
+# ifdef sigset_t
+# undef sigset_t
+# endif
+# ifdef sigemptyset
+# undef sigemptyset
+# endif
+# ifdef sigfillset
+# undef sigfillset
+# endif
+# ifdef sigaddset
+# undef sigaddset
+# endif
+# ifdef sigdelset
+# undef sigdelset
+# endif
+# ifdef sigprocmask
+# undef sigprocmask
+# endif
+# ifdef SIG_BLOCK
+# undef SIG_BLOCK
+# endif
+# ifdef SIG_UNBLOCK
+# undef SIG_UNBLOCK
+# endif
+# ifdef SIG_SETMASK
+# undef SIG_SETMASK
+# endif
+
+# define sigset_t int
+# define sigemptyset(set) do { *(set) = 0; } while (0)
+# define sigfillset(set) do { *(set) = ~0; } while (0)
+# define sigaddset(set,signal) do { *(set) |= sigmask (signal); } while (0)
+# define sigdelset(set,signal) do { *(set) &= ~sigmask (signal); } while (0)
+# define sigaction(sig,new,old) sigvec (sig,new,old)
+
+ /* Note: it's not safe to just declare our own "struct sigaction" since
+ some systems (e.g., some versions of OpenStep) declare that structure,
+ but do not implement sigprocmask(). Hard to believe, aint it? */
+# define SIGACTION sigvec
+# define SIG_BLOCK 1
+# define SIG_UNBLOCK 2
+# define SIG_SETMASK 3
+#endif /* !HAVE_SIGPROCMASK */
+/* @} */
+
+
+/** @name Declaration of entry points:
+ * @{
+ */
+extern SANE_Status ENTRY(init) (SANE_Int *, SANE_Auth_Callback);
+extern SANE_Status ENTRY(get_devices) (const SANE_Device ***, SANE_Bool);
+extern SANE_Status ENTRY(open) (SANE_String_Const, SANE_Handle *);
+extern const SANE_Option_Descriptor *
+ ENTRY(get_option_descriptor) (SANE_Handle, SANE_Int);
+extern SANE_Status ENTRY(control_option) (SANE_Handle, SANE_Int, SANE_Action,
+ void *, SANE_Word *);
+extern SANE_Status ENTRY(get_parameters) (SANE_Handle, SANE_Parameters *);
+extern SANE_Status ENTRY(start) (SANE_Handle);
+extern SANE_Status ENTRY(read) (SANE_Handle, SANE_Byte *, SANE_Int,
+ SANE_Int *);
+extern SANE_Status ENTRY(set_io_mode) (SANE_Handle, SANE_Bool);
+extern SANE_Status ENTRY(get_select_fd) (SANE_Handle, SANE_Int *);
+extern void ENTRY(cancel) (SANE_Handle);
+extern void ENTRY(close) (SANE_Handle);
+extern void ENTRY(exit) (void);
+
+#ifndef STUBS
+/* Now redirect sane_* calls to backend's functions: */
+
+#define sane_init(a,b) ENTRY(init) (a,b)
+#define sane_get_devices(a,b) ENTRY(get_devices) (a,b)
+#define sane_open(a,b) ENTRY(open) (a,b)
+#define sane_get_option_descriptor(a,b) ENTRY(get_option_descriptor) (a,b)
+#define sane_control_option(a,b,c,d,e) ENTRY(control_option) (a,b,c,d,e)
+#define sane_get_parameters(a,b) ENTRY(get_parameters) (a,b)
+#define sane_start(a) ENTRY(start) (a)
+#define sane_read(a,b,c,d) ENTRY(read) (a,b,c,d)
+#define sane_set_io_mode(a,b) ENTRY(set_io_mode) (a,b)
+#define sane_get_select_fd(a,b) ENTRY(get_select_fd) (a,b)
+#define sane_cancel(a) ENTRY(cancel) (a)
+#define sane_close(a) ENTRY(close) (a)
+#define sane_exit(a) ENTRY(exit) (a)
+#endif /* STUBS */
+/* @} */
+
+/** Internationalization for SANE backends
+ *
+ * Add SANE_I18N() to all texts that can be translated.
+ * E.g. out_txt = SANE_I18N("Hello");
+ */
+#ifndef SANE_I18N
+#define SANE_I18N(text) text
+#endif
+
+/** Option_Value union
+ *
+ * Convenience union to access option values given to the backend
+ */
+#ifndef SANE_OPTION
+typedef union
+{
+ SANE_Bool b; /**< bool */
+ SANE_Word w; /**< word */
+ SANE_Word *wa; /**< word array */
+ SANE_String s; /**< string */
+}
+Option_Value;
+#define SANE_OPTION 1
+#endif
diff --git a/include/sane/sanei_cderror.h b/include/sane/sanei_cderror.h
new file mode 100644
index 0000000..41a29cd
--- /dev/null
+++ b/include/sane/sanei_cderror.h
@@ -0,0 +1,132 @@
+/*
+ * cderror.h
+ *
+ * Copyright (C) 1994, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file defines the error and message codes for the cjpeg/djpeg
+ * applications. These strings are not needed as part of the JPEG library
+ * proper.
+ * Edit this file to add new codes, or to translate the message strings to
+ * some other language.
+ */
+
+/*
+ * To define the enum list of message codes, include this file without
+ * defining macro JMESSAGE. To create a message string table, include it
+ * again with a suitable JMESSAGE definition (see jerror.c for an example).
+ */
+#ifndef JMESSAGE
+#ifndef CDERROR_H
+#define CDERROR_H
+/* First time through, define the enum list */
+#define JMAKE_ENUM_LIST
+#else
+/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
+#define JMESSAGE(code,string)
+#endif /* CDERROR_H */
+#endif /* JMESSAGE */
+
+#ifdef JMAKE_ENUM_LIST
+
+typedef enum {
+
+#define JMESSAGE(code,string) code ,
+
+#endif /* JMAKE_ENUM_LIST */
+
+JMESSAGE(JMSG_FIRSTADDONCODE=1000, NULL) /* Must be first entry! */
+
+#ifdef BMP_SUPPORTED
+JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format")
+JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported")
+JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length")
+JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1")
+JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB")
+JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
+JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
+JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image")
+JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
+JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image")
+JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image")
+#endif /* BMP_SUPPORTED */
+
+#ifdef GIF_SUPPORTED
+JMESSAGE(JERR_GIF_BUG, "GIF output got confused")
+JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d")
+JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB")
+JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file")
+JMESSAGE(JERR_GIF_NOT, "Not a GIF file")
+JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image")
+JMESSAGE(JTRC_GIF_BADVERSION,
+ "Warning: unexpected GIF version number '%c%c%c'")
+JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x")
+JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input")
+JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file")
+JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring")
+JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image")
+JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits")
+#endif /* GIF_SUPPORTED */
+
+#ifdef PPM_SUPPORTED
+JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
+JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
+JMESSAGE(JERR_PPM_NOT, "Not a PPM file")
+JMESSAGE(JTRC_PGM, "%ux%u PGM image")
+JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
+JMESSAGE(JTRC_PPM, "%ux%u PPM image")
+JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image")
+#endif /* PPM_SUPPORTED */
+
+#ifdef RLE_SUPPORTED
+JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library")
+JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB")
+JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE")
+JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file")
+JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header")
+JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header")
+JMESSAGE(JERR_RLE_NOT, "Not an RLE file")
+JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE")
+JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup")
+JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file")
+JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d")
+JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file")
+JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d")
+JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d")
+#endif /* RLE_SUPPORTED */
+
+#ifdef TARGA_SUPPORTED
+JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format")
+JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
+JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB")
+JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image")
+JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image")
+JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image")
+#else
+JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled")
+#endif /* TARGA_SUPPORTED */
+
+JMESSAGE(JERR_BAD_CMAP_FILE,
+ "Color map file is invalid or of unsupported format")
+JMESSAGE(JERR_TOO_MANY_COLORS,
+ "Output file format cannot handle %d colormap entries")
+JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed")
+#ifdef TARGA_SUPPORTED
+JMESSAGE(JERR_UNKNOWN_FORMAT,
+ "Unrecognized input file format --- perhaps you need -targa")
+#else
+JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format")
+#endif
+JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format")
+
+#ifdef JMAKE_ENUM_LIST
+
+ JMSG_LASTADDONCODE
+} ADDON_MESSAGE_CODE;
+
+#undef JMAKE_ENUM_LIST
+#endif /* JMAKE_ENUM_LIST */
+
+/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
+#undef JMESSAGE
diff --git a/include/sane/sanei_codec_ascii.h b/include/sane/sanei_codec_ascii.h
new file mode 100644
index 0000000..991499a
--- /dev/null
+++ b/include/sane/sanei_codec_ascii.h
@@ -0,0 +1,62 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 1996 David Mosberger-Tang and Andreas Beck
+ This file is part of the SANE package.
+
+ SANE 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.
+
+ SANE 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 sane; see the file COPYING. If not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+*/
+
+/** @file sanei_codec_ascii.h
+ * ASCII codec for network and file transmissions
+ *
+ * Instead translating data to a byte stream this codec uses ASCII hex numbers.
+ * Therefore it can be used for streams that are not 8-bit clean or which can
+ * only use printable characters. It's currently used for saving/restoring
+ * data to/from disk.
+ *
+ * @sa sanei_codec_bin.h sanei_net.h sanei_wire.h
+ */
+#ifndef sanei_codec_ascii_h
+#define sanei_codec_ascii_h
+
+/** Initialize the ascii codec
+ *
+ * Set the i/o functions of the Wire to those of the ASCII codec.
+ *
+ * @param w Wire
+ */
+extern void sanei_codec_ascii_init (Wire *w);
+
+#endif /* sanei_codec_ascii_h */
diff --git a/include/sane/sanei_codec_bin.h b/include/sane/sanei_codec_bin.h
new file mode 100644
index 0000000..ba17bac
--- /dev/null
+++ b/include/sane/sanei_codec_bin.h
@@ -0,0 +1,61 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 1996 David Mosberger-Tang and Andreas Beck
+ This file is part of the SANE package.
+
+ SANE 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.
+
+ SANE 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 sane; see the file COPYING. If not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+*/
+
+/** @file sanei_codec_bin.h
+ * Binary codec for network transmissions
+ *
+ * Transtale data to a byte stream while taking byte order problems into
+ * account. This codec is currently used for saned and the network backend.
+ *
+ * @sa sanei_codec_ascii.h sanei_net.h sanei_wire.h
+ */
+
+#ifndef sanei_codec_bin_h
+#define sanei_codec_bin_h
+
+/** Initialize the binary codec
+ *
+ * Set the i/o functions of the Wire to those of the binary codec.
+ *
+ * @param w Wire
+ */
+extern void sanei_codec_bin_init (Wire *w);
+
+#endif /* sanei_codec_bin_h */
diff --git a/include/sane/sanei_config.h b/include/sane/sanei_config.h
new file mode 100644
index 0000000..cf877cf
--- /dev/null
+++ b/include/sane/sanei_config.h
@@ -0,0 +1,175 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 1997 Jeffrey S. Freedman
+ This file is part of the SANE package.
+
+ 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., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+*/
+
+/** @file sanei_config.h
+ * Generic configuration support.
+ *
+ * Use the functions of this header file if you want to read and analyze
+ * configuration files.
+*/
+
+#ifndef sanei_config_h
+#define sanei_config_h 1
+
+#include <stdio.h>
+#include <sane/sane.h>
+
+/** Search configuration file \a name along directory list and return file
+ * pointer if such a file exists.
+ *
+ * The following directory list is used:
+ * 1st: SANE_CONFIG_DIR environment variable.
+ * 2nd: PATH_SANE_CONFIG_DIR set during configuration.
+ * 3rd: Current directory.
+ * @param name filename with extension but without path (such as "mustek.conf")
+ *
+ * @return file pointer, or NULL if not found
+ *
+ */
+extern FILE *sanei_config_open (const char *name);
+
+/** Read a line from configuration file.
+ *
+ * Strips all unwanted chars. Use this instead of fgets() to remove
+ * line ending chars on all known platforms.
+ *
+ * @param str points to the buffer for the line
+ * @param n size of the buffer
+ * @param stream file pointer
+ *
+ * @return \a str on success and NULL on error
+*/
+extern char *sanei_config_read (char *str, int n, FILE *stream);
+
+/** Remove all whitespace from the beginning of a string.
+ *
+ * @param str string
+ *
+ * @return string without leading whitespace
+ *
+ */
+extern const char *sanei_config_skip_whitespace (const char *str);
+
+
+/** Scan a string constant from a line of text and return a malloced copy
+ * of it.
+ *
+ * It's the responsibility of the caller to free the returned string constant
+ * at an appropriate time. Whitespace in front of the string constant is
+ * ignored. Whitespace can be included in the string constant by enclosing it
+ * in double-quotes.
+ *
+ * @param str line of text to scan for a string constant
+ * @param string_const copy of the string constant
+ *
+ * @return a pointer to the position in str where the scan stopped
+ */
+extern const char *sanei_config_get_string (const char *str,
+ char **string_const);
+
+/** Expand device name patterns into a list of devices.
+ *
+ * Apart from a normal device name (such as /dev/sdb), this function currently
+ * supports SCSI device specifications of the form:
+ *
+ * scsi VENDOR MODEL TYPE BUS CHANNEL ID LUN
+ *
+ * Where VENDOR is the desired vendor name. MODEL is the desired model name.
+ * TYPE is the desired device type. All of these can be set to * to match
+ * anything. To include whitespace in these strings, enclose them in
+ * double-quotes ("). BUS, ID, and LUN are the desired SCSI bus, id, and
+ * logical-unit numbers. These can be set to * or simply omitted to match
+ * anything.
+ *
+ * @param name device name pattern
+ * @param attach attach function
+ */
+extern void sanei_config_attach_matching_devices (const char *name,
+ SANE_Status (*attach)
+ (const char *dev));
+
+/** this structure holds the description of configuration options. There is
+ * a list for options and another for their values.
+ * These lists are used when the configuration file is
+ * parsed. Read values are stored in Option_Value. Helpers functions are
+ * provided to access values easily */
+typedef struct
+{
+ /** number of options */
+ SANE_Int count;
+
+ /** NULL terminated list of configuration option */
+ SANE_Option_Descriptor **descriptors;
+
+ /** values for the configuration options */
+ void **values;
+
+} SANEI_Config;
+
+/** Parse configuration file, reading configuration options and trying to
+ * attach devices found in file.
+ *
+ * The option are gathered in a single configuration structure. Each time
+ * a line holds a value that is not an option, the attach function is called
+ * with the name found and the configuration structure with it's current values.
+ *
+ * @param config_file name of the configuration file to read
+ * @param config configuration structure to be filled during configuration
+ * parsing and passed to the attach callback function
+ * @param config_attach attach with config callback function
+ *
+ * @return SANE_STATUS_GOOD if no errors
+ * SANE_STATUS_ACCESS_DENIED if configuration file can't be opened
+ */
+extern SANE_Status sanei_configure_attach (
+ const char *config_file,
+ SANEI_Config *config,
+ SANE_Status (*config_attach)(SANEI_Config *config, const char *devname)
+);
+
+/** Return the list of config directories, extracted from the SANE_CONFIG_DIR
+ * environment variable and the default paths.
+ * @return a string containing the configuration paths, separated by the
+ * operating system's path separator
+ */
+extern const char *sanei_config_get_paths (void);
+
+#endif /* sanei_config_h */
diff --git a/include/sane/sanei_debug.h b/include/sane/sanei_debug.h
new file mode 100644
index 0000000..557f8a7
--- /dev/null
+++ b/include/sane/sanei_debug.h
@@ -0,0 +1,153 @@
+/** @file sanei_debug.h
+ * Support for printing debug messages.
+ *
+ * Use the functions of this header file to print debug or warning messages.
+ */
+
+#ifndef _SANEI_DEBUG_H
+#define _SANEI_DEBUG_H
+
+#include <sane/sanei.h>
+
+/** @name Public macros
+ * These macros can be used in backends and other SANE-related
+ * code.
+ *
+ * Before including sanei_debug.h, the following macros must be set:
+ *
+ * - BACKEND_NAME - The name of your backend without double-quotes (must be set in any case)
+ * - STUBS - If this is defined, no macros will be included. Used in
+ * backends consisting of more than one .c file.
+ * - DEBUG_DECLARE_ONLY - Generates prototypes instead of functions. Used in
+ * backends consisting of more than one .c file.
+ * - DEBUG_NOT_STATIC - Doesn't generate static functions. Used in header files if
+ * they are include in more than one .c file.
+ *
+ * @{
+ */
+
+/** @def DBG_INIT()
+ * Initialize sanei_debug.
+ *
+ * Call this function before you use any DBG function.
+ */
+
+/** @def DBG(level, fmt, ...)
+ * Print a message at debug level `level' or higher using a printf-like
+ * function. Example: DBG(1, "sane_open: opening fd \%d\\n", fd).
+ *
+ * @param level debug level
+ * @param fmt format (see man 3 printf for details)
+ * @param ... additional arguments
+ */
+
+/** @def IF_DBG(x)
+ * Compile code only if debugging is enabled.
+ *
+ * Expands to x if debug support is enabled at compile-time. If NDEBUG is
+ * defined at compile-time this macro expands to nothing.
+ *
+ * @param x code to expand when debugging is enabled
+ */
+
+/**
+ * @def DBG_LEVEL
+ * Current debug level.
+ *
+ * You can only read this "variable".
+ */
+
+/** @def ENTRY(name)
+ * Expands to sane_BACKEND_NAME_name.
+ *
+ * Example: ENTRY(init) in mustek.c will expand to sane_mustek_init.
+ */
+
+/* @} */
+
+
+ /** @hideinitializer*/
+#define ENTRY(name) PASTE(PASTE(PASTE(sane_,BACKEND_NAME),_),name)
+
+#ifdef NDEBUG
+
+extern void sanei_debug_ndebug (int level, const char *msg, ...);
+
+# define DBG_LEVEL (0)
+# define DBG_INIT()
+# define DBG sanei_debug_ndebug
+# define IF_DBG(x)
+
+#else /* !NDEBUG */
+
+ /** @hideinitializer*/
+# define DBG_LEVEL PASTE(sanei_debug_,BACKEND_NAME)
+
+# if defined(BACKEND_NAME) && !defined(STUBS)
+# ifdef DEBUG_DECLARE_ONLY
+extern int DBG_LEVEL;
+# else /* !DEBUG_DECLARE_ONLY */
+int DBG_LEVEL = 0;
+# endif /* DEBUG_DECLARE_ONLY */
+# endif /* BACKEND_NAME && !STUBS */
+
+ /** @hideinitializer*/
+# define DBG_INIT() \
+ sanei_init_debug (STRINGIFY(BACKEND_NAME), &DBG_LEVEL)
+
+ /** @hideinitializer*/
+# define DBG_LOCAL PASTE(DBG_LEVEL,_call)
+
+
+# ifndef STUBS
+
+# ifdef DEBUG_DECLARE_ONLY
+
+extern void DBG_LOCAL (int level, const char *msg, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 2, 3)))
+#endif
+;
+
+# else /* !DEBUG_DECLARE_ONLY */
+
+# include <stdarg.h>
+
+extern void sanei_debug_msg
+ (int level, int max_level, const char *be, const char *fmt, va_list ap);
+
+#ifdef __GNUC__
+# ifndef DEBUG_NOT_STATIC
+static
+# endif /* !DEBUG_NOT_STATIC */
+void DBG_LOCAL (int level, const char *msg, ...) __attribute__ ((format (printf, 2, 3)));
+#endif /* __GNUC__ */
+
+# ifndef DEBUG_NOT_STATIC
+static
+# endif /* !DEBUG_NOT_STATIC */
+void
+DBG_LOCAL (int level, const char *msg, ...)
+{
+ va_list ap;
+
+ va_start (ap, msg);
+ sanei_debug_msg (level, DBG_LEVEL, STRINGIFY(BACKEND_NAME), msg, ap);
+ va_end (ap);
+}
+
+# endif /* DEBUG_DECLARE_ONLY */
+
+# endif /* !STUBS */
+
+ /** @hideinitializer*/
+# define DBG DBG_LOCAL
+
+extern void sanei_init_debug (const char * backend, int * debug_level_var);
+
+ /** @hideinitializer*/
+# define IF_DBG(x) x
+
+#endif /* NDEBUG */
+
+#endif /* _SANEI_DEBUG_H */
diff --git a/include/sane/sanei_jinclude.h b/include/sane/sanei_jinclude.h
new file mode 100644
index 0000000..0a4f151
--- /dev/null
+++ b/include/sane/sanei_jinclude.h
@@ -0,0 +1,91 @@
+/*
+ * jinclude.h
+ *
+ * Copyright (C) 1991-1994, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file exists to provide a single place to fix any problems with
+ * including the wrong system include files. (Common problems are taken
+ * care of by the standard jconfig symbols, but on really weird systems
+ * you may have to edit this file.)
+ *
+ * NOTE: this file is NOT intended to be included by applications using the
+ * JPEG library. Most applications need only include jpeglib.h.
+ */
+
+
+/* Include auto-config file to find out which system include files we need. */
+
+#include "jconfig.h" /* auto configuration options */
+#define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */
+
+/*
+ * We need the NULL macro and size_t typedef.
+ * On an ANSI-conforming system it is sufficient to include <stddef.h>.
+ * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to
+ * pull in <sys/types.h> as well.
+ * Note that the core JPEG library does not require <stdio.h>;
+ * only the default error handler and data source/destination modules do.
+ * But we must pull it in because of the references to FILE in jpeglib.h.
+ * You can remove those references if you want to compile without <stdio.h>.
+ */
+
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef NEED_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include <stdio.h>
+
+/*
+ * We need memory copying and zeroing functions, plus strncpy().
+ * ANSI and System V implementations declare these in <string.h>.
+ * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
+ * Some systems may declare memset and memcpy in <memory.h>.
+ *
+ * NOTE: we assume the size parameters to these functions are of type size_t.
+ * Change the casts in these macros if not!
+ */
+
+#ifdef NEED_BSD_STRINGS
+
+#include <strings.h>
+#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size))
+#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size))
+
+#else /* not BSD, assume ANSI/SysV string lib */
+
+#include <string.h>
+#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size))
+#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size))
+
+#endif
+
+/*
+ * In ANSI C, and indeed any rational implementation, size_t is also the
+ * type returned by sizeof(). However, it seems there are some irrational
+ * implementations out there, in which sizeof() returns an int even though
+ * size_t is defined as long or unsigned long. To ensure consistent results
+ * we always use this SIZEOF() macro in place of using sizeof() directly.
+ */
+
+#define SIZEOF(object) ((size_t) sizeof(object))
+
+/*
+ * The modules that use fread() and fwrite() always invoke them through
+ * these macros. On some systems you may need to twiddle the argument casts.
+ * CAUTION: argument order is different from underlying functions!
+ */
+
+#define JFREAD(file,buf,sizeofbuf) \
+ ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
+#define JFWRITE(file,buf,sizeofbuf) \
+ ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
diff --git a/include/sane/sanei_jpeg.h b/include/sane/sanei_jpeg.h
new file mode 100644
index 0000000..5326864
--- /dev/null
+++ b/include/sane/sanei_jpeg.h
@@ -0,0 +1,55 @@
+/*
+ * cdjpeg.h
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains common declarations for the sample applications
+ * cjpeg and djpeg. It is NOT used by the core JPEG library.
+ */
+
+#define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */
+#define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */
+#include "sane/sanei_jinclude.h"
+#include "jpeglib.h"
+#include "jerror.h" /* get library error codes too */
+#include "sane/sanei_cderror.h" /* get application-specific error codes */
+
+/*
+ * Object interface for djpeg's output file encoding modules
+ */
+
+typedef struct djpeg_dest_struct * djpeg_dest_ptr;
+
+struct djpeg_dest_struct {
+ /* start_output is called after jpeg_start_decompress finishes.
+ * The color map will be ready at this time, if one is needed.
+ */
+ JMETHOD(void, start_output, (j_decompress_ptr cinfo,
+ djpeg_dest_ptr dinfo));
+ /* Emit the specified number of pixel rows from the buffer. */
+ JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo,
+ djpeg_dest_ptr dinfo,
+ JDIMENSION rows_supplied,
+ char *data));
+ /* Finish up at the end of the image. */
+ JMETHOD(void, finish_output, (j_decompress_ptr cinfo,
+ djpeg_dest_ptr dinfo));
+
+ /* Target file spec; filled in by djpeg.c after object is created. */
+ FILE * output_file;
+
+ /* Output pixel-row buffer. Created by module init or start_output.
+ * Width is cinfo->output_width * cinfo->output_components;
+ * height is buffer_height.
+ */
+ JSAMPARRAY buffer;
+ JDIMENSION buffer_height;
+};
+
+/* Module selection routines for I/O modules. */
+
+EXTERN(djpeg_dest_ptr) sanei_jpeg_jinit_write_ppm JPP((j_decompress_ptr cinfo));
+
+/* miscellaneous useful macros */
diff --git a/include/sane/sanei_lm983x.h b/include/sane/sanei_lm983x.h
new file mode 100644
index 0000000..6b9d8c8
--- /dev/null
+++ b/include/sane/sanei_lm983x.h
@@ -0,0 +1,150 @@
+/* sane - Scanner Access Now Easy.
+
+ based on sources acquired from Plustek Inc.
+ Copyright (C) 2002-2003 Gerhard Jaeger <gerhard@gjaeger.de>
+
+ This file is part of the SANE package.
+
+ 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., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+
+*/
+
+/** @file sanei_lm983x.h
+ * Interface files for the NS LM9831/2/3 USB chip.
+ *
+ * The National Semiconductor LM9831, LM9832, and LM9833 chips are used in
+ * many USB scanners. Examples include Plustek and Mustek devices.
+ *
+ * @sa sanei_usb.h
+ */
+
+#ifndef sanei_lm983x_h
+#define sanei_lm983x_h
+
+#include "../include/sane/config.h"
+#include "../include/sane/sane.h"
+
+/**
+ * Read one data byte from a specific LM983x register.
+ *
+ * @param fd - device file descriptor (SANE_Int)
+ * @param reg - number of register (SANE_Byte)
+ * @param value - byte value to be written (SANE_Byte *)
+ *
+ * @return The SANE status code for the operation (SANE_Status):
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_IO_ERROR - system write function failed
+ * - SANE_STATUS_INVAL - register out of range
+ */
+#define sanei_lm983x_read_byte(fd, reg, value) \
+ sanei_lm983x_read (fd, reg, value, 1, 0)
+
+/**
+ * Initialize sanei_lm983x.
+ *
+ * Currently, this function only enables the debugging functionality.
+ */
+extern void sanei_lm983x_init( void );
+
+/**
+ * Write one data byte to a specific LM983x register.
+ *
+ * @param fd - device file descriptor
+ * @param reg - number of register
+ * @param value - byte value to be written
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_IO_ERROR - system write function failed
+ * - SANE_STATUS_INVAL - register out of range
+ */
+extern SANE_Status sanei_lm983x_write_byte( SANE_Int fd,
+ SANE_Byte reg, SANE_Byte value );
+
+/**
+ * Write one or more data bytes to one or more specific LM983x
+ * registers.
+ *
+ * @param fd - device file descriptor
+ * @param reg - number of start-register
+ * @param buffer - buffer to be written
+ * @param len - number of bytes to be written
+ * @param increment - SANE_TRUE enables the autoincrement of the register
+ * value during the write cycle, SANE_FALSE disables this
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_IO_ERROR - system read function failed
+ * - SANE_STATUS_INVAL - register out of range or len field was 0
+ */
+extern SANE_Status sanei_lm983x_write( SANE_Int fd, SANE_Byte reg,
+ SANE_Byte *buffer, SANE_Word len,
+ SANE_Bool increment );
+
+/**
+ * Read one or more data bytes from one ore more specific LM983x
+ * registers.
+ *
+ * @param fd - device file descriptor
+ * @param reg - number of start-register
+ * @param buffer - buffer to receive the data
+ * @param len - number of bytes to receive
+ * @param increment - SANE_TRUE enables the autoincrement of the register
+ * value during the read cylce, SANE_FALSE disables this
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_IO_ERROR - system read function failed
+ * - SANE_STATUS_INVAL - register out of range
+ * - SANE_STATUS_EOF - if nothing can't be read
+ */
+extern SANE_Status sanei_lm983x_read( SANE_Int fd, SANE_Byte reg,
+ SANE_Byte *buffer, SANE_Word len,
+ SANE_Bool increment );
+
+/**
+ * Reset the LM983x chip.
+ *
+ * @param fd - device file descriptor
+ * @return
+ * - SANE_TRUE - reset successfuly done
+ * - SANE_FALSE - reset failed
+ */
+extern SANE_Bool sanei_lm983x_reset( SANE_Int fd );
+
+#endif /* sanei_lm983x_h */
+
diff --git a/include/sane/sanei_magic.h b/include/sane/sanei_magic.h
new file mode 100644
index 0000000..ab704a8
--- /dev/null
+++ b/include/sane/sanei_magic.h
@@ -0,0 +1,222 @@
+/* sane - Scanner Access Now Easy.
+
+ Copyright (C) 2009 m. allan noah
+
+ This file is part of the SANE package.
+
+ SANE 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.
+
+ SANE 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 sane; see the file COPYING. If not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+*/
+
+/** @file sanei_magic.h
+ * This file provides an interface to simple image post-processing functions
+ *
+ * Currently, three operations are provided:
+ * - Deskew (correct rotated scans, by detecting media edges)
+ * - Autocrop (reduce image size to minimum rectangle containing media)
+ * - Despeckle (replace dots of significantly different color with background)
+ * - Blank detection (check if density is over a threshold)
+ * - Rotate (detect and correct 90 degree increment rotations)
+ *
+ * Note that these functions are simplistic, and are expected to change.
+ * Patches and suggestions are welcome.
+ */
+
+#ifndef SANEI_MAGIC_H
+#define SANEI_MAGIC_H
+
+/** Initialize sanei_magic.
+ *
+ * Call this before any other sanei_magic function.
+ */
+extern void sanei_magic_init( void );
+
+/** Update the image buffer, replacing dots with surrounding background color
+ *
+ * @param params describes image
+ * @param buffer contains image data
+ * @param diam maximum dot diameter to remove
+ *
+ * @return
+ * - SANE_STATUS_GOOD - success
+ * - SANE_STATUS_INVAL - invalid image parameters
+ */
+extern SANE_Status
+sanei_magic_despeck (SANE_Parameters * params, SANE_Byte * buffer,
+ SANE_Int diam);
+
+/** Find the skew of the media inside the image, via edge detection.
+ *
+ * @param params describes image
+ * @param buffer contains image data
+ * @param dpiX horizontal resolution
+ * @param dpiY vertical resolution
+ * @param[out] centerX horizontal coordinate of center of rotation
+ * @param[out] centerY vertical coordinate of center of rotation
+ * @param[out] finSlope slope of rotation
+ *
+ * @return
+ * - SANE_STATUS_GOOD - success
+ * - SANE_STATUS_NO_MEM - not enough memory
+ * - SANE_STATUS_INVAL - invalid image parameters
+ * - SANE_STATUS_UNSUPPORTED - slope angle too shallow to detect
+ */
+extern SANE_Status
+sanei_magic_findSkew(SANE_Parameters * params, SANE_Byte * buffer,
+ int dpiX, int dpiY, int * centerX, int * centerY, double * finSlope);
+
+/** Correct the skew of the media inside the image, via simple rotation
+ *
+ * @param params describes image
+ * @param buffer contains image data
+ * @param centerX horizontal coordinate of center of rotation
+ * @param centerY vertical coordinate of center of rotation
+ * @param slope slope of rotation
+ * @param bg_color the replacement color for edges exposed by rotation
+ *
+ * @return
+ * - SANE_STATUS_GOOD - success
+ * - SANE_STATUS_NO_MEM - not enough memory
+ * - SANE_STATUS_INVAL - invalid image parameters
+ */
+extern SANE_Status
+sanei_magic_rotate (SANE_Parameters * params, SANE_Byte * buffer,
+ int centerX, int centerY, double slope, int bg_color);
+
+/** Find the edges of the media inside the image, parallel to image edges
+ *
+ * @param params describes image
+ * @param buffer contains image data
+ * @param dpiX horizontal resolution
+ * @param dpiY vertical resolution
+ * @param[out] top vertical offset to upper edge of media
+ * @param[out] bot vertical offset to lower edge of media
+ * @param[out] left horizontal offset to left edge of media
+ * @param[out] right horizontal offset to right edge of media
+ *
+ * @return
+ * - SANE_STATUS_GOOD - success
+ * - SANE_STATUS_NO_MEM - not enough memory
+ * - SANE_STATUS_UNSUPPORTED - edges could not be detected
+ */
+extern SANE_Status
+sanei_magic_findEdges(SANE_Parameters * params, SANE_Byte * buffer,
+ int dpiX, int dpiY, int * top, int * bot, int * left, int * right);
+
+/** Crop the image, parallel to image edges
+ *
+ * @param params describes image
+ * @param buffer contains image data
+ * @param top vertical offset to upper edge of crop
+ * @param bot vertical offset to lower edge of crop
+ * @param left horizontal offset to left edge of crop
+ * @param right horizontal offset to right edge of crop
+ *
+ * @return
+ * - SANE_STATUS_GOOD - success
+ * - SANE_STATUS_NO_MEM - not enough memory
+ * - SANE_STATUS_INVAL - invalid image parameters
+ */
+extern SANE_Status
+sanei_magic_crop(SANE_Parameters * params, SANE_Byte * buffer,
+ int top, int bot, int left, int right);
+
+/** Determine if image is blank
+ *
+ * @param params describes image
+ * @param buffer contains image data
+ * @param thresh maximum % density for blankness (0-100)
+ *
+ * @return
+ * - SANE_STATUS_GOOD - page is not blank
+ * - SANE_STATUS_NO_DOCS - page is blank
+ * - SANE_STATUS_NO_MEM - not enough memory
+ * - SANE_STATUS_INVAL - invalid image parameters
+ */
+extern SANE_Status
+sanei_magic_isBlank(SANE_Parameters * params, SANE_Byte * buffer,
+ double thresh);
+
+/** Determine if image is blank, enhanced version
+ *
+ * @param params describes image
+ * @param buffer contains image data
+ * @param dpiX horizontal resolution
+ * @param dpiY vertical resolution
+ * @param thresh maximum % density for blankness (0-100)
+ *
+ * @return
+ * - SANE_STATUS_GOOD - page is not blank
+ * - SANE_STATUS_NO_DOCS - page is blank
+ * - SANE_STATUS_NO_MEM - not enough memory
+ * - SANE_STATUS_INVAL - invalid image parameters
+ */
+extern SANE_Status
+sanei_magic_isBlank2(SANE_Parameters * params, SANE_Byte * buffer,
+ int dpiX, int dpiY, double thresh);
+
+/** Determine coarse image rotation (90 degree increments)
+ *
+ * @param params describes image
+ * @param buffer contains image data
+ * @param dpiX horizontal resolution
+ * @param dpiY vertical resolution
+ * @param[out] angle amount of rotation recommended
+ *
+ * @return
+ * - SANE_STATUS_GOOD - success
+ * - SANE_STATUS_NO_MEM - not enough memory
+ * - SANE_STATUS_INVAL - invalid image parameters
+ */
+extern SANE_Status
+sanei_magic_findTurn(SANE_Parameters * params, SANE_Byte * buffer,
+ int dpiX, int dpiY, int * angle);
+
+/** Coarse image rotation (90 degree increments)
+ *
+ * @param params describes image
+ * @param buffer contains image data
+ * @param angle amount of rotation requested (multiple of 90)
+ *
+ * @return
+ * - SANE_STATUS_GOOD - success
+ * - SANE_STATUS_NO_MEM - not enough memory
+ * - SANE_STATUS_INVAL - invalid image or angle parameters
+ */
+extern SANE_Status
+sanei_magic_turn(SANE_Parameters * params, SANE_Byte * buffer,
+ int angle);
+
+#endif /* SANEI_MAGIC_H */
diff --git a/include/sane/sanei_net.h b/include/sane/sanei_net.h
new file mode 100644
index 0000000..213d0be
--- /dev/null
+++ b/include/sane/sanei_net.h
@@ -0,0 +1,144 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 1997-1999 David Mosberger-Tang and Andreas Beck
+ This file is part of the SANE package.
+
+ This file is in the public domain. You may use and modify it as
+ you see fit, as long as this copyright message is included and
+ that there is an indication as to what modifications have been
+ made (if any).
+
+ SANE 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.
+
+ This file declares SANE application interface. See the SANE
+ standard for a detailed explanation of the interface. */
+
+#ifndef sanei_net_h
+#define sanei_net_h
+
+#include <sane/sane.h>
+#include <sane/sanei_wire.h>
+
+#define SANEI_NET_PROTOCOL_VERSION 3
+
+typedef enum
+ {
+ SANE_NET_LITTLE_ENDIAN = 0x1234,
+ SANE_NET_BIG_ENDIAN = 0x4321
+ }
+SANE_Net_Byte_Order;
+
+typedef enum
+ {
+ SANE_NET_INIT = 0,
+ SANE_NET_GET_DEVICES,
+ SANE_NET_OPEN,
+ SANE_NET_CLOSE,
+ SANE_NET_GET_OPTION_DESCRIPTORS,
+ SANE_NET_CONTROL_OPTION,
+ SANE_NET_GET_PARAMETERS,
+ SANE_NET_START,
+ SANE_NET_CANCEL,
+ SANE_NET_AUTHORIZE,
+ SANE_NET_EXIT
+ }
+SANE_Net_Procedure_Number;
+
+typedef struct
+ {
+ SANE_Word version_code;
+ SANE_String username;
+ }
+SANE_Init_Req;
+
+typedef struct
+ {
+ SANE_Status status;
+ SANE_Word version_code;
+ }
+SANE_Init_Reply;
+
+typedef struct
+ {
+ SANE_Status status;
+ SANE_Device **device_list;
+ }
+SANE_Get_Devices_Reply;
+
+typedef struct
+ {
+ SANE_Status status;
+ SANE_Word handle;
+ SANE_String resource_to_authorize;
+ }
+SANE_Open_Reply;
+
+typedef struct
+ {
+ SANE_Word num_options;
+ SANE_Option_Descriptor **desc;
+ }
+SANE_Option_Descriptor_Array;
+
+typedef struct
+ {
+ SANE_Word handle;
+ SANE_Word option;
+ SANE_Word action;
+ SANE_Word value_type;
+ SANE_Word value_size;
+ void *value;
+ }
+SANE_Control_Option_Req;
+
+typedef struct
+ {
+ SANE_Status status;
+ SANE_Word info;
+ SANE_Word value_type;
+ SANE_Word value_size;
+ void *value;
+ SANE_String resource_to_authorize;
+ }
+SANE_Control_Option_Reply;
+
+typedef struct
+ {
+ SANE_Status status;
+ SANE_Parameters params;
+ }
+SANE_Get_Parameters_Reply;
+
+typedef struct
+ {
+ SANE_Status status;
+ SANE_Word port;
+ SANE_Word byte_order;
+ SANE_String resource_to_authorize;
+ }
+SANE_Start_Reply;
+
+typedef struct
+ {
+ SANE_String resource;
+ SANE_String username;
+ SANE_String password;
+ }
+SANE_Authorization_Req;
+
+extern void sanei_w_init_req (Wire *w, SANE_Init_Req *req);
+extern void sanei_w_init_reply (Wire *w, SANE_Init_Reply *reply);
+extern void sanei_w_get_devices_reply (Wire *w, SANE_Get_Devices_Reply *reply);
+extern void sanei_w_open_reply (Wire *w, SANE_Open_Reply *reply);
+extern void sanei_w_option_descriptor_array (Wire *w,
+ SANE_Option_Descriptor_Array *opt);
+extern void sanei_w_control_option_req (Wire *w, SANE_Control_Option_Req *req);
+extern void sanei_w_control_option_reply (Wire *w,
+ SANE_Control_Option_Reply *reply);
+extern void sanei_w_get_parameters_reply (Wire *w,
+ SANE_Get_Parameters_Reply *reply);
+extern void sanei_w_start_reply (Wire *w, SANE_Start_Reply *reply);
+extern void sanei_w_authorization_req (Wire *w, SANE_Authorization_Req *req);
+
+#endif /* sanei_net_h */
diff --git a/include/sane/sanei_pa4s2.h b/include/sane/sanei_pa4s2.h
new file mode 100644
index 0000000..c5394a8
--- /dev/null
+++ b/include/sane/sanei_pa4s2.h
@@ -0,0 +1,220 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 2000-2003 Jochen Eisinger <jochen.eisinger@gmx.net>
+ This file is part of the SANE package.
+
+ 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., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+*/
+
+/** @file sanei_pa4s2.h
+ * This file implements an interface for the Mustek PP chipset A4S2
+ *
+ * @sa sanei_usb.h, sanei_ab306.h, sanei_lm983x.h, sanei_scsi.h, sanei_pio.h
+ */
+
+#ifndef sanei_pa4s2_h
+#define sanei_pa4s2_h
+
+#include <sys/types.h>
+#include <sane/sane.h>
+
+/** @name Options to control interface operations */
+/* @{ */
+#define SANEI_PA4S2_OPT_DEFAULT 0 /* normal mode */
+#define SANEI_PA4S2_OPT_TRY_MODE_UNI 1 /* enable UNI protocoll */
+#define SANEI_PA4S2_OPT_ALT_LOCK 2 /* use alternative lock cmd */
+#define SANEI_PA4S2_OPT_NO_EPP 4 /* do not try to use EPP */
+/* @} */
+
+/** Get list of possibly available devices
+ *
+ * Returns a list of arguments accepted as *dev by sanei_pa4s2_open
+ *
+ * @return
+ * - array of known *devs. The last entry is marked as NULL pointer. The
+ * user has to make sure, the array, but not the entries are freed.
+ *
+ * @sa sanei_pa4s2_open
+ *
+ */
+extern const char ** sanei_pa4s2_devices(void);
+
+/** Open pa4s2 device
+ *
+ * Opens *dev as pa4s2 device.
+ *
+ * @param dev IO port address ("0x378", "0x278", or "0x3BC")
+ * @param fd file descriptor
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_INVAL - if no scanner was found or the port number was wrong
+ * - SANE_STATUS_DEVICE_BUSY - if the device is already in use
+ * - SANE_STATUS_IO_ERROR - if the port couldn't be accessed
+ *
+ */
+extern SANE_Status sanei_pa4s2_open (const char *dev, int *fd);
+
+/** Open pa4s2 SCSI-over-parallel device
+ *
+ * Opens *dev as pa4s2 SCSI-over-parallel device.
+ *
+ * @param dev IO port address ("0x378", "0x278", or "0x3BC")
+ * @param fd file descriptor
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_INVAL - if no scanner was found or the port number was wrong
+ * - SANE_STATUS_DEVICE_BUSY - if the device is already in use
+ * - SANE_STATUS_IO_ERROR - if the port couldn't be accessed
+ *
+ */
+extern SANE_Status sanei_pa4s2_scsi_pp_open (const char *dev, int *fd);
+
+/** Close pa4s2 device
+ *
+ * @param fd file descriptor
+ */
+extern void sanei_pa4s2_close (int fd);
+
+/** Set/get options
+ *
+ * Sets/gets interface options. Options will be taken over, when set is
+ * SANE_TRUE. These options should be set before the first device is opened
+ *
+ * @param options pointer to options
+ * @param set set (SANE_TRUE) or get (SANE_FALSE) options
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ */
+extern SANE_Status sanei_pa4s2_options (u_int * options, int set);
+
+/** Enables/disable device
+ *
+ * When the device is disabled, the printer can be accessed, when it's enabled
+ * data can be read/written.
+ *
+ * @param fd file descriptor
+ * @param enable enable (SANE_TRUE) or disable (SANE_FALSE) device
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_INVAL - if fd is invalid or device not in use
+ */
+extern SANE_Status sanei_pa4s2_enable (int fd, int enable);
+
+/** Select a register
+ *
+ * The function to read a register is split up in three parts, so a register
+ * can be read more than once.
+ *
+ * @param fd file descriptor
+ * @param reg register
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_INVAL - if fd is invalid or device not in use
+ *
+ * @sa sanei_pa4s2_readbyte(), sanei_pa4s2_readend()
+ */
+extern SANE_Status sanei_pa4s2_readbegin (int fd, u_char reg);
+
+/** Return port status information
+ *
+ * @param fd file descriptor
+ * @param status variable to receive status
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_INVAL - if fd is invalid or device not in use
+ */
+extern SANE_Status sanei_pa4s2_scsi_pp_get_status (int fd, u_char *status);
+
+/** Selects a register number on a SCSI-over-parallel scanner
+ *
+ * @param fd file descriptor
+ * @param reg register number
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_INVAL - if fd is invalid
+ */
+extern SANE_Status sanei_pa4s2_scsi_pp_reg_select (int fd, int reg);
+
+/** Read a register
+ *
+ * The function to read a register is split up in three parts, so a register
+ * can be read more than once.
+ *
+ * @param fd file descriptor
+ * @param val pointer to value
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_INVAL - if fd is invalid or device not in use
+ *
+ * @sa sanei_pa4s2_readbegin(), sanei_pa4s2_readend()
+ */
+extern SANE_Status sanei_pa4s2_readbyte (int fd, u_char * val);
+
+/** Terminate reading sequence
+ *
+ * The function to read a register is split up in three parts, so a register
+ * can be read more than once.
+ *
+ * @param fd file descriptor
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_INVAL - if fd is invalid or device not in use
+ * @sa sanei_pa4s2_readbegin(), sanei_pa4s2_readbyte()
+ */
+extern SANE_Status sanei_pa4s2_readend (int fd);
+
+/** Write a register
+ *
+ * @param fd file descriptor
+ * @param reg register
+ * @param val value to be written
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_INVAL - if fd is invalid or device not in use
+ */
+extern SANE_Status sanei_pa4s2_writebyte (int fd, u_char reg, u_char val);
+
+#endif
diff --git a/include/sane/sanei_pio.h b/include/sane/sanei_pio.h
new file mode 100644
index 0000000..61ac414
--- /dev/null
+++ b/include/sane/sanei_pio.h
@@ -0,0 +1,55 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 1998 Christian Bucher
+ Copyright (C) 1998 Kling & Hautzinger GmbH
+ This file is part of the SANE package.
+
+ 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., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice. */
+
+#ifndef sanei_pio_h
+#define sanei_pio_h
+
+#include <sys/types.h>
+
+#include <sane/sane.h>
+
+extern SANE_Status sanei_pio_open (const char * dev, int * fd);
+extern void sanei_pio_close (int fd);
+extern int sanei_pio_read (int fd, u_char * buf, int n);
+extern int sanei_pio_write (int fd, const u_char * buf, int n);
+
+#endif /* sanei_pio_h */
+
diff --git a/include/sane/sanei_pp.h b/include/sane/sanei_pp.h
new file mode 100644
index 0000000..d3e7b92
--- /dev/null
+++ b/include/sane/sanei_pp.h
@@ -0,0 +1,172 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 2003 Gerhard Jaeger <gerhard@gjaeger.de>
+ This file is part of the SANE package.
+
+ 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., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+*/
+
+/** @file sanei_pp.h
+ * This file implements an interface for accessing the parallel-port
+ *
+ * @sa sanei_pp.h
+ */
+#ifndef sanei_pp_h
+#define sanei_pp_h
+
+#include <sys/types.h>
+#include <sane/sane.h>
+
+/** some modes, we'd like to see/use. */
+enum sanei_pp_mode {
+ SANEI_PP_MODE_SPP = (1<<1), /**< SPP */
+ SANEI_PP_MODE_BIDI = (1<<2), /**< BIDI */
+ SANEI_PP_MODE_EPP = (1<<4), /**< EPP */
+ SANEI_PP_MODE_ECP = (1<<8) /**< ECP */
+};
+
+#define SANEI_PP_DATAIN 1
+#define SANEI_PP_DATAOUT 0
+
+/* @{ */
+/** Parallelport Control-Register definitions */
+#define SANEI_PP_CTRL_STROBE 0x01
+#define SANEI_PP_CTRL_AUTOLF 0x02
+#define SANEI_PP_CTRL_NOT_INIT 0x04
+#define SANEI_PP_CTRL_SELECT_IN 0x08
+#define SANEI_PP_CTRL_ENABLE_IRQ 0x10
+#define SANEI_PP_CTRL_DIRECTION 0x20
+#define SANEI_PP_CTRL_RESERVED 0xc0
+/* @} */
+
+/** Initialize sanei_pp.
+ *
+ * This function must be called before any other sanei_pp function.
+ */
+extern SANE_Status sanei_pp_init( void );
+
+/** Open a parport device.
+ *
+ * @param dev - name of device to open.
+ * @param fd - pointer to variable that should revceive the handle.
+ * @return
+ */
+extern SANE_Status sanei_pp_open( const char *dev, int *fd );
+
+/* Close a previously opened parport device.
+ *
+ * @param fd - handle of the device to close
+ */
+extern void sanei_pp_close( int fd );
+
+/** Claim a parport device
+ *
+ * @param fd - handle of the device to claim
+ * @return
+ */
+extern SANE_Status sanei_pp_claim( int fd );
+
+/** Release a previously claimed device
+ *
+ * @param fd - handle of the device to release
+ * @return
+ */
+extern SANE_Status sanei_pp_release( int fd );
+
+/** Set the data direction
+ *
+ * @param fd - handle of the device, where to change the direction.
+ * @param rev -
+ * @return SANE_STATUS_GOOD on success
+ */
+extern SANE_Status sanei_pp_set_datadir( int fd, int rev );
+
+/** Check whether for libieee1284 usage.
+ *
+ * This function can be used to check if the lib uses libieee1284 or
+ * in/out functions directly.
+ *
+ * @return SANE_TRUE if we use direct access, SANE_FALSE if the lib uses
+ * libieee1284 functions.
+ */
+extern SANE_Bool sanei_pp_uses_directio( void );
+
+/** Determine the available parallel port modes for a given device.
+ *
+ * @param fd - handle of the device, whose modes shall be checked for.
+ * @param mode - pointer to variable, which should receive the modes.
+ * @return SANE_STATUS_GOOD on success.
+ */
+extern SANE_Status sanei_pp_getmodes( int fd, int *mode );
+
+/** Set the operation mode for a given device.
+ *
+ * @param fd - handle of the device, whose modes shall be set.
+ * @param mode - mode to set, see sanei_pp_mode.
+ * @return SANE_STATUS_GOOD on success.
+ */
+extern SANE_Status sanei_pp_setmode( int fd, int mode );
+
+/** Write data to ports (spp-data, ctrl, epp-address and epp-data)
+ *
+ * @param fd - handle of device to which shall be written to.
+ * @param val - data to write.
+ * @return SANE_STATUS_GOOD on success.
+ */
+extern SANE_Status sanei_pp_outb_data( int fd, SANE_Byte val );
+extern SANE_Status sanei_pp_outb_ctrl( int fd, SANE_Byte val );
+extern SANE_Status sanei_pp_outb_addr( int fd, SANE_Byte val );
+extern SANE_Status sanei_pp_outb_epp ( int fd, SANE_Byte val );
+
+/** Read data from ports (spp-data, status, ctrl and epp-data)
+ * @param fd - handle of device who should be read from.
+ * @return value got from port
+ */
+extern SANE_Byte sanei_pp_inb_data( int fd );
+extern SANE_Byte sanei_pp_inb_stat( int fd );
+extern SANE_Byte sanei_pp_inb_ctrl( int fd );
+extern SANE_Byte sanei_pp_inb_epp ( int fd );
+
+/** Delay execution for some micro-seconds.
+ * Please not, that the accuracy highly depends on your system architechture
+ * and the time to delay. It is internally implemented as system calls to
+ * gettimeofday().
+ *
+ * @param usec - number of micro-seconds to delay
+ */
+extern void sanei_pp_udelay( unsigned long usec );
+
+#endif
diff --git a/include/sane/sanei_pv8630.h b/include/sane/sanei_pv8630.h
new file mode 100644
index 0000000..ef7e9dd
--- /dev/null
+++ b/include/sane/sanei_pv8630.h
@@ -0,0 +1,96 @@
+/* sane - Scanner Access Now Easy.
+
+ Copyright (C) 2000 Adrian Perez Jorge
+ Copyright (C) 2001 Frank Zago
+ Copyright (C) 2001 Marcio Teixeira
+
+ This file is part of the SANE package.
+
+ 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., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+
+ Interface files for the PowerVision 8630 chip, a USB to
+ parallel converter used in many scanners.
+
+ */
+
+#ifndef sanei_pv8630_h
+#define sanei_pv8630_h
+
+#include "../include/sane/config.h"
+#include "../include/sane/sane.h"
+
+typedef enum
+{
+ PV8630_REQ_READBYTE = 0x00,
+ PV8630_REQ_WRITEBYTE = 0x01,
+ PV8630_REQ_EPPBULKREAD = 0x02,
+ PV8630_REQ_EPPBULKWRITE = 0x03,
+ PV8630_REQ_FLUSHBUFFER = 0x04,
+ PV8630_REQ_ENABLEINTERRUPT = 0x05,
+ PV8630_REQ_DISABLEINTERRUPT = 0x06,
+ PV8630_REQ_READWORD = 0x08,
+ PV8630_REQ_WRITEWORD = 0x09
+}
+SANEI_PV_Request;
+
+typedef enum
+{
+ PV8630_RDATA = 0x00,
+ PV8630_REPPADDRESS = 0x01,
+ PV8630_UNKNOWN = 0x02,
+ PV8630_RMODE = 0x03,
+ PV8630_RSTATUS = 0x04
+}
+SANEI_PV_Index;
+
+extern void sanei_pv8630_init (void);
+extern SANE_Status sanei_pv8630_write_byte (int fd, SANEI_PV_Index index,
+ SANE_Byte byte);
+extern SANE_Status sanei_pv8630_read_byte (int fd, SANEI_PV_Index index,
+ SANE_Byte * byte);
+extern SANE_Status sanei_pv8630_prep_bulkread (int fd, int len);
+extern SANE_Status sanei_pv8630_prep_bulkwrite (int fd, int len);
+extern SANE_Status sanei_pv8630_flush_buffer (int fd);
+extern SANE_Status sanei_pv8630_bulkwrite (int fd, const void *data,
+ size_t * len);
+extern SANE_Status sanei_pv8630_bulkread (int fd, void *data, size_t * len);
+extern SANE_Status sanei_pv8630_xpect_byte (int fd, SANEI_PV_Index index,
+ SANE_Byte value, SANE_Byte mask);
+extern SANE_Status sanei_pv8630_wait_byte (int fd, SANEI_PV_Index index,
+ SANE_Byte value, SANE_Byte mask,
+ int timeout);
+#endif /* sanei_pv8630_h */
diff --git a/include/sane/sanei_scsi.h b/include/sane/sanei_scsi.h
new file mode 100644
index 0000000..d69fd0f
--- /dev/null
+++ b/include/sane/sanei_scsi.h
@@ -0,0 +1,329 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 1996, 1997 David Mosberger-Tang
+ This file is part of the SANE package.
+
+ SANE 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.
+
+ SANE 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 sane; see the file COPYING. If not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+*/
+
+/** @file sanei_scsi.h
+ * Generic interface to SCSI drivers.
+ * @sa sanei_usb.h, sanei_ab306.h,sanei_lm983x.h, sanei_pa4s2.h, sanei_pio.h,
+ * and man sane-scsi(5) for user-oriented documentation
+ */
+
+#ifndef sanei_scsi_h
+#define sanei_scsi_h
+
+#include <sys/types.h>
+
+#include <sane/sane.h>
+#include <sane/config.h>
+
+/** Sense handler
+ *
+ * The sense handler can be implemented in backends. It's for deciding
+ * which sense codes should be considered an error and which shouldn't.
+ *
+ * @param fd file descriptor
+ * @param sense_buffer pointer to buffer containing sense codes
+ * @param arg pointer to data buffer
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success (sense isn't regarded as error)
+ * - any other status if sense code is regarded as error
+ */
+typedef SANE_Status (*SANEI_SCSI_Sense_Handler) (int fd,
+ u_char *sense_buffer,
+ void *arg);
+/** Maximum size of a SCSI request
+ */
+extern int sanei_scsi_max_request_size;
+
+/** Find SCSI devices.
+ *
+ * Find each SCSI device that matches the pattern specified by the
+ * arguments. String arguments can be "omitted" by passing NULL,
+ * integer arguments can be "omitted" by passing -1.
+ *
+ * Example: vendor="HP" model=NULL, type=NULL, bus=3, id=-1, lun=-1 would
+ * attach all HP devices on SCSI bus 3.
+ *
+ * @param vendor
+ * @param model
+ * @param type
+ * @param bus
+ * @param channel
+ * @param id
+ * @param lun
+ * @param attach callback invoked once for each device, dev is the real devicename (passed to attach callback)
+ *
+ */
+extern void sanei_scsi_find_devices (const char *vendor, const char *model,
+ const char *type,
+ int bus, int channel, int id, int lun,
+ SANE_Status (*attach) (const char *dev));
+
+
+/** Open a SCSI device
+ *
+ * Opens a SCSI device by its device filename and returns a file descriptor.
+ * If it's necessary to adjust the SCSI buffer size, use
+ * sanei_scsi_open_extended().
+ *
+ * @param device_name name of the devicefile, e.g. "/dev/sg0"
+ * @param fd file descriptor
+ * @param sense_handler called whenever the SCSI driver returns a sense buffer
+ * @param sense_arg pointer to data for the sense handler
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_ACCESS_DENIED - if the file couldn't be accessed due to
+ * permissions
+ * - SANE_STATUS_NO_MEM - if malloc failed (not enough memory)
+ * - SANE_STATUS_INVAL - if the filename was invalid or an unknown error occured
+ *
+ * @sa sanei_scsi_open_extended(), HAVE_SANEI_SCSI_OPEN_EXTENDED
+ */
+extern SANE_Status sanei_scsi_open (const char * device_name, int * fd,
+ SANEI_SCSI_Sense_Handler sense_handler,
+ void *sense_arg);
+
+/** Open a SCSI device and set the buffer size
+ *
+ * The extended open call allows a backend to ask for a specific buffer
+ * size. sanei_scsi_open_extended() tries to allocate a buffer of the size
+ * given by *buffersize upon entry to this function. If
+ * sanei_scsi_open_extended returns successfully, *buffersize contains the
+ * available buffer size. This value may be both smaller or larger than the
+ * value requested by the backend; it can even be zero. The backend must
+ * decide, if it got enough buffer memory to work.
+ *
+ * Note that the value of *buffersize may differ for different files.
+ *
+ * @param device_name name of the devicefile, e.g. "/dev/sg0"
+ * @param fd file descriptor
+ * @param sense_handler called whenever the SCSI driver returns a sense buffer
+ * @param sense_arg pointer to data for the sense handler
+ * @param buffersize size of the SCAI request buffer (in bytes)
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_ACCESS_DENIED - if the file couldn't be accessed due to
+ * permissions
+ * - SANE_STATUS_NO_MEM - if malloc failed (not enough memory)
+ * - SANE_STATUS_INVAL - if the filename was invalid or an unknown error occured
+ *
+ * @sa sanei_scsi_open(), HAVE_SANEI_SCSI_OPEN_EXTENDED
+ */
+extern SANE_Status sanei_scsi_open_extended (
+ const char * device_name, int * fd,
+ SANEI_SCSI_Sense_Handler sense_handler,
+ void *sense_arg, int *buffersize);
+
+/** Do we have sanei_scsi_open_extended()?
+ *
+ * Let backends decide, which open call to use: if
+ * HAVE_SANEI_SCSI_OPEN_EXTENDED is defined, sanei_scsi_open_extended may be
+ * used. May also be used to decide, if sanei_scsi_req_flush_all or
+ * sanei_scsi_req_flush_all_extended() should be used.
+ *
+ * @sa sanei_scsi_open(), sanei_scsi_open_extended()
+*/
+#define HAVE_SANEI_SCSI_OPEN_EXTENDED
+
+/** Enqueue SCSI command
+ *
+ * One or more scsi commands can be enqueued by calling sanei_scsi_req_enter().
+ *
+ * NOTE: Some systems may not support multiple outstanding commands. On such
+ * systems, sanei_scsi_req_enter() may block. In other words, it is not proper
+ * to assume that enter() is a non-blocking routine.
+ *
+ * @param fd file descriptor
+ * @param src pointer to the SCSI command and associated write data (if any)
+ * @param src_size length of the command and data
+ * @param dst pointer to a buffer in which data is returned; NULL if no data is
+ * returned
+ * @param dst_size on input, the size of the buffer pointed to by dst, on exit,
+ * set to the number of bytes returned in the buffer (which is less than or equal
+ * to the buffer size; may be NULL if no data is expected
+ * @param idp pointer to a void* that uniquely identifies the entered request
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_IO_ERROR - if an error was received from the SCSI driver
+ * - SANE_STATUS_NO_MEM - if malloc failed (not enough memory)
+ * - SANE_STATUS_INVAL - if a locking or an unknown error occured
+ * @sa sanei_scsi_req_enter2()
+ *
+*/
+extern SANE_Status sanei_scsi_req_enter (int fd,
+ const void * src, size_t src_size,
+ void * dst, size_t * dst_size,
+ void **idp);
+
+/** Enqueue SCSI command and separated data
+ *
+ * Same as sanei_scsi_req_enter(), but with separate buffers for the SCSI
+ * command and for the data to be sent to the device.
+ *
+ * With sanei_scsi_req_enter(), the length of te SCSI command block must be
+ * guessed. While that works in most cases, Canon scanners for example use the
+ * vendor specific commands 0xd4, 0xd5 and 0xd6. The Canon scanners want to
+ * get 6 byte command blocks for these commands, but sanei_scsi_req_enter() and
+ * sanei_scsi_cmd() send 12 bytes.
+ *
+ * If dst_size and *dst_size are non-zero, a "read command" (ie, data transfer
+ * from the device to the host) is assumed.
+ *
+ * @param fd file descriptor
+ * @param cmd pointer to SCSI command
+ * @param cmd_size size of the command
+ * @param src pointer to the buffer with data to be sent to the scanner
+ * @param src_size size of src buffer
+ * @param dst pointer to a buffer in which data is returned; NULL if no data is
+ * returned
+ * @param dst_size on input, the size of the buffer pointed to by dst, on exit,
+ * set to the number of bytes returned in the buffer (which is less than or equal
+ * to the buffer size; may be NULL if no data is expected
+ * @param idp pointer to a void* that uniquely identifies the entered request
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_IO_ERROR - if an error was received from the SCSI driver
+ * - SANE_STATUS_NO_MEM - if malloc failed (not enough memory)
+ * - SANE_STATUS_INVAL - if a locking or an unknown error occured
+ * @sa sanei_scsi_req_enter()
+ */
+extern SANE_Status sanei_scsi_req_enter2 (int fd,
+ const void * cmd, size_t cmd_size,
+ const void * src, size_t src_size,
+ void * dst, size_t * dst_size,
+ void **idp);
+
+/** Wait for SCSI command
+ *
+ * Wait for the completion of the SCSI command with id ID.
+ *
+ * @param id id used in sanei_scsi_req_enter()
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_DEVICE_BUSY - if the device is busy (try again later)
+ * - SANE_STATUS_IO_ERROR - if an error was received from the SCSI driver
+*/
+extern SANE_Status sanei_scsi_req_wait (void *id);
+
+/** Send SCSI command
+ *
+ * This is a convenience function that is equivalent to a pair of
+ * sanei_scsi_req_enter()/sanei_scsi_req_wait() calls.
+ *
+ * @param fd file descriptor
+ * @param src pointer to the SCSI command and associated write data (if any)
+ * @param src_size length of the command and data
+ * @param dst pointer to a buffer in which data is returned; NULL if no data is
+ * returned
+ * @param dst_size on input, the size of the buffer pointed to by dst, on exit,
+ * set to the number of bytes returned in the buffer (which is less than or equal
+ * to the buffer size; may be NULL if no data is expected
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_IO_ERROR - if an error was received from the SCSI driver
+ * - SANE_STATUS_NO_MEM - if malloc failed (not enough memory)
+ * - SANE_STATUS_INVAL - if a locking or an unknown error occured
+ *
+ * @sa sanei_scsi_cmd2(), sanei_scsi_req_enter(), sanei_scsi_req_wait()
+ */
+extern SANE_Status sanei_scsi_cmd (int fd,
+ const void * src, size_t src_size,
+ void * dst, size_t * dst_size);
+
+/** Send SCSI command and separated data
+ *
+ * This is a convenience function that is equivalent to a pair of
+ * sanei_scsi_req_enter2()/sanei_scsi_req_wait() calls.
+ *
+ * @param fd file descriptor
+ * @param cmd pointer to SCSI command
+ * @param cmd_size size of the command
+ * @param src pointer to the buffer with data to be sent to the scanner
+ * @param src_size size of src buffer
+ * @param dst pointer to a buffer in which data is returned; NULL if no data is
+ * returned
+ * @param dst_size on input, the size of the buffer pointed to by dst, on exit,
+ * set to the number of bytes returned in the buffer (which is less than or equal
+ * to the buffer size; may be NULL if no data is expected
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_IO_ERROR - if an error was received from the SCSI driver
+ * - SANE_STATUS_NO_MEM - if malloc failed (not enough memory)
+ * - SANE_STATUS_INVAL - if a locking or an unknown error occured
+ *
+ * @sa sanei_scsi_cmd(), sanei_scsi_req_enter(), sanei_scsi_req_wait()
+ */
+extern SANE_Status sanei_scsi_cmd2 (int fd,
+ const void * cmd, size_t cmd_size,
+ const void * src, size_t src_size,
+ void * dst, size_t * dst_size);
+
+/** Flush queue
+ *
+ * Flush all pending SCSI commands. This function work only, if zero or one
+ * SCSI file handles are open.
+ *
+ * @sa sanei_scsi_req_flush_all_extended()
+*/
+extern void sanei_scsi_req_flush_all (void);
+
+/** Flush queue for handle
+ *
+ * Flush all SCSI commands pending for one handle
+ *
+ * @param fd file descriptor
+ *
+ * @sa sanei_scsi_req_flush_all()
+ */
+extern void sanei_scsi_req_flush_all_extended (int fd);
+
+/** Close a SCSI device
+ *
+ * @param fd file descriptor
+ *
+ */
+extern void sanei_scsi_close (int fd);
+
+#endif /* sanei_scsi_h */
diff --git a/include/sane/sanei_tcp.h b/include/sane/sanei_tcp.h
new file mode 100644
index 0000000..0c3aeb4
--- /dev/null
+++ b/include/sane/sanei_tcp.h
@@ -0,0 +1,37 @@
+/* sane - Scanner Access Now Easy.
+ * Copyright (C) 2006 Tower Technologies
+ * Author: Alessandro Zummo <a.zummo@towertech.it>
+ * This file is part of the SANE package.
+ *
+ * This file is in the public domain. You may use and modify it as
+ * you see fit, as long as this copyright message is included and
+ * that there is an indication as to what modifications have been
+ * made (if any).
+ *
+ * SANE 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.
+ *
+ * Header file for TCP/IP communications.
+ */
+
+#ifndef sanei_tcp_h
+#define sanei_tcp_h
+
+#include <sane/sane.h>
+
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <netinet/in.h>
+#include <netdb.h>
+#endif
+#include <sys/types.h>
+
+extern SANE_Status sanei_tcp_open(const char *host, int port, int *fdp);
+extern void sanei_tcp_close(int fd);
+extern ssize_t sanei_tcp_write(int fd, const u_char * buf, int count);
+extern ssize_t sanei_tcp_read(int fd, u_char * buf, int count);
+
+#endif /* sanei_tcp_h */
diff --git a/include/sane/sanei_thread.h b/include/sane/sanei_thread.h
new file mode 100644
index 0000000..f152c93
--- /dev/null
+++ b/include/sane/sanei_thread.h
@@ -0,0 +1,164 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 1998-2001 Yuri Dario
+ Copyright (C) 2002-2003 Henning Meier-Geinitz (documentation)
+ Copyright (C) 2003-2004 Gerhard Jaeger (pthread/process support)
+ This file is part of the SANE package.
+
+ SANE 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.
+
+ SANE 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 sane; see the file COPYING. If not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+
+*/
+
+/** @file sanei_thread.h
+ * Support for forking processes and threading.
+ *
+ * Backends should not use fork() directly because fork() does not work
+ * correctly on some platforms. Use the functions provided by sanei_thread
+ * instead. The build system decides if fork() or threads are used.
+ *
+ * Please keep in mind that the behaviour of the child process depends
+ * on if it's a process or thread especially concerning variables.
+ *
+ * In this file we use "task" as an umbrella term for process and thread.
+ *
+ * @sa sanei.h sanei_backend.h
+ */
+
+#ifndef sanei_thread_h
+#define sanei_thread_h
+#include "../include/sane/config.h"
+
+#ifdef USE_PTHREAD
+typedef pthread_t SANE_Pid;
+#else
+typedef int SANE_Pid;
+#endif
+
+/** Initialize sanei_thread.
+ *
+ * This function must be called before any other sanei_thread function.
+ */
+extern void sanei_thread_init (void);
+
+/** Do we use processes or threads?
+ *
+ * This function can be used to check if processes or threads are used.
+ *
+ * @return
+ * - SANE_TRUE - if processes are used (fork)
+ * - SANE_FALSE - i threads are used
+ */
+extern SANE_Bool sanei_thread_is_forked (void);
+
+/** Is SANE_Pid valid pid?
+ *
+ * This function can be used to check if thread/fork creation worked
+ * regardless of SANE_Pid's data type.
+ *
+ * @return
+ * - SANE_TRUE - if pid is not a valid process
+ * - SANE_FALSE - if pid is a valid process
+ */
+extern SANE_Bool sanei_thread_is_invalid (SANE_Pid pid);
+
+/** Spawn a new task.
+ *
+ * This function should be used to start a new task.
+ *
+ * @param func() function to call as child task
+ * @param args argument of the function (only one!)
+ *
+ * @return
+ * - task id
+ * - -1 if creating the new task failed
+ */
+extern SANE_Pid sanei_thread_begin (int (*func) (void *args), void *args);
+
+/** Terminate spawned task.
+ *
+ * This function terminates the task that was created with sanei_thread_begin.
+ *
+ * For processes, SIGTERM is sent. If threads are used, pthread_cancel()
+ * terminates the task.
+ *
+ * @param pid - the id of the task
+ *
+ * @return
+ * - 0 on success
+ * - any other value if an error occured while terminating the task
+ */
+extern int sanei_thread_kill (SANE_Pid pid);
+
+/** Send a signal to a task.
+ *
+ * This function can be used to send a signal to a task.
+ *
+ * For terminating the task, sanei_thread_kill() should be used.
+ *
+ * @param pid - the id of the task
+ * @param sig - the signal to send
+ *
+ * @return
+ * - 0 - on success
+ * - any other value - if an error occured while sending the signal
+ */
+extern int sanei_thread_sendsig (SANE_Pid pid, int sig);
+
+/** Wait for task termination.
+ *
+ * This function waits until a task that has been terminated by
+ * sanei_thread_kill(), sanei_thread_sendsys() or by any other means
+ * is finished.
+ *
+ * @param pid - the id of the task
+ * @param status - status of the task that has just finished
+ *
+ * @return
+ * - the pid of the task we have been waiting for
+ */
+extern SANE_Pid sanei_thread_waitpid (SANE_Pid pid, int *status);
+
+/** Check the current status of the spawned task
+ *
+ *
+ * @param pid - the id of the task
+ *
+ * @return
+ * - SANE_STATUS_GOOD - if the task finished without errors
+ * - any other value - if the task finished unexpectantly or hasn't finished yet
+ */
+extern SANE_Status sanei_thread_get_status (SANE_Pid pid);
+
+#endif /* sanei_thread_h */
diff --git a/include/sane/sanei_udp.h b/include/sane/sanei_udp.h
new file mode 100644
index 0000000..c44afdd
--- /dev/null
+++ b/include/sane/sanei_udp.h
@@ -0,0 +1,40 @@
+/* sane - Scanner Access Now Easy.
+ * Copyright (C) 2007 Tower Technologies
+ * Author: Alessandro Zummo <a.zummo@towertech.it>
+ * This file is part of the SANE package.
+ *
+ * This file is in the public domain. You may use and modify it as
+ * you see fit, as long as this copyright message is included and
+ * that there is an indication as to what modifications have been
+ * made (if any).
+ *
+ * SANE 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.
+ *
+ * Header file for UDP/IP communications.
+ */
+
+#ifndef sanei_udp_h
+#define sanei_udp_h
+
+#include <sane/sane.h>
+
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <netinet/in.h>
+#include <netdb.h>
+#endif
+
+extern SANE_Status sanei_udp_open(const char *host, int port, int *fdp);
+extern SANE_Status sanei_udp_open_broadcast(int *fdp);
+extern void sanei_udp_close(int fd);
+extern void sanei_udp_set_nonblock(int fd, SANE_Bool nonblock);
+extern ssize_t sanei_udp_write(int fd, const u_char * buf, int count);
+extern ssize_t sanei_udp_read(int fd, u_char * buf, int count);
+extern ssize_t sanei_udp_write_broadcast(int fd, int port, const u_char * buf, int count);
+extern ssize_t sanei_udp_recvfrom(int fd, u_char * buf, int count, char **fromp);
+
+#endif /* sanei_udp_h */
diff --git a/include/sane/sanei_usb.h b/include/sane/sanei_usb.h
new file mode 100644
index 0000000..c8fff97
--- /dev/null
+++ b/include/sane/sanei_usb.h
@@ -0,0 +1,525 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 2001, 2002 Henning Meier-Geinitz
+ Copyright (C) 2003, 2005 Rene Rebe (sanei_read_int,sanei_set_timeout)
+ Copyright (C) 2008 m. allan noah (sanei_usb_clear_halt)
+ Copyright (C) 2011 Reinhold Kainhofer (sanei_usb_set_endpoint)
+ This file is part of the SANE package.
+
+ SANE 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.
+
+ SANE 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 sane; see the file COPYING. If not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+*/
+
+/** @file sanei_usb.h
+ * This file provides a generic USB interface.
+ *
+ * Currently, two access methods to USB devices are provided:
+ * - Access to device
+ * files as used by the Linux kernel USB scanner driver is supported. FreeBSD
+ * and OpenBSD with their uscanner drivers also work this way. However,
+ * detection and control messages aren't supported on these platforms.
+ * - Access using libusb (where available).
+ *
+ * A general remark: Do not mix sanei_usb functions with "normal" file-related
+ * libc functions like open() or close. The device numbers used in sanei_usb
+ * are not file descriptors.
+ *
+ * @sa sanei_lm983x.h, sanei_pa4s2.h, sanei_pio.h, sanei_scsi.h, and <a
+ * href="http://www.sane-project.org/man/sane-usb.5.html">man sane-usb(5)</a>
+ * for user-oriented documentation
+ */
+
+#ifndef sanei_usb_h
+#define sanei_usb_h
+
+#include "../include/sane/config.h"
+#include "../include/sane/sane.h"
+
+#include <stdlib.h> /* for size_t */
+
+/* USB spec defines */
+#ifndef USB_CLASS_PER_INTERFACE
+/* Also defined in libusb */
+/** @name Device and/or interface class codes */
+/* @{ */
+#define USB_CLASS_PER_INTERFACE 0x00
+#define USB_CLASS_AUDIO 0x01
+#define USB_CLASS_COMM 0x02
+#define USB_CLASS_HID 0x03
+#define USB_CLASS_PRINTER 0x07
+#define USB_CLASS_MASS_STORAGE 0x08
+#define USB_CLASS_HUB 0x09
+#define USB_CLASS_DATA 0x0a
+#define USB_CLASS_VENDOR_SPEC 0xff
+/* @} */
+
+/** @name USB descriptor types */
+/* @{ */
+#define USB_DT_DEVICE 0x01
+#define USB_DT_CONFIG 0x02
+#define USB_DT_STRING 0x03
+#define USB_DT_INTERFACE 0x04
+#define USB_DT_ENDPOINT 0x05
+#define USB_DT_HID 0x21
+#define USB_DT_REPORT 0x22
+#define USB_DT_PHYSICAL 0x23
+#define USB_DT_HUB 0x29
+/* @} */
+
+/** @name Descriptor sizes per descriptor type */
+/* @{ */
+#define USB_DT_DEVICE_SIZE 18
+#define USB_DT_CONFIG_SIZE 9
+#define USB_DT_INTERFACE_SIZE 9
+#define USB_DT_ENDPOINT_SIZE 7
+#define USB_DT_ENDPOINT_AUDIO_SIZE 9
+#define USB_DT_HUB_NONVAR_SIZE 7
+/* @} */
+
+/** @name Endpoint descriptors */
+/* @{ */
+#define USB_ENDPOINT_ADDRESS_MASK 0x0f
+#define USB_ENDPOINT_DIR_MASK 0x80
+#define USB_ENDPOINT_TYPE_MASK 0x03
+#define USB_ENDPOINT_TYPE_CONTROL 0
+#define USB_ENDPOINT_TYPE_ISOCHRONOUS 1
+#define USB_ENDPOINT_TYPE_BULK 2
+#define USB_ENDPOINT_TYPE_INTERRUPT 3
+/* @} */
+
+/** @name Standard requests */
+/* @{ */
+#define USB_REQ_GET_STATUS 0x00
+#define USB_REQ_CLEAR_FEATURE 0x01
+#define USB_REQ_SET_FEATURE 0x03
+#define USB_REQ_SET_ADDRESS 0x05
+#define USB_REQ_GET_DESCRIPTOR 0x06
+#define USB_REQ_SET_DESCRIPTOR 0x07
+#define USB_REQ_GET_CONFIGURATION 0x08
+#define USB_REQ_SET_CONFIGURATION 0x09
+#define USB_REQ_GET_INTERFACE 0x0A
+#define USB_REQ_SET_INTERFACE 0x0B
+#define USB_REQ_SYNCH_FRAME 0x0C
+/* @} */
+
+/** @name USB types */
+/* @{ */
+#define USB_TYPE_STANDARD (0x00 << 5)
+#define USB_TYPE_CLASS (0x01 << 5)
+#define USB_TYPE_VENDOR (0x02 << 5)
+#define USB_TYPE_RESERVED (0x03 << 5)
+/* @} */
+
+/** @name USB recipients */
+/* @{ */
+#define USB_RECIP_DEVICE 0x00
+#define USB_RECIP_INTERFACE 0x01
+#define USB_RECIP_ENDPOINT 0x02
+#define USB_RECIP_OTHER 0x03
+/* @} */
+
+#endif /* not USB_CLASS_PER_INTERFACE */
+
+/* Not defined in libsub */
+/** @name USB Masks */
+/* @{ */
+#define USB_TYPE_MASK (0x03 << 5)
+#define USB_RECIP_MASK 0x1f
+/* @} */
+
+/** @name USB directions */
+/* @{ */
+#define USB_DIR_OUT 0x00
+#define USB_DIR_IN 0x80
+/* @} */
+
+/** */
+struct sanei_usb_dev_descriptor
+{
+ SANE_Byte desc_type;
+ unsigned int bcd_usb;
+ unsigned int bcd_dev;
+ SANE_Byte dev_class;
+ SANE_Byte dev_sub_class;
+ SANE_Byte dev_protocol;
+ SANE_Byte max_packet_size;
+};
+
+/** Initialize sanei_usb.
+ *
+ * Call this before any other sanei_usb function.
+ */
+extern void sanei_usb_init (void);
+
+/** End sanei_usb use, freeing resources when needed.
+ *
+ * When the use count of sanei_usb reach 0, free resources and end
+ * sanei_usb use.
+ */
+extern void sanei_usb_exit (void);
+
+/** Search for USB devices.
+ *
+ * Search USB busses for scanner devices.
+ */
+extern void sanei_usb_scan_devices (void);
+
+/** Get the vendor and product ids by device name.
+ *
+ * @param devname
+ * @param vendor vendor id
+ * @param product product id
+ *
+ * @return
+ * - SANE_STATUS_GOOD - if the ids could be determined
+ * - SANE_STATUS_INVAL - if the device is not found
+ * - SANE_STATUS_UNSUPPORTED - if this method is not supported with the current
+ * access method
+ */
+SANE_Status
+sanei_usb_get_vendor_product_byname (SANE_String_Const devname,
+ SANE_Word * vendor, SANE_Word * product);
+
+/** Get the vendor and product ids.
+ *
+ * Currently, only libusb devices and scanners supported by the Linux USB
+ * scanner module can be found. For the latter method, the Linux version
+ * must be 2.4.8 or higher.
+ *
+ * @param dn device number of an already sanei_usb_opened device
+ * @param vendor vendor id
+ * @param product product id
+ *
+ * @return
+ * - SANE_STATUS_GOOD - if the ids could be determined
+ * - SANE_STATUS_UNSUPPORTED - if the OS doesn't support detection of ids
+ */
+extern SANE_Status
+sanei_usb_get_vendor_product (SANE_Int dn, SANE_Word * vendor,
+ SANE_Word * product);
+
+/** Find devices that match given vendor and product ids.
+ *
+ * For limitations, see function sanei_usb_get_vendor_product().
+ * The function attach is called for every device which has been found.
+ *
+ * @param vendor vendor id
+ * @param product product id
+ * @param attach attach function
+ *
+ * @return SANE_STATUS_GOOD - on success (even if no scanner was found)
+ */
+extern SANE_Status
+sanei_usb_find_devices (SANE_Int vendor, SANE_Int product,
+ SANE_Status (*attach) (SANE_String_Const devname));
+
+/** Open a USB device.
+ *
+ * The device is opened by its name devname and the device number is
+ * returned in dn on success.
+ *
+ * Device names can be either device file names for direct access over
+ * kernel drivers (like /dev/usb/scanner) or libusb names. The libusb format
+ * looks like this: "libusb:bus-id:device-id". Bus-id and device-id are
+ * platform-dependent. An example could look like this: "libusb:001:002"
+ * (Linux).
+ *
+ * @param devname name of the device to open
+ * @param dn device number
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_ACCESS_DENIED - if the file couldn't be accessed due to
+ * permissions
+ * - SANE_STATUS_INVAL - on every other error
+ */
+extern SANE_Status sanei_usb_open (SANE_String_Const devname, SANE_Int * dn);
+
+/** Set the endpoint for the USB communication
+ *
+ * Allows to switch to a different endpoint for the USB communication than
+ * the default (auto-detected) endpoint. This function can only be called
+ * after sanei_usb_open.
+ *
+ * @param dn device number
+ * @param ep_type type of endpoint to set (bitwise or of USB_DIR_IN/OUT and
+ * USB_ENDPOINT_TYPE_BULK/CONTROL/INTERRUPT/ISOCHRONOUS
+ * @param ep endpoint to use for the given type
+ *
+ */
+extern void sanei_usb_set_endpoint (SANE_Int dn, SANE_Int ep_type, SANE_Int ep);
+
+/** Retrieve the endpoint used for the USB communication
+ *
+ * Returns the endpoint used for the USB communication of the given type.
+ * This function can only be called after sanei_usb_open.
+ *
+ * @param dn device number
+ * @param ep_type type of endpoint to retrieve (bitwise or of USB_DIR_IN/OUT
+ * and USB_ENDPOINT_TYPE_BULK/CONTROL/INTERRUPT/ISOCHRONOUS
+ * @return endpoint used for the given type
+ *
+ */
+extern SANE_Int sanei_usb_get_endpoint (SANE_Int dn, SANE_Int ep_type);
+
+/** Close a USB device.
+ *
+ * @param dn device number
+ */
+extern void sanei_usb_close (SANE_Int dn);
+
+/** Set the libusb timeout for bulk and interrupt reads.
+ *
+ * @param timeout the new timeout in ms
+ */
+extern void sanei_usb_set_timeout (SANE_Int timeout);
+
+/** Check if sanei_usb_set_timeout() is available.
+ */
+#define HAVE_SANEI_USB_SET_TIMEOUT
+
+/** Clear halt condition on bulk endpoints
+ *
+ * @param dn device number
+ */
+extern SANE_Status sanei_usb_clear_halt (SANE_Int dn);
+
+/** Check if sanei_usb_clear_halt() is available.
+ */
+#define HAVE_SANEI_USB_CLEAR_HALT
+
+/** Reset device
+ *
+ * @param dn device number
+ */
+extern SANE_Status sanei_usb_reset (SANE_Int dn);
+
+/** Initiate a bulk transfer read.
+ *
+ * Read up to size bytes from the device to buffer. After the read, size
+ * contains the number of bytes actually read.
+ *
+ * @param dn device number
+ * @param buffer buffer to store read data in
+ * @param size size of the data
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on succes
+ * - SANE_STATUS_EOF - if zero bytes have been read
+ * - SANE_STATUS_IO_ERROR - if an error occured during the read
+ * - SANE_STATUS_INVAL - on every other error
+ *
+ */
+extern SANE_Status
+sanei_usb_read_bulk (SANE_Int dn, SANE_Byte * buffer, size_t * size);
+
+/** Initiate a bulk transfer write.
+ *
+ * Write up to size bytes from buffer to the device. After the write size
+ * contains the number of bytes actually written.
+ *
+ * @param dn device number
+ * @param buffer buffer to write to device
+ * @param size size of the data
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on succes
+ * - SANE_STATUS_IO_ERROR - if an error occured during the write
+ * - SANE_STATUS_INVAL - on every other error
+ */
+extern SANE_Status
+sanei_usb_write_bulk (SANE_Int dn, const SANE_Byte * buffer, size_t * size);
+
+/** Send/receive a control message to/from a USB device.
+ *
+ * This function is only supported for libusb devices and kernel acces with
+ * Linux 2.4.13 and newer.
+ * For a detailed explanation of the parameters, have a look at the USB
+ * specification at the <a href="http://www.usb.org/developers/docs/">
+ * www.usb.org developers information page</a>.
+ *
+ * @param dn device number
+ * @param rtype specifies the characteristics of the request (e.g. data
+ * direction)
+ * @param req actual request
+ * @param value parameter specific to the request
+ * @param index parameter specific to the request (often used to select
+ * endpoint)
+ * @param len length of data to send/receive
+ * @param data buffer to send/receive data
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on success
+ * - SANE_STATUS_IO_ERROR - on error
+ * - SANE_STATUS_UNSUPPORTED - if the feature is not supported by the OS or
+ * SANE.
+ */
+extern SANE_Status
+sanei_usb_control_msg (SANE_Int dn, SANE_Int rtype, SANE_Int req,
+ SANE_Int value, SANE_Int index, SANE_Int len,
+ SANE_Byte * data);
+
+/** Initiate a interrupt transfer read.
+ *
+ * Read up to size bytes from the interrupt endpoint from the device to
+ * buffer. After the read, size contains the number of bytes actually read.
+ *
+ * @param dn device number
+ * @param buffer buffer to store read data in
+ * @param size size of the data
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on succes
+ * - SANE_STATUS_EOF - if zero bytes have been read
+ * - SANE_STATUS_IO_ERROR - if an error occured during the read
+ * - SANE_STATUS_INVAL - on every other error
+ *
+ */
+
+extern SANE_Status
+sanei_usb_read_int (SANE_Int dn, SANE_Byte * buffer, size_t * size);
+
+/** Expand device name patterns into a list of devices.
+ *
+ * Apart from a normal device name (such as /dev/usb/scanner0 or
+ * libusb:002:003), this function currently supports USB device
+ * specifications of the form:
+ *
+ * usb VENDOR PRODUCT
+ *
+ * VENDOR and PRODUCT are non-negative integer numbers in decimal or
+ * hexadecimal format. A similar function for SCSI devices can be found
+ * in include/sane/config.h.
+ *
+ * @param name device name pattern
+ * @param attach attach function
+ *
+ */
+extern void
+sanei_usb_attach_matching_devices (const char *name,
+ SANE_Status (*attach) (const char *dev));
+
+/** Initiate set configuration.
+ *
+ * Change set configuration
+ *
+ * @param dn device number
+ * @param configuration, configuration nummber
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on succes
+ * - SANE_STATUS_EOF - if zero bytes have been read
+ * - SANE_STATUS_IO_ERROR - if an error occured during the read
+ * - SANE_STATUS_INVAL - on every other error
+ *
+ */
+
+extern SANE_Status
+sanei_usb_set_configuration (SANE_Int dn, SANE_Int configuration);
+
+/** Initiate claim interface.
+ *
+ * Change claim interface
+ *
+ * @param dn device number
+ * @param interface_number interface number
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on succes
+ * - SANE_STATUS_EOF - if zero bytes have been read
+ * - SANE_STATUS_IO_ERROR - if an error occured during the read
+ * - SANE_STATUS_INVAL - on every other error
+ *
+ */
+
+extern SANE_Status
+sanei_usb_claim_interface (SANE_Int dn, SANE_Int interface_number);
+
+/** Initiate release interface.
+ *
+ * Change release interface
+ *
+ * @param dn device number
+ * @param interface_number interface number
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on succes
+ * - SANE_STATUS_EOF - if zero bytes have been read
+ * - SANE_STATUS_IO_ERROR - if an error occured during the read
+ * - SANE_STATUS_INVAL - on every other error
+ *
+ */
+
+extern SANE_Status
+sanei_usb_release_interface (SANE_Int dn, SANE_Int interface_number);
+
+/** Initiate a set altinterface.
+ *
+ * Change set alternate
+ *
+ * @param dn device number
+ * @param alternate, alternate nummber
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on succes
+ * - SANE_STATUS_EOF - if zero bytes have been read
+ * - SANE_STATUS_IO_ERROR - if an error occured during the read
+ * - SANE_STATUS_INVAL - on every other error
+ *
+ */
+
+extern SANE_Status
+sanei_usb_set_altinterface (SANE_Int dn, SANE_Int alternate);
+
+/** Get some information from the device descriptor
+ *
+ * Sometimes it's useful to know something about revisions and
+ * other stuff reported by the USB system
+ *
+ * @param dn device number
+ * @param desc where to put the information to
+ *
+ * @return
+ * - SANE_STATUS_GOOD - on succes
+ * - SANE_STATUS_UNSUPPORTED - if the feature is not supported by the OS or
+ * SANE.
+ * - SANE_STATUS_INVAL - on every other error
+ *
+ */
+
+extern SANE_Status
+sanei_usb_get_descriptor( SANE_Int dn, struct sanei_usb_dev_descriptor *desc );
+
+/*------------------------------------------------------*/
+#endif /* sanei_usb_h */
diff --git a/include/sane/sanei_wire.h b/include/sane/sanei_wire.h
new file mode 100644
index 0000000..95be5cf
--- /dev/null
+++ b/include/sane/sanei_wire.h
@@ -0,0 +1,132 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 1997 David Mosberger-Tang
+ This file is part of the SANE package.
+
+ SANE 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.
+
+ SANE 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 sane; see the file COPYING. If not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+
+ Support routines to translate internal datatypes into a wire-format
+ (used for RPCs and to save/restore options). */
+
+#ifndef sanei_wire_h
+#define sanei_wire_h
+
+#include <sys/types.h>
+
+#define MAX_MEM (1024 * 1024)
+
+typedef enum
+ {
+ WIRE_ENCODE = 0,
+ WIRE_DECODE,
+ WIRE_FREE
+ }
+WireDirection;
+
+struct Wire;
+
+typedef void (*WireCodecFunc) (struct Wire *w, void *val_ptr);
+typedef ssize_t (*WireReadFunc) (int fd, void * buf, size_t len);
+typedef ssize_t (*WireWriteFunc) (int fd, const void * buf, size_t len);
+
+typedef struct Wire
+ {
+ int version; /* protocol version in use */
+ WireDirection direction;
+ int status;
+ int allocated_memory;
+ struct
+ {
+ WireCodecFunc w_byte;
+ WireCodecFunc w_char;
+ WireCodecFunc w_word;
+ WireCodecFunc w_string;
+ }
+ codec;
+ struct
+ {
+ size_t size;
+ char *curr;
+ char *start;
+ char *end;
+ }
+ buffer;
+ struct
+ {
+ int fd;
+ WireReadFunc read;
+ WireWriteFunc write;
+ }
+ io;
+ }
+Wire;
+
+extern void sanei_w_init (Wire *w, void (*codec_init)(Wire *));
+extern void sanei_w_exit (Wire *w);
+extern void sanei_w_space (Wire *w, size_t howmuch);
+extern void sanei_w_void (Wire *w);
+extern void sanei_w_byte (Wire *w, SANE_Byte *v);
+extern void sanei_w_char (Wire *w, SANE_Char *v);
+extern void sanei_w_word (Wire *w, SANE_Word *v);
+extern void sanei_w_bool (Wire *w, SANE_Bool *v);
+extern void sanei_w_ptr (Wire *w, void **v, WireCodecFunc w_value,
+ size_t value_size);
+extern void sanei_w_string (Wire *w, SANE_String *v);
+extern void sanei_w_status (Wire *w, SANE_Status *v);
+extern void sanei_w_constraint_type (Wire *w, SANE_Constraint_Type *v);
+extern void sanei_w_value_type (Wire *w, SANE_Value_Type *v);
+extern void sanei_w_unit (Wire *w, SANE_Unit *v);
+extern void sanei_w_action (Wire *w, SANE_Action *v);
+extern void sanei_w_frame (Wire *w, SANE_Frame *v);
+extern void sanei_w_range (Wire *w, SANE_Range *v);
+extern void sanei_w_range_ptr (Wire *w, SANE_Range **v);
+extern void sanei_w_device (Wire *w, SANE_Device *v);
+extern void sanei_w_device_ptr (Wire *w, SANE_Device **v);
+extern void sanei_w_option_descriptor (Wire *w, SANE_Option_Descriptor *v);
+extern void sanei_w_option_descriptor_ptr (Wire *w,
+ SANE_Option_Descriptor **v);
+extern void sanei_w_parameters (Wire *w, SANE_Parameters *v);
+
+extern void sanei_w_array (Wire *w, SANE_Word *len, void **v,
+ WireCodecFunc w_element, size_t element_size);
+
+extern void sanei_w_set_dir (Wire *w, WireDirection dir);
+extern void sanei_w_call (Wire *w, SANE_Word proc_num,
+ WireCodecFunc w_arg, void *arg,
+ WireCodecFunc w_reply, void *reply);
+extern void sanei_w_reply (Wire *w, WireCodecFunc w_reply, void *reply);
+extern void sanei_w_free (Wire *w, WireCodecFunc w_reply, void *reply);
+
+#endif /* sanei_wire_h */
diff --git a/include/sane/saneopts.h b/include/sane/saneopts.h
new file mode 100644
index 0000000..37ba177
--- /dev/null
+++ b/include/sane/saneopts.h
@@ -0,0 +1,461 @@
+/* sane - Scanner Access Now Easy.
+ Copyright (C) 1996, 1997 David Mosberger-Tang and Andreas Beck
+ This file is part of the SANE package.
+
+ SANE 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.
+
+ SANE 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 sane; see the file COPYING. If not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ As a special exception, the authors of SANE give permission for
+ additional uses of the libraries contained in this release of SANE.
+
+ The exception is that, if you link a SANE library with other files
+ to produce an executable, this does not by itself cause the
+ resulting executable to be covered by the GNU General Public
+ License. Your use of that executable is in no way restricted on
+ account of linking the SANE library code into it.
+
+ This exception does not, however, invalidate any other reasons why
+ the executable file might be covered by the GNU General Public
+ License.
+
+ If you submit changes to SANE to the maintainers to be included in
+ a subsequent release, you agree by submitting the changes that
+ those changes may be distributed with this exception intact.
+
+ If you write modifications of your own for SANE, it is your choice
+ whether to permit this exception to apply to your modifications.
+ If you do not wish that, delete this exception notice.
+
+ This file declares common option names, titles, and descriptions. A
+ backend is not limited to these options but for the sake of
+ consistency it's better to use options declared here when appropriate.
+*/
+
+/* This file defines several option NAMEs, TITLEs and DESCs
+ that are (or should be) used by several backends.
+
+ All well known options should be listed here. But this does
+ not mean that all options that are listed here are well known options.
+ To find out if an option is a well known option and how well known
+ options have to be defined please take a look at the sane standard!!!
+ */
+#ifndef saneopts_h
+#define saneopts_h
+
+#ifndef SANE_I18N
+#define SANE_I18N(text) text
+#endif
+
+/* This _must_ be the first option (index 0): */
+#define SANE_NAME_NUM_OPTIONS "" /* never settable */
+
+/* The common option groups */
+#define SANE_NAME_STANDARD "standard"
+#define SANE_NAME_GEOMETRY "geometry"
+#define SANE_NAME_ENHANCEMENT "enhancement"
+#define SANE_NAME_ADVANCED "advanced"
+#define SANE_NAME_SENSORS "sensors"
+
+#define SANE_NAME_PREVIEW "preview"
+#define SANE_NAME_GRAY_PREVIEW "preview-in-gray"
+#define SANE_NAME_BIT_DEPTH "depth"
+#define SANE_NAME_SCAN_MODE "mode"
+#define SANE_NAME_SCAN_SPEED "speed"
+#define SANE_NAME_SCAN_SOURCE "source"
+#define SANE_NAME_BACKTRACK "backtrack"
+/* Most user-interfaces will let the user specify the scan area as the
+ top-left corner and the width/height of the scan area. The reason
+ the backend interface uses the top-left/bottom-right corner is so
+ that the scan area values can be properly constraint independent of
+ any other option value. */
+#define SANE_NAME_SCAN_TL_X "tl-x"
+#define SANE_NAME_SCAN_TL_Y "tl-y"
+#define SANE_NAME_SCAN_BR_X "br-x"
+#define SANE_NAME_SCAN_BR_Y "br-y"
+#define SANE_NAME_SCAN_RESOLUTION "resolution"
+#define SANE_NAME_SCAN_X_RESOLUTION "x-resolution"
+#define SANE_NAME_SCAN_Y_RESOLUTION "y-resolution"
+#define SANE_NAME_PAGE_WIDTH "page-width"
+#define SANE_NAME_PAGE_HEIGHT "page-height"
+#define SANE_NAME_CUSTOM_GAMMA "custom-gamma"
+#define SANE_NAME_GAMMA_VECTOR "gamma-table"
+#define SANE_NAME_GAMMA_VECTOR_R "red-gamma-table"
+#define SANE_NAME_GAMMA_VECTOR_G "green-gamma-table"
+#define SANE_NAME_GAMMA_VECTOR_B "blue-gamma-table"
+#define SANE_NAME_BRIGHTNESS "brightness"
+#define SANE_NAME_CONTRAST "contrast"
+#define SANE_NAME_GRAIN_SIZE "grain"
+#define SANE_NAME_HALFTONE "halftoning"
+#define SANE_NAME_BLACK_LEVEL "black-level"
+#define SANE_NAME_WHITE_LEVEL "white-level"
+#define SANE_NAME_WHITE_LEVEL_R "white-level-r"
+#define SANE_NAME_WHITE_LEVEL_G "white-level-g"
+#define SANE_NAME_WHITE_LEVEL_B "white-level-b"
+#define SANE_NAME_SHADOW "shadow"
+#define SANE_NAME_SHADOW_R "shadow-r"
+#define SANE_NAME_SHADOW_G "shadow-g"
+#define SANE_NAME_SHADOW_B "shadow-b"
+#define SANE_NAME_HIGHLIGHT "highlight"
+#define SANE_NAME_HIGHLIGHT_R "highlight-r"
+#define SANE_NAME_HIGHLIGHT_G "highlight-g"
+#define SANE_NAME_HIGHLIGHT_B "highlight-b"
+#define SANE_NAME_HUE "hue"
+#define SANE_NAME_SATURATION "saturation"
+#define SANE_NAME_FILE "filename"
+#define SANE_NAME_HALFTONE_DIMENSION "halftone-size"
+#define SANE_NAME_HALFTONE_PATTERN "halftone-pattern"
+#define SANE_NAME_RESOLUTION_BIND "resolution-bind"
+#define SANE_NAME_NEGATIVE "negative"
+#define SANE_NAME_QUALITY_CAL "quality-cal"
+#define SANE_NAME_DOR "double-res"
+#define SANE_NAME_RGB_BIND "rgb-bind"
+#define SANE_NAME_THRESHOLD "threshold"
+#define SANE_NAME_ANALOG_GAMMA "analog-gamma"
+#define SANE_NAME_ANALOG_GAMMA_R "analog-gamma-r"
+#define SANE_NAME_ANALOG_GAMMA_G "analog-gamma-g"
+#define SANE_NAME_ANALOG_GAMMA_B "analog-gamma-b"
+#define SANE_NAME_ANALOG_GAMMA_BIND "analog-gamma-bind"
+#define SANE_NAME_WARMUP "warmup"
+#define SANE_NAME_CAL_EXPOS_TIME "cal-exposure-time"
+#define SANE_NAME_CAL_EXPOS_TIME_R "cal-exposure-time-r"
+#define SANE_NAME_CAL_EXPOS_TIME_G "cal-exposure-time-g"
+#define SANE_NAME_CAL_EXPOS_TIME_B "cal-exposure-time-b"
+#define SANE_NAME_SCAN_EXPOS_TIME "scan-exposure-time"
+#define SANE_NAME_SCAN_EXPOS_TIME_R "scan-exposure-time-r"
+#define SANE_NAME_SCAN_EXPOS_TIME_G "scan-exposure-time-g"
+#define SANE_NAME_SCAN_EXPOS_TIME_B "scan-exposure-time-b"
+#define SANE_NAME_SELECT_EXPOSURE_TIME "select-exposure-time"
+#define SANE_NAME_CAL_LAMP_DEN "cal-lamp-density"
+#define SANE_NAME_SCAN_LAMP_DEN "scan-lamp-density"
+#define SANE_NAME_SELECT_LAMP_DENSITY "select-lamp-density"
+#define SANE_NAME_LAMP_OFF_AT_EXIT "lamp-off-at-exit"
+
+/* well known options from 'SENSORS' group*/
+#define SANE_NAME_SCAN "scan"
+#define SANE_NAME_EMAIL "email"
+#define SANE_NAME_FAX "fax"
+#define SANE_NAME_COPY "copy"
+#define SANE_NAME_PDF "pdf"
+#define SANE_NAME_CANCEL "cancel"
+#define SANE_NAME_PAGE_LOADED "page-loaded"
+#define SANE_NAME_COVER_OPEN "cover-open"
+
+#define SANE_TITLE_NUM_OPTIONS SANE_I18N("Number of options")
+
+#define SANE_TITLE_STANDARD SANE_I18N("Standard")
+#define SANE_TITLE_GEOMETRY SANE_I18N("Geometry")
+#define SANE_TITLE_ENHANCEMENT SANE_I18N("Enhancement")
+#define SANE_TITLE_ADVANCED SANE_I18N("Advanced")
+#define SANE_TITLE_SENSORS SANE_I18N("Sensors")
+
+#define SANE_TITLE_PREVIEW SANE_I18N("Preview")
+#define SANE_TITLE_GRAY_PREVIEW SANE_I18N("Force monochrome preview")
+#define SANE_TITLE_BIT_DEPTH SANE_I18N("Bit depth")
+#define SANE_TITLE_SCAN_MODE SANE_I18N("Scan mode")
+#define SANE_TITLE_SCAN_SPEED SANE_I18N("Scan speed")
+#define SANE_TITLE_SCAN_SOURCE SANE_I18N("Scan source")
+#define SANE_TITLE_BACKTRACK SANE_I18N("Force backtracking")
+#define SANE_TITLE_SCAN_TL_X SANE_I18N("Top-left x")
+#define SANE_TITLE_SCAN_TL_Y SANE_I18N("Top-left y")
+#define SANE_TITLE_SCAN_BR_X SANE_I18N("Bottom-right x")
+#define SANE_TITLE_SCAN_BR_Y SANE_I18N("Bottom-right y")
+#define SANE_TITLE_SCAN_RESOLUTION SANE_I18N("Scan resolution")
+#define SANE_TITLE_SCAN_X_RESOLUTION SANE_I18N("X-resolution")
+#define SANE_TITLE_SCAN_Y_RESOLUTION SANE_I18N("Y-resolution")
+#define SANE_TITLE_PAGE_WIDTH SANE_I18N("Page width")
+#define SANE_TITLE_PAGE_HEIGHT SANE_I18N("Page height")
+#define SANE_TITLE_CUSTOM_GAMMA SANE_I18N("Use custom gamma table")
+#define SANE_TITLE_GAMMA_VECTOR SANE_I18N("Image intensity")
+#define SANE_TITLE_GAMMA_VECTOR_R SANE_I18N("Red intensity")
+#define SANE_TITLE_GAMMA_VECTOR_G SANE_I18N("Green intensity")
+#define SANE_TITLE_GAMMA_VECTOR_B SANE_I18N("Blue intensity")
+#define SANE_TITLE_BRIGHTNESS SANE_I18N("Brightness")
+#define SANE_TITLE_CONTRAST SANE_I18N("Contrast")
+#define SANE_TITLE_GRAIN_SIZE SANE_I18N("Grain size")
+#define SANE_TITLE_HALFTONE SANE_I18N("Halftoning")
+#define SANE_TITLE_BLACK_LEVEL SANE_I18N("Black level")
+#define SANE_TITLE_WHITE_LEVEL SANE_I18N("White level")
+#define SANE_TITLE_WHITE_LEVEL_R SANE_I18N("White level for red")
+#define SANE_TITLE_WHITE_LEVEL_G SANE_I18N("White level for green")
+#define SANE_TITLE_WHITE_LEVEL_B SANE_I18N("White level for blue")
+#define SANE_TITLE_SHADOW SANE_I18N("Shadow")
+#define SANE_TITLE_SHADOW_R SANE_I18N("Shadow for red")
+#define SANE_TITLE_SHADOW_G SANE_I18N("Shadow for green")
+#define SANE_TITLE_SHADOW_B SANE_I18N("Shadow for blue")
+#define SANE_TITLE_HIGHLIGHT SANE_I18N("Highlight")
+#define SANE_TITLE_HIGHLIGHT_R SANE_I18N("Highlight for red")
+#define SANE_TITLE_HIGHLIGHT_G SANE_I18N("Highlight for green")
+#define SANE_TITLE_HIGHLIGHT_B SANE_I18N("Highlight for blue")
+#define SANE_TITLE_HUE SANE_I18N("Hue")
+#define SANE_TITLE_SATURATION SANE_I18N("Saturation")
+#define SANE_TITLE_FILE SANE_I18N("Filename")
+#define SANE_TITLE_HALFTONE_DIMENSION SANE_I18N("Halftone pattern size")
+#define SANE_TITLE_HALFTONE_PATTERN SANE_I18N("Halftone pattern")
+#define SANE_TITLE_RESOLUTION_BIND SANE_I18N("Bind X and Y resolution")
+#define SANE_TITLE_NEGATIVE SANE_I18N("Negative")
+#define SANE_TITLE_QUALITY_CAL SANE_I18N("Quality calibration")
+#define SANE_TITLE_DOR SANE_I18N("Double Optical Resolution")
+#define SANE_TITLE_RGB_BIND SANE_I18N("Bind RGB")
+#define SANE_TITLE_THRESHOLD SANE_I18N("Threshold")
+#define SANE_TITLE_ANALOG_GAMMA SANE_I18N("Analog gamma correction")
+#define SANE_TITLE_ANALOG_GAMMA_R SANE_I18N("Analog gamma red")
+#define SANE_TITLE_ANALOG_GAMMA_G SANE_I18N("Analog gamma green")
+#define SANE_TITLE_ANALOG_GAMMA_B SANE_I18N("Analog gamma blue")
+#define SANE_TITLE_ANALOG_GAMMA_BIND SANE_I18N("Bind analog gamma")
+#define SANE_TITLE_WARMUP SANE_I18N("Warmup lamp")
+#define SANE_TITLE_CAL_EXPOS_TIME SANE_I18N("Cal. exposure-time")
+#define SANE_TITLE_CAL_EXPOS_TIME_R SANE_I18N("Cal. exposure-time for red")
+#define SANE_TITLE_CAL_EXPOS_TIME_G SANE_I18N("Cal. exposure-time for " \
+"green")
+#define SANE_TITLE_CAL_EXPOS_TIME_B SANE_I18N("Cal. exposure-time for blue")
+#define SANE_TITLE_SCAN_EXPOS_TIME SANE_I18N("Scan exposure-time")
+#define SANE_TITLE_SCAN_EXPOS_TIME_R SANE_I18N("Scan exposure-time for red")
+#define SANE_TITLE_SCAN_EXPOS_TIME_G SANE_I18N("Scan exposure-time for " \
+"green")
+#define SANE_TITLE_SCAN_EXPOS_TIME_B SANE_I18N("Scan exposure-time for blue")
+#define SANE_TITLE_SELECT_EXPOSURE_TIME SANE_I18N("Set exposure-time")
+#define SANE_TITLE_CAL_LAMP_DEN SANE_I18N("Cal. lamp density")
+#define SANE_TITLE_SCAN_LAMP_DEN SANE_I18N("Scan lamp density")
+#define SANE_TITLE_SELECT_LAMP_DENSITY SANE_I18N("Set lamp density")
+#define SANE_TITLE_LAMP_OFF_AT_EXIT SANE_I18N("Lamp off at exit")
+
+/* well known options from 'SENSORS' group*/
+#define SANE_TITLE_SCAN "Scan button"
+#define SANE_TITLE_EMAIL "Email button"
+#define SANE_TITLE_FAX "Fax button"
+#define SANE_TITLE_COPY "Copy button"
+#define SANE_TITLE_PDF "PDF button"
+#define SANE_TITLE_CANCEL "Cancel button"
+#define SANE_TITLE_PAGE_LOADED "Page loaded"
+#define SANE_TITLE_COVER_OPEN "Cover open"
+
+/* Descriptive/help strings for above options: */
+#define SANE_DESC_NUM_OPTIONS \
+SANE_I18N("Read-only option that specifies how many options a specific " \
+"devices supports.")
+
+#define SANE_DESC_STANDARD SANE_I18N("Source, mode and resolution options")
+#define SANE_DESC_GEOMETRY SANE_I18N("Scan area and media size options")
+#define SANE_DESC_ENHANCEMENT SANE_I18N("Image modification options")
+#define SANE_DESC_ADVANCED SANE_I18N("Hardware specific options")
+#define SANE_DESC_SENSORS SANE_I18N("Scanner sensors and buttons")
+
+#define SANE_DESC_PREVIEW \
+SANE_I18N("Request a preview-quality scan.")
+
+#define SANE_DESC_GRAY_PREVIEW \
+SANE_I18N("Request that all previews are done in monochrome mode. On a " \
+"three-pass scanner this cuts down the number of passes to one and on a " \
+"one-pass scanner, it reduces the memory requirements and scan-time of the " \
+"preview.")
+
+#define SANE_DESC_BIT_DEPTH \
+SANE_I18N("Number of bits per sample, typical values are 1 for \"line-art\" " \
+"and 8 for multibit scans.")
+
+#define SANE_DESC_SCAN_MODE \
+SANE_I18N("Selects the scan mode (e.g., lineart, monochrome, or color).")
+
+#define SANE_DESC_SCAN_SPEED \
+SANE_I18N("Determines the speed at which the scan proceeds.")
+
+#define SANE_DESC_SCAN_SOURCE \
+SANE_I18N("Selects the scan source (such as a document-feeder).")
+
+#define SANE_DESC_BACKTRACK \
+SANE_I18N("Controls whether backtracking is forced.")
+
+#define SANE_DESC_SCAN_TL_X \
+SANE_I18N("Top-left x position of scan area.")
+
+#define SANE_DESC_SCAN_TL_Y \
+SANE_I18N("Top-left y position of scan area.")
+
+#define SANE_DESC_SCAN_BR_X \
+SANE_I18N("Bottom-right x position of scan area.")
+
+#define SANE_DESC_SCAN_BR_Y \
+SANE_I18N("Bottom-right y position of scan area.")
+
+#define SANE_DESC_SCAN_RESOLUTION \
+SANE_I18N("Sets the resolution of the scanned image.")
+
+#define SANE_DESC_SCAN_X_RESOLUTION \
+SANE_I18N("Sets the horizontal resolution of the scanned image.")
+
+#define SANE_DESC_SCAN_Y_RESOLUTION \
+SANE_I18N("Sets the vertical resolution of the scanned image.")
+
+#define SANE_DESC_PAGE_WIDTH \
+SANE_I18N("Specifies the width of the media. Required for automatic " \
+"centering of sheet-fed scans.")
+
+#define SANE_DESC_PAGE_HEIGHT \
+SANE_I18N("Specifies the height of the media.")
+
+#define SANE_DESC_CUSTOM_GAMMA \
+SANE_I18N("Determines whether a builtin or a custom gamma-table should be " \
+"used.")
+
+#define SANE_DESC_GAMMA_VECTOR \
+SANE_I18N("Gamma-correction table. In color mode this option equally " \
+"affects the red, green, and blue channels simultaneously (i.e., it is an " \
+"intensity gamma table).")
+
+#define SANE_DESC_GAMMA_VECTOR_R \
+SANE_I18N("Gamma-correction table for the red band.")
+
+#define SANE_DESC_GAMMA_VECTOR_G \
+SANE_I18N("Gamma-correction table for the green band.")
+
+#define SANE_DESC_GAMMA_VECTOR_B \
+SANE_I18N("Gamma-correction table for the blue band.")
+
+#define SANE_DESC_BRIGHTNESS \
+SANE_I18N("Controls the brightness of the acquired image.")
+
+#define SANE_DESC_CONTRAST \
+SANE_I18N("Controls the contrast of the acquired image.")
+
+#define SANE_DESC_GRAIN_SIZE \
+SANE_I18N("Selects the \"graininess\" of the acquired image. Smaller values " \
+"result in sharper images.")
+
+#define SANE_DESC_HALFTONE \
+SANE_I18N("Selects whether the acquired image should be halftoned (dithered).")
+
+#define SANE_DESC_BLACK_LEVEL \
+SANE_I18N("Selects what radiance level should be considered \"black\".")
+
+#define SANE_DESC_WHITE_LEVEL \
+SANE_I18N("Selects what radiance level should be considered \"white\".")
+
+#define SANE_DESC_WHITE_LEVEL_R \
+SANE_I18N("Selects what red radiance level should be considered \"white\".")
+
+#define SANE_DESC_WHITE_LEVEL_G \
+SANE_I18N("Selects what green radiance level should be considered \"white\".")
+
+#define SANE_DESC_WHITE_LEVEL_B \
+SANE_I18N("Selects what blue radiance level should be considered \"white\".")
+
+#define SANE_DESC_SHADOW \
+SANE_I18N("Selects what radiance level should be considered \"black\".")
+#define SANE_DESC_SHADOW_R \
+SANE_I18N("Selects what red radiance level should be considered \"black\".")
+#define SANE_DESC_SHADOW_G \
+SANE_I18N("Selects what green radiance level should be considered \"black\".")
+#define SANE_DESC_SHADOW_B \
+SANE_I18N("Selects what blue radiance level should be considered \"black\".")
+
+#define SANE_DESC_HIGHLIGHT \
+SANE_I18N("Selects what radiance level should be considered \"white\".")
+#define SANE_DESC_HIGHLIGHT_R \
+SANE_I18N("Selects what red radiance level should be considered \"full red\".")
+#define SANE_DESC_HIGHLIGHT_G \
+SANE_I18N("Selects what green radiance level should be considered \"full " \
+"green\".")
+#define SANE_DESC_HIGHLIGHT_B \
+SANE_I18N("Selects what blue radiance level should be considered \"full " \
+"blue\".")
+
+#define SANE_DESC_HUE \
+SANE_I18N("Controls the \"hue\" (blue-level) of the acquired image.")
+
+#define SANE_DESC_SATURATION \
+SANE_I18N("The saturation level controls the amount of \"blooming\" that " \
+"occurs when acquiring an image with a camera. Larger values cause more " \
+"blooming.")
+
+#define SANE_DESC_FILE \
+SANE_I18N("The filename of the image to be loaded.")
+
+#define SANE_DESC_HALFTONE_DIMENSION \
+SANE_I18N("Sets the size of the halftoning (dithering) pattern used when " \
+"scanning halftoned images.")
+
+#define SANE_DESC_HALFTONE_PATTERN \
+SANE_I18N("Defines the halftoning (dithering) pattern for scanning " \
+"halftoned images.")
+
+#define SANE_DESC_RESOLUTION_BIND \
+SANE_I18N("Use same values for X and Y resolution")
+#define SANE_DESC_NEGATIVE \
+SANE_I18N("Swap black and white")
+#define SANE_DESC_QUALITY_CAL \
+SANE_I18N("Do a quality white-calibration")
+#define SANE_DESC_DOR \
+SANE_I18N("Use lens that doubles optical resolution")
+#define SANE_DESC_RGB_BIND \
+SANE_I18N("In RGB-mode use same values for each color")
+#define SANE_DESC_THRESHOLD \
+SANE_I18N("Select minimum-brightness to get a white point")
+#define SANE_DESC_ANALOG_GAMMA \
+SANE_I18N("Analog gamma-correction")
+#define SANE_DESC_ANALOG_GAMMA_R \
+SANE_I18N("Analog gamma-correction for red")
+#define SANE_DESC_ANALOG_GAMMA_G \
+SANE_I18N("Analog gamma-correction for green")
+#define SANE_DESC_ANALOG_GAMMA_B \
+SANE_I18N("Analog gamma-correction for blue")
+#define SANE_DESC_ANALOG_GAMMA_BIND \
+SANE_I18N("In RGB-mode use same values for each color")
+#define SANE_DESC_WARMUP \
+SANE_I18N("Warmup lamp before scanning")
+#define SANE_DESC_CAL_EXPOS_TIME \
+SANE_I18N("Define exposure-time for calibration")
+#define SANE_DESC_CAL_EXPOS_TIME_R \
+SANE_I18N("Define exposure-time for red calibration")
+#define SANE_DESC_CAL_EXPOS_TIME_G \
+SANE_I18N("Define exposure-time for green calibration")
+#define SANE_DESC_CAL_EXPOS_TIME_B \
+SANE_I18N("Define exposure-time for blue calibration")
+#define SANE_DESC_SCAN_EXPOS_TIME \
+SANE_I18N("Define exposure-time for scan")
+#define SANE_DESC_SCAN_EXPOS_TIME_R \
+SANE_I18N("Define exposure-time for red scan")
+#define SANE_DESC_SCAN_EXPOS_TIME_G \
+SANE_I18N("Define exposure-time for green scan")
+#define SANE_DESC_SCAN_EXPOS_TIME_B \
+SANE_I18N("Define exposure-time for blue scan")
+#define SANE_DESC_SELECT_EXPOSURE_TIME \
+SANE_I18N("Enable selection of exposure-time")
+#define SANE_DESC_CAL_LAMP_DEN \
+SANE_I18N("Define lamp density for calibration")
+#define SANE_DESC_SCAN_LAMP_DEN \
+SANE_I18N("Define lamp density for scan")
+#define SANE_DESC_SELECT_LAMP_DENSITY \
+SANE_I18N("Enable selection of lamp density")
+#define SANE_DESC_LAMP_OFF_AT_EXIT \
+SANE_I18N("Turn off lamp when program exits")
+
+/* well known options from 'SENSORS' group*/
+#define SANE_DESC_SCAN SANE_I18N("Scan button")
+#define SANE_DESC_EMAIL SANE_I18N("Email button")
+#define SANE_DESC_FAX SANE_I18N("Fax button")
+#define SANE_DESC_COPY SANE_I18N("Copy button")
+#define SANE_DESC_PDF SANE_I18N("PDF button")
+#define SANE_DESC_CANCEL SANE_I18N("Cancel button")
+#define SANE_DESC_PAGE_LOADED SANE_I18N("Page loaded")
+#define SANE_DESC_COVER_OPEN SANE_I18N("Cover open")
+
+/* Typical values for stringlists (to keep the backends consistent) */
+#define SANE_VALUE_SCAN_MODE_COLOR SANE_I18N("Color")
+#define SANE_VALUE_SCAN_MODE_COLOR_LINEART SANE_I18N("Color Lineart")
+#define SANE_VALUE_SCAN_MODE_COLOR_HALFTONE SANE_I18N("Color Halftone")
+#define SANE_VALUE_SCAN_MODE_GRAY SANE_I18N("Gray")
+#define SANE_VALUE_SCAN_MODE_HALFTONE SANE_I18N("Halftone")
+#define SANE_VALUE_SCAN_MODE_LINEART SANE_I18N("Lineart")
+
+#endif /* saneopts_h */