Port to Cygwin.

merge-requests/1/head
Frank Zago 2003-09-24 03:41:48 +00:00
rodzic 1eef5c8c60
commit 3bda0d541d
11 zmienionych plików z 4176 dodań i 3482 usunięć

Wyświetl plik

@ -1,3 +1,9 @@
2003-09-23 Frank Zago <fzago at austin dot rr dot com>
* Makefile.in NEWS configure configure.in backend/Makefile.in
backend/dll.c include/sane/config.h.in sanei/sanei_scsi.c
tools/sane-find-scanner.c
2003-09-23 Gerhard Jaeger <gerhard@gjaeger.de>
* configure.in: added new backend plustek_pp

Wyświetl plik

@ -43,6 +43,7 @@ DISTFILES = AUTHORS COPYING ChangeLog ChangeLog-1.0.0 ChangeLog-1.0.1 \
README.freebsd \
README.hp-ux README.linux README.netbsd \
README.openbsd README.os2 README.solaris README.unixware2 README.unixware7 \
README.windows \
TODO acinclude.m4 aclocal.m4 config.guess config.sub configure \
configure.in install-sh ltmain.sh mkinstalldirs \
sane-backends.lsm

5
NEWS
Wyświetl plik

@ -1,4 +1,9 @@
-*-Mode: outline-*-
New with 1.0.13, released 2003-xx-xx:
* Port to Cygwin
New with 1.0.12, released 2003-05-25:
* New backends: hp5400 (Hewlett Packard 54XX series), ibm (IBM 2456, Ricoh

43
README.windows 100644
Wyświetl plik

@ -0,0 +1,43 @@
SANE on Cygwin/Win32
Prerequisites
=============
To be able to compile sane-backends, you need to have Cygwin installed, with at least the following package(s):
- gcc
You can get Cygwin at http://sources.redhat.com/cygwin/
The scanner must be detected by Windows and not be disabled. Check
with the hardware manager.
Scanning
========
If you have more than one scanner, you should do the following:
- run sane-find-scanner to get the device name of the scanner. The
name is something like h0b0t6l0, meaning hba 0, bus 0, scsi id 6 and
lun 0.
- edit the config file for the backend
(/usr/local/etc/sane.d/xxxx.conf) and add the scanner device name on
an empty line.
Run "scanimage > out.pnm" to get a scan.
Limitations
===========
The current annoying limitations are:
- Only SCSI scanners will work. No USB/FireWire/Parallel.
- Only scanimage works. No graphical interface has been ported.
- Tested on Windows 2000 only. Should work on Windows NT/XP too;
may or may not work on Windows 95/98/ME.
2003/9/23
Frank Zago.

Wyświetl plik

@ -154,7 +154,7 @@ DISTFILES = abaton.c abaton.conf abaton.h agfafocus.c agfafocus.conf \
libsane-%.la: %.lo %-s.lo $(EXTRA) $(LIBOBJS)
@$(LIBTOOL) $(MLINK) $(CC) -export-dynamic -o $@ $($*_LIBS) \
$(LDFLAGS) $(BACKENDLIBS) $^ -rpath $(libsanedir) \
$(LDFLAGS) $(BACKENDLIBS) $^ @LIBTOOL_LINK_EXTRA@ -rpath $(libsanedir) \
-version-info $(V_MAJOR):$(V_REV):$(V_MINOR) $(DYNAMIC_FLAG)
%-s.lo: %-s.c
@ -243,7 +243,7 @@ dll-preload.c:
libsane.la: dll.lo dll-s.lo $(EXTRA) $(addsuffix .lo,$(DLL_PRELOAD)) $(LIBOBJS)
@$(LIBTOOL) $(MLINK) $(CC) -o $@ $(LDFLAGS) $(BACKENDLIBS) $^ \
$(addsuffix .lo,$(DLL_PRELOAD_EXTRAS)) \
$(addsuffix .lo,$(DLL_PRELOAD_EXTRAS)) @LIBTOOL_LINK_EXTRA@ \
-rpath $(libdir) -version-info $(V_MAJOR):$(V_REV):$(V_MINOR)
# additional dependencies

Wyświetl plik

@ -304,6 +304,10 @@ load (struct backend *be)
# define PREFIX "libsane-"
# ifdef __hpux
# define POSTFIX ".sl.%u"
#elif defined (HAVE_WINDOWS_H)
# undef PREFIX
# define PREFIX "cygsane-"
# define POSTFIX "-%u.dll"
# else
# define POSTFIX ".so.%u"
# endif

70
configure vendored
Wyświetl plik

@ -463,7 +463,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS V_MAJOR V_MINOR V_REV PACKAGE VERSION NUMBER_VERSION build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE CPP EGREP SANE_CONFIG_PATH MSGFMT XGETTEXT MSGMERGE LATEX DVIPS MAKEINDEX INCLUDES LINKER_RPATH DL_LIB DYNAMIC_FLAG HAVE_GPHOTO2 ac_ct_HAVE_GPHOTO2 ALLOCA LIBOBJS LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL SANED SANEI_JPEG SANEI_JPEG_LO BACKENDS DLL_PRELOAD INSTALL_TRANSLATIONS USE_LATEX DISTCLEAN_FILES LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS V_MAJOR V_MINOR V_REV PACKAGE VERSION NUMBER_VERSION build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE CPP EGREP SANE_CONFIG_PATH MSGFMT XGETTEXT MSGMERGE LATEX DVIPS MAKEINDEX INCLUDES LINKER_RPATH DL_LIB DYNAMIC_FLAG HAVE_GPHOTO2 ac_ct_HAVE_GPHOTO2 ALLOCA LIBOBJS LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBTOOL_LINK_EXTRA SANED SANEI_JPEG SANEI_JPEG_LO BACKENDS DLL_PRELOAD INSTALL_TRANSLATIONS USE_LATEX DISTCLEAN_FILES LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -5780,6 +5780,7 @@ fi
for ac_header in fcntl.h unistd.h libc.h sys/dsreq.h sys/select.h \
@ -5789,7 +5790,8 @@ for ac_header in fcntl.h unistd.h libc.h sys/dsreq.h sys/select.h \
camlib.h os2.h sys/socket.h sys/io.h gscdds.h sys/hw.h \
sys/types.h sys/scsi/scsi.h sys/scsi/sgdefs.h sys/scsi/targets/scgio.h \
apollo/scsi.h sys/sdi_comm.h sys/passthrudef.h linux/ppdev.h \
dev/ppbus/ppi.h machine/cpufunc.h usb.h sys/bitypes.h sys/sem.h sys/poll.h IOKit/IOKitLib.h
dev/ppbus/ppi.h machine/cpufunc.h usb.h sys/bitypes.h sys/sem.h sys/poll.h \
IOKit/IOKitLib.h windows.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@ -9232,7 +9234,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 9235 "configure"' > conftest.$ac_ext
echo '#line 9237 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -10411,7 +10413,7 @@ fi
# Provide some information about the compiler.
echo "$as_me:10414:" \
echo "$as_me:10416:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@ -11416,11 +11418,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:11419: $lt_compile\"" >&5)
(eval echo "\"\$as_me:11421: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:11423: \$? = $ac_status" >&5
echo "$as_me:11425: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -11648,11 +11650,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:11651: $lt_compile\"" >&5)
(eval echo "\"\$as_me:11653: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:11655: \$? = $ac_status" >&5
echo "$as_me:11657: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -11715,11 +11717,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:11718: $lt_compile\"" >&5)
(eval echo "\"\$as_me:11720: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:11722: \$? = $ac_status" >&5
echo "$as_me:11724: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -13727,7 +13729,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 13730 "configure"
#line 13732 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -13825,7 +13827,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 13828 "configure"
#line 13830 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -15957,11 +15959,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15960: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15962: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:15964: \$? = $ac_status" >&5
echo "$as_me:15966: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -16024,11 +16026,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:16027: $lt_compile\"" >&5)
(eval echo "\"\$as_me:16029: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:16031: \$? = $ac_status" >&5
echo "$as_me:16033: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -17267,7 +17269,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 17270 "configure"
#line 17272 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -17365,7 +17367,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 17368 "configure"
#line 17370 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -18187,11 +18189,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:18190: $lt_compile\"" >&5)
(eval echo "\"\$as_me:18192: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:18194: \$? = $ac_status" >&5
echo "$as_me:18196: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -18254,11 +18256,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:18257: $lt_compile\"" >&5)
(eval echo "\"\$as_me:18259: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:18261: \$? = $ac_status" >&5
echo "$as_me:18263: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -20194,11 +20196,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:20197: $lt_compile\"" >&5)
(eval echo "\"\$as_me:20199: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:20201: \$? = $ac_status" >&5
echo "$as_me:20203: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -20426,11 +20428,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:20429: $lt_compile\"" >&5)
(eval echo "\"\$as_me:20431: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:20433: \$? = $ac_status" >&5
echo "$as_me:20435: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -20493,11 +20495,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:20496: $lt_compile\"" >&5)
(eval echo "\"\$as_me:20498: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:20500: \$? = $ac_status" >&5
echo "$as_me:20502: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -22505,7 +22507,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 22508 "configure"
#line 22510 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -22603,7 +22605,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 22606 "configure"
#line 22608 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -23609,6 +23611,11 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
if test "$ac_cv_header_windows_h" = "yes" ; then
LIBTOOL_LINK_EXTRA=-no-undefined
fi
if test "${ac_cv_header_sys_socket_h}" = "no"; then
@ -23636,7 +23643,7 @@ echo "$as_me: Manually selected backends: ${BACKENDS}" >&6;}
BACKENDS="abaton agfafocus apple artec as6e avision bh canon \
canon630u coolscan coolscan2 dc25 dmc \
epson fujitsu gt68xx hp leo matsushita microtek \
microtek2 mustek mustek_pp mustek_usb nec pie plustek \
microtek2 mustek mustek_pp mustek_usb nec pie plustek plustek_pp \
ricoh s9036 sceptre sharp \
sp15c st400 tamarack test teco1 teco2 teco3 umax umax_pp umax1220u \
artec_eplus48u ma1509 ibm hp5400"
@ -24495,6 +24502,7 @@ s,@F77@,$F77,;t t
s,@FFLAGS@,$FFLAGS,;t t
s,@ac_ct_F77@,$ac_ct_F77,;t t
s,@LIBTOOL@,$LIBTOOL,;t t
s,@LIBTOOL_LINK_EXTRA@,$LIBTOOL_LINK_EXTRA,;t t
s,@SANED@,$SANED,;t t
s,@SANEI_JPEG@,$SANEI_JPEG,;t t
s,@SANEI_JPEG_LO@,$SANEI_JPEG_LO,;t t

Wyświetl plik

@ -106,7 +106,8 @@ AC_CHECK_HEADERS(fcntl.h unistd.h libc.h sys/dsreq.h sys/select.h \
camlib.h os2.h sys/socket.h sys/io.h gscdds.h sys/hw.h \
sys/types.h sys/scsi/scsi.h sys/scsi/sgdefs.h sys/scsi/targets/scgio.h \
apollo/scsi.h sys/sdi_comm.h sys/passthrudef.h linux/ppdev.h \
dev/ppbus/ppi.h machine/cpufunc.h usb.h sys/bitypes.h sys/sem.h sys/poll.h IOKit/IOKitLib.h)
dev/ppbus/ppi.h machine/cpufunc.h usb.h sys/bitypes.h sys/sem.h sys/poll.h \
IOKit/IOKitLib.h windows.h)
AC_CHECK_HEADERS([asm/io.h],,,[#include <sys/types.h>])
SANE_CHECK_MISSING_HEADERS
SANE_V4L_VERSION
@ -241,6 +242,12 @@ AC_LIBTOOL_WIN32_DLL
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
dnl Windows/Cygwin needs this, else the library creation fails
if test "$ac_cv_header_windows_h" = "yes" ; then
LIBTOOL_LINK_EXTRA=-no-undefined
AC_SUBST(LIBTOOL_LINK_EXTRA)
fi
dnl ***********************************************************************
dnl enable/disable backends and features based on previous tests and user's
dnl choice
@ -433,8 +440,8 @@ dnl ***********************************************************************
DISTCLEAN_FILES="*~ .*~ *.log *.bak *.old *.orig *.out *.rej \"\#\"* \".\\#\"*"
AC_SUBST(DISTCLEAN_FILES)
AC_CONFIG_FILES([Makefile lib/Makefile sanei/Makefile frontend/Makefile
japi/Makefile backend/Makefile include/Makefile doc/Makefile
AC_CONFIG_FILES([Makefile lib/Makefile sanei/Makefile frontend/Makefile \
japi/Makefile backend/Makefile include/Makefile doc/Makefile \
po/Makefile testsuite/Makefile tools/Makefile])
AC_CONFIG_FILES([tools/sane-config], [chmod a+x tools/sane-config])
AC_OUTPUT

Wyświetl plik

@ -49,9 +49,6 @@
/* Define to 1 if you have the <dev/ppbus/ppi.h> header file. */
#undef HAVE_DEV_PPBUS_PPI_H
/* Define to 1 if you have the <machine/cpufunc.h> header file. */
#undef HAVE_MACHINE_CPUFUNC_H
/* Is /dev/urandom available? */
#undef HAVE_DEV_URANDOM
@ -82,6 +79,9 @@
/* Define to 1 if you have the <gscdds.h> header file. */
#undef HAVE_GSCDDS_H
/* Define to 1 if you have the `i386_set_ioperm' function. */
#undef HAVE_I386_SET_IOPERM
/* Define to 1 if you have the `inet_addr' function. */
#undef HAVE_INET_ADDR
@ -106,9 +106,6 @@
/* Define to 1 if you have the `ioperm' function. */
#undef HAVE_IOPERM
/* Define to 1 if you have the `i386_set_ioperm' function. */
#undef HAVE_I386_SET_IOPERM
/* Define to 1 if you have the <io/cam/cam.h> header file. */
#undef HAVE_IO_CAM_CAM_H
@ -148,6 +145,9 @@
/* Define if the long long type is available. */
#undef HAVE_LONG_LONG
/* 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
@ -310,6 +310,9 @@
/* 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 `_portaccess' function. */
#undef HAVE__PORTACCESS

Plik diff jest za duży Load Diff

Wyświetl plik

@ -35,6 +35,12 @@
extern char * check_usb_chip (struct usb_device *dev, int verbosity);
#endif
#if defined (HAVE_WINDOWS_H)
#include <windows.h>
#include <ddk/scsi.h>
#include <ddk/ntddscsi.h>
#endif
#include "../include/sane/sanei.h"
#include "../include/sane/sanei_scsi.h"
#include "../include/sane/sanei_usb.h"
@ -676,6 +682,105 @@ get_next_file (char *dir_name, DIR * dir)
return file_name;
}
#if defined (HAVE_WINDOWS_H)
/* Return a list of potential scanners. There's a lot of hardcoded values here that might break on a system with lots of scsi devices. */
static char **build_scsi_dev_list()
{
char **dev_list;
int dev_list_index;
int hca;
HANDLE fd;
char scsi_hca_name[20];
char buffer[4096];
DWORD BytesReturned;
BOOL ret;
size_t dev_list_size;
PSCSI_ADAPTER_BUS_INFO adapter;
PSCSI_INQUIRY_DATA inquiry;
int i;
/* Allocate room for about 100 scanners. That should be enough. */
dev_list_size = 100;
dev_list_index = 0;
dev_list = calloc(1, dev_list_size * sizeof(char *));
hca = 0;
for(hca = 0; ; hca++) {
/* Open the adapter */
snprintf(scsi_hca_name, 20, "\\\\.\\Scsi%d:", hca);
fd = CreateFile(scsi_hca_name, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING,
FILE_FLAG_RANDOM_ACCESS, NULL );
if (fd == INVALID_HANDLE_VALUE) {
/* Assume there is no more adapter. This is wrong in the case
* of hot-plug stuff, but I have yet to see it on a user
* machine. */
break;
}
/* Get the inquiry info for the devices on that hca. */
ret = DeviceIoControl(fd,
IOCTL_SCSI_GET_INQUIRY_DATA,
NULL,
0,
buffer,
sizeof(buffer),
&BytesReturned,
FALSE);
if(ret == 0)
{
CloseHandle(fd);
continue;
}
adapter = (PSCSI_ADAPTER_BUS_INFO)buffer;
for(i = 0; i < adapter->NumberOfBuses; i++) {
if (adapter->BusData[i].InquiryDataOffset == 0) {
/* No device here */
continue;
}
inquiry = (PSCSI_INQUIRY_DATA) (buffer +
adapter->BusData[i].InquiryDataOffset);
while(1) {
/* Check if it is a scanner or a processor
* device. Ignore the other
* device types. */
if (inquiry->InquiryDataLength >= 5 &&
((inquiry->InquiryData[0] & 0x1f) == 3 ||
(inquiry->InquiryData[0] & 0x1f) == 6)) {
char device_name[20];
sprintf(device_name, "h%db%dt%dl%d", hca, inquiry->PathId, inquiry->TargetId, inquiry->Lun);
dev_list[dev_list_index] = strdup(device_name);
dev_list_index++;
}
if (inquiry->NextInquiryDataOffset == 0) {
/* No device here */
break;
} else {
inquiry = (PSCSI_INQUIRY_DATA) (buffer +
inquiry->NextInquiryDataOffset);
}
}
}
CloseHandle(fd);
}
return dev_list;
}
#endif
int
main (int argc, char **argv)
{
@ -961,7 +1066,13 @@ main (int argc, char **argv)
0
};
#if defined (HAVE_WINDOWS_H)
/* Build a list of valid of possible scanners found */
dev_list = build_scsi_dev_list();
#else
dev_list = default_dev_list;
#endif
usb_dev_list = usb_default_dev_list;
}