kopia lustrzana https://gitlab.com/sane-project/backends
Make libusb-1.0 the default for USB support
When libusb-1.0 is not found, libusb-0.1 will be tried. On BeOS and OS2, nothing should have changed in terms of detection of USB support. On all systems the --enable-libusb* flags are now ignored. Instead, the --with-usb and --without-usb flags now control support. When neither is given USB support will be enable if possible and disabled otherwise. If --with-usb is requested but not possible, ./configure will fail. There is no support to prefer libusb-0.1 over libusb-1.0.merge-requests/1/head
rodzic
418fbb987d
commit
a9c813944e
2
README
2
README
|
@ -47,7 +47,7 @@ configure. On some Linux distributions the header files are part of separate
|
|||
packages (e.g. usb.h in libusb-devel or libusb-dev). These must also be
|
||||
installed.
|
||||
|
||||
- libusb (>=0.1.8): Strongly recommended if you use a USB scanner.
|
||||
- libusb: Strongly recommended if you use a USB scanner.
|
||||
Some backends won't work without libusb at all.
|
||||
|
||||
- libjpeg (>=6B): For the dc210, dc240, and gphoto2 backends.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
## This file is part of the "Sane" build infra-structure. See
|
||||
## included LICENSE file for license information.
|
||||
|
||||
AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -DLIBDIR="\"$(libdir)/sane\""
|
||||
AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include $(USB_CFLAGS) -DLIBDIR="\"$(libdir)/sane\""
|
||||
|
||||
AM_LDFLAGS += $(STRICT_LDFLAGS)
|
||||
# The -rpath option is added because we are creating _LTLIBRARIES based
|
||||
|
|
|
@ -6672,10 +6672,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
|
|||
DBG_INIT ();
|
||||
DBG (DBG_init, "SANE Genesys backend version %d.%d build %d from %s\n",
|
||||
SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING);
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
DBG (DBG_init, "SANE Genesys backend built with libusb-1.0\n");
|
||||
#endif
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
DBG (DBG_init, "SANE Genesys backend built with libusb\n");
|
||||
#endif
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ Start: 2.4.2001
|
|||
#include "../include/sane/saneopts.h"
|
||||
#include "../include/sane/sanei_usb.h"
|
||||
|
||||
#undef HAVE_LIBUSB
|
||||
#undef HAVE_LIBUSB_LEGACY
|
||||
|
||||
/* prevent inclusion of scantool.h */
|
||||
#define SCANTOOL_H
|
||||
|
|
140
configure.ac
140
configure.ac
|
@ -373,85 +373,63 @@ if test "x$with_systemd" != xno ; then
|
|||
fi
|
||||
fi
|
||||
|
||||
dnl ***********
|
||||
dnl USB Support
|
||||
dnl ***********
|
||||
dnl ******************************************************************
|
||||
dnl Check for USB support
|
||||
dnl ******************************************************************
|
||||
|
||||
dnl Enable libusb-1.0, if available
|
||||
AC_ARG_ENABLE(libusb_1_0,
|
||||
AS_HELP_STRING([--enable-libusb_1_0], [enable libusb-1.0 support if available]),
|
||||
[enable_libusb_1_0=$enableval], [enable_libusb_1_0=no])
|
||||
|
||||
dnl USB support enabled by default (if found). Note: Overloading libusb
|
||||
dnl option right now to disable USB support on any platform; even
|
||||
dnl if they use a different library name.
|
||||
AC_ARG_ENABLE(libusb,
|
||||
AS_HELP_STRING([--disable-libusb], [disable support for USB in SANE]),,
|
||||
enable_libusb=auto)
|
||||
HAVE_USB=no
|
||||
if test "$enable_libusb" != "no"; then
|
||||
case ${host_os} in
|
||||
beos*)
|
||||
AC_CHECK_HEADERS(be/drivers/USB_scanner.h, HAVE_USB=yes, AC_MSG_ERROR([USB_scanner.h is required on BeOS]))
|
||||
;;
|
||||
os2*)
|
||||
AC_CHECK_HEADER(usbcalls.h,
|
||||
AC_CHECK_LIB(usbcall, UsbQueryNumberDevices,
|
||||
[USB_LIBS="$USB_LIBS -lusbcall"
|
||||
HAVE_USB=yes]),,[#include <usb.h>
|
||||
#include <os2.h>
|
||||
])
|
||||
;;
|
||||
*)
|
||||
dnl If libusb-1.0 is enabled and available, prefer that to the old libusb
|
||||
have_libusb_1_0=no
|
||||
if test "$enable_libusb_1_0" = "yes"; then
|
||||
PKG_CHECK_MODULES(LIBUSB_1_0, [ libusb-1.0 >= 1.0.0 ], have_libusb_1_0=yes, have_libusb_1_0=no)
|
||||
if test "$have_libusb_1_0" = "yes"; then
|
||||
AM_CFLAGS="$AM_CFLAGS $LIBUSB_1_0_CFLAGS"
|
||||
USB_LIBS="$USB_LIBS $LIBUSB_1_0_LIBS"
|
||||
HAVE_USB=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$have_libusb_1_0" = "no"; then
|
||||
dnl Fallback to the old libusb
|
||||
dnl libusb >= 0.1.8 is required, as we need usb_interrupt_read()
|
||||
AC_CHECK_HEADER(usb.h,
|
||||
AC_CHECK_LIB(usb, usb_interrupt_read,
|
||||
[USB_LIBS="$USB_LIBS -lusb"
|
||||
HAVE_USB=yes]))
|
||||
AC_CHECK_HEADERS(lusb0_usb.h,
|
||||
AC_CHECK_LIB(usb, usb_interrupt_read,
|
||||
[USB_LIBS="$USB_LIBS -lusb"
|
||||
HAVE_USB=yes]))
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
dnl The following logic is useful for distributions. If they force
|
||||
dnl USB support with --enable-libusb=yes then configure will fail
|
||||
dnl when its detected that it can not be supported. Default is
|
||||
dnl "auto" which means only enable if libraries are found and do
|
||||
dnl not error out.
|
||||
if test "$enable_libusb" = "yes" && test "$HAVE_USB" = "no"; then
|
||||
AC_MSG_ERROR([USB support requested but required libraries not found.])
|
||||
fi
|
||||
if test "$HAVE_USB" = "yes"; then
|
||||
case ${host_os} in
|
||||
os2*)
|
||||
AC_DEFINE(HAVE_USBCALLS, 1, [Define to 1 if you have usbcall.dll.])
|
||||
;;
|
||||
*)
|
||||
if test "$have_libusb_1_0" = "yes"; then
|
||||
AC_DEFINE(HAVE_LIBUSB_1_0, 1, [Define to 1 if you have libusb-1.0.])
|
||||
else
|
||||
AC_DEFINE(HAVE_LIBUSB, 1, [Define to 1 if you have libusb.])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST(USB_LIBS)
|
||||
AC_ARG_WITH(usb,
|
||||
AS_HELP_STRING([--with-usb], [enable USB support @<:@default=check@:>@]),
|
||||
[],
|
||||
[with_usb=check])
|
||||
AS_IF([test xno != "x$with_usb"],
|
||||
[have_usb=no
|
||||
AS_CASE(x$host_os, dnl odd-ball operating systems first
|
||||
[beos*],
|
||||
[AC_CHECK_HEADER(be/drivers/USB_scanner.h, [have_usb=yes])],
|
||||
[os2*],
|
||||
[AC_CHECK_HEADER(usbcalls.h,
|
||||
[AC_CHECK_LIB(usbcall, UsbQueryNumberDevices,
|
||||
[USB_LIBS="-lusbcall"
|
||||
have_usb=yes
|
||||
AC_DEFINE(HAVE_USBCALLS, [1],
|
||||
[Define to 1 if you have usbcall.dll.])
|
||||
])
|
||||
],
|
||||
[],
|
||||
[#include <usb.h>
|
||||
#include <os2.h>
|
||||
])
|
||||
],
|
||||
[dnl default to libusb-1.x, fall back to libusb-0.x if missing
|
||||
PKG_CHECK_MODULES([USB], [libusb-1.0],
|
||||
[AC_DEFINE([HAVE_LIBUSB], [1],
|
||||
[Define to 1 if you have libusb-1.0])
|
||||
have_usb=yes
|
||||
],
|
||||
[PKG_CHECK_MODULES([USB], [libusb >= 0.1.8],
|
||||
[AC_DEFINE([HAVE_LIBUSB_LEGACY], [1],
|
||||
[Define to 1 if you have libusb-0.1])
|
||||
have_usb=yes
|
||||
],
|
||||
[dnl 10+ years old libusb or Windows version
|
||||
AC_CHECK_HEADER(usb.h,
|
||||
AC_CHECK_LIB(usb, usb_interrupt_read,
|
||||
[USB_LIBS="-lusb"
|
||||
have_usb=yes
|
||||
]))
|
||||
AC_CHECK_HEADERS(lusb0_usb.h,
|
||||
AC_CHECK_LIB(usb, usb_interrupt_read,
|
||||
[USB_LIBS="-lusb"
|
||||
have_usb=yes
|
||||
]))
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
AS_IF([test xyes = "x$with_usb" && test xyes != have_usb],
|
||||
[AC_MSG_ERROR([USB support requested but required libraries not found.])
|
||||
])
|
||||
dnl AM_CONDITIONAL([have_usb], [test x != "x$USB_LIBS])
|
||||
|
||||
dnl ************
|
||||
dnl SCSI Support
|
||||
|
@ -851,10 +829,10 @@ if test "$SELECTED_BACKENDS" != "" ; then
|
|||
echo "*** connected to your local computer won't be supported. Only a network"
|
||||
echo "*** connection to a remote host is possible."
|
||||
fi
|
||||
if test "$enable_libusb" != "no" && test "$HAVE_USB" != "yes" ; then
|
||||
echo "*** Warning: sane-backends will be built without libusb support. There may"
|
||||
if test "$with_usb" != "no" && test "$have_usb" != "yes" ; then
|
||||
echo "*** Warning: sane-backends will be built without USB support. There may"
|
||||
echo "*** be valid reasons to do so, e.g. if you don't use USB scanners or on"
|
||||
echo "*** platforms without libusb support but generally this means that you"
|
||||
echo "*** platforms without USB support but generally this means that you"
|
||||
echo "*** can't use USB devices with SANE. The most probable cause is that"
|
||||
if test "${ac_cv_header_usb_h}" != "yes"; then
|
||||
echo "*** the libusb header file usb.h is not installed. If you use Linux"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
## included LICENSE file for license information.
|
||||
|
||||
AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include \
|
||||
-I$(top_srcdir)/include
|
||||
-I$(top_srcdir)/include $(USB_CFLAGS)
|
||||
|
||||
noinst_LTLIBRARIES = libsanei.la
|
||||
|
||||
|
|
|
@ -67,17 +67,17 @@
|
|||
#include <resmgr.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
#ifdef HAVE_LUSB0_USB_H
|
||||
#include <lusb0_usb.h>
|
||||
#else
|
||||
#include <usb.h>
|
||||
#endif
|
||||
#endif /* HAVE_LIBUSB */
|
||||
#endif /* HAVE_LIBUSB_LEGACY */
|
||||
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
#include <libusb.h>
|
||||
#endif /* HAVE_LIBUSB_1_0 */
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
#ifdef HAVE_USBCALLS
|
||||
#include <usb.h>
|
||||
|
@ -147,14 +147,14 @@ typedef struct
|
|||
SANE_Int interface_nr;
|
||||
SANE_Int alt_setting;
|
||||
SANE_Int missing;
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
usb_dev_handle *libusb_handle;
|
||||
struct usb_device *libusb_device;
|
||||
#endif /* HAVE_LIBUSB */
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#endif /* HAVE_LIBUSB_LEGACY */
|
||||
#ifdef HAVE_LIBUSB
|
||||
libusb_device *lu_device;
|
||||
libusb_device_handle *lu_handle;
|
||||
#endif /* HAVE_LIBUSB_1_0 */
|
||||
#endif /* HAVE_LIBUSB */
|
||||
}
|
||||
device_list_type;
|
||||
|
||||
|
@ -174,13 +174,13 @@ static int device_number=0;
|
|||
* count number of time sanei_usb has been initialized */
|
||||
static int initialized=0;
|
||||
|
||||
#if defined(HAVE_LIBUSB) || defined(HAVE_LIBUSB_1_0)
|
||||
#if defined(HAVE_LIBUSB_LEGACY) || defined(HAVE_LIBUSB)
|
||||
static int libusb_timeout = 30 * 1000; /* 30 seconds */
|
||||
#endif /* HAVE_LIBUSB */
|
||||
#endif /* HAVE_LIBUSB_LEGACY */
|
||||
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
static libusb_context *sanei_usb_ctx;
|
||||
#endif /* HAVE_LIBUSB_1_0 */
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
#if defined (__linux__)
|
||||
/* From /usr/src/linux/driver/usb/scanner.h */
|
||||
|
@ -257,7 +257,7 @@ print_buffer (const SANE_Byte * buffer, SANE_Int size)
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(HAVE_LIBUSB) && !defined(HAVE_LIBUSB_1_0)
|
||||
#if !defined(HAVE_LIBUSB_LEGACY) && !defined(HAVE_LIBUSB)
|
||||
static void
|
||||
kernel_get_vendor_product (int fd, const char *name, int *vendorID, int *productID)
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ kernel_get_vendor_product (int fd, const char *name, int *vendorID, int *product
|
|||
#endif /* defined (__linux__), defined(__BEOS__), ... */
|
||||
/* put more os-dependant stuff ... */
|
||||
}
|
||||
#endif /* !defined(HAVE_LIBUSB) && !defined(HAVE_LIBUSB_1_0) */
|
||||
#endif /* !defined(HAVE_LIBUSB_LEGACY) && !defined(HAVE_LIBUSB) */
|
||||
|
||||
/**
|
||||
* store the given device in device list if it isn't already
|
||||
|
@ -357,10 +357,10 @@ store_device (device_list_type device)
|
|||
* Need to update the LibUSB device pointer, since it might
|
||||
* have changed after the latest USB scan.
|
||||
*/
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
devices[i].libusb_device = device.libusb_device;
|
||||
#endif
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
devices[i].lu_device = device.lu_device;
|
||||
#endif
|
||||
|
||||
|
@ -399,7 +399,7 @@ store_device (device_list_type device)
|
|||
devices[pos].open = SANE_FALSE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
static char *
|
||||
sanei_libusb_strerror (int errcode)
|
||||
{
|
||||
|
@ -453,14 +453,14 @@ sanei_libusb_strerror (int errcode)
|
|||
return "Unknown libusb-1.0 error code";
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LIBUSB_1_0 */
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
void
|
||||
sanei_usb_init (void)
|
||||
{
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
int ret;
|
||||
#endif /* HAVE_LIBUSB_1_0 */
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
DBG_INIT ();
|
||||
#ifdef DBG_LEVEL
|
||||
|
@ -474,18 +474,18 @@ sanei_usb_init (void)
|
|||
memset (devices, 0, sizeof (devices));
|
||||
|
||||
/* initialize USB with old libusb library */
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
DBG (4, "%s: Looking for libusb devices\n", __func__);
|
||||
usb_init ();
|
||||
#ifdef DBG_LEVEL
|
||||
if (DBG_LEVEL > 4)
|
||||
usb_set_debug (255);
|
||||
#endif /* DBG_LEVEL */
|
||||
#endif /* HAVE_LIBUSB */
|
||||
#endif /* HAVE_LIBUSB_LEGACY */
|
||||
|
||||
|
||||
/* initialize USB using libusb-1.0 */
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
if (!sanei_usb_ctx)
|
||||
{
|
||||
DBG (4, "%s: initializing libusb-1.0\n", __func__);
|
||||
|
@ -502,9 +502,9 @@ sanei_usb_init (void)
|
|||
libusb_set_debug (sanei_usb_ctx, 3);
|
||||
#endif /* DBG_LEVEL */
|
||||
}
|
||||
#endif /* HAVE_LIBUSB_1_0 */
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
#if !defined(HAVE_LIBUSB) && !defined(HAVE_LIBUSB_1_0)
|
||||
#if !defined(HAVE_LIBUSB_LEGACY) && !defined(HAVE_LIBUSB)
|
||||
DBG (4, "%s: SANE is built without support for libusb\n", __func__);
|
||||
#endif
|
||||
|
||||
|
@ -544,7 +544,7 @@ int i;
|
|||
devices[i].devname=NULL;
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
if (sanei_usb_ctx)
|
||||
{
|
||||
libusb_exit (sanei_usb_ctx);
|
||||
|
@ -634,7 +634,7 @@ static void usbcall_scan_devices(void)
|
|||
}
|
||||
#endif /* HAVE_USBCALLS */
|
||||
|
||||
#if !defined(HAVE_LIBUSB) && !defined(HAVE_LIBUSB_1_0)
|
||||
#if !defined(HAVE_LIBUSB_LEGACY) && !defined(HAVE_LIBUSB)
|
||||
/** scan for devices using kernel device.
|
||||
* Check for devices using kernel device
|
||||
*/
|
||||
|
@ -733,9 +733,9 @@ static void kernel_scan_devices(void)
|
|||
closedir (dir);
|
||||
}
|
||||
}
|
||||
#endif /* !defined(HAVE_LIBUSB) && !defined(HAVE_LIBUSB_1_0) */
|
||||
#endif /* !defined(HAVE_LIBUSB_LEGACY) && !defined(HAVE_LIBUSB) */
|
||||
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
/** scan for devices using old libusb
|
||||
* Check for devices using 0.1.x libusb
|
||||
*/
|
||||
|
@ -846,9 +846,9 @@ static void libusb_scan_devices(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LIBUSB */
|
||||
#endif /* HAVE_LIBUSB_LEGACY */
|
||||
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
/** scan for devices using libusb
|
||||
* Check for devices using libusb-1.0
|
||||
*/
|
||||
|
@ -1022,7 +1022,7 @@ static void libusb_scan_devices(void)
|
|||
libusb_free_device_list (devlist, 1);
|
||||
|
||||
}
|
||||
#endif /* HAVE_LIBUSB_1_0 */
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
|
||||
void
|
||||
|
@ -1048,11 +1048,11 @@ sanei_usb_scan_devices (void)
|
|||
}
|
||||
|
||||
/* Check for devices using the kernel scanner driver */
|
||||
#if !defined(HAVE_LIBUSB) && !defined(HAVE_LIBUSB_1_0)
|
||||
#if !defined(HAVE_LIBUSB_LEGACY) && !defined(HAVE_LIBUSB)
|
||||
kernel_scan_devices();
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LIBUSB) || defined(HAVE_LIBUSB_1_0)
|
||||
#if defined(HAVE_LIBUSB_LEGACY) || defined(HAVE_LIBUSB)
|
||||
/* Check for devices using libusb (old or new)*/
|
||||
libusb_scan_devices();
|
||||
#endif
|
||||
|
@ -1331,7 +1331,7 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn)
|
|||
|
||||
if (devices[devcount].method == sanei_usb_method_libusb)
|
||||
{
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
struct usb_device *dev;
|
||||
struct usb_interface_descriptor *interface;
|
||||
int result, num;
|
||||
|
@ -1591,7 +1591,7 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn)
|
|||
}
|
||||
}
|
||||
|
||||
#elif defined(HAVE_LIBUSB_1_0) /* libusb-1.0 */
|
||||
#elif defined(HAVE_LIBUSB) /* libusb-1.0 */
|
||||
|
||||
int config;
|
||||
libusb_device *dev;
|
||||
|
@ -1894,11 +1894,11 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn)
|
|||
libusb_free_config_descriptor (config);
|
||||
}
|
||||
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
DBG (1, "sanei_usb_open: can't open device `%s': "
|
||||
"libusb support missing\n", devname);
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
#endif /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#endif /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
}
|
||||
else if (devices[devcount].method == sanei_usb_method_scanner_driver)
|
||||
{
|
||||
|
@ -2136,7 +2136,7 @@ sanei_usb_close (SANE_Int dn)
|
|||
#endif
|
||||
}
|
||||
else
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
{
|
||||
/* This call seems to be required by Linux xhci driver
|
||||
* even though it should be a no-op. Without it, the
|
||||
|
@ -2151,7 +2151,7 @@ sanei_usb_close (SANE_Int dn)
|
|||
devices[dn].interface_nr);
|
||||
usb_close (devices[dn].libusb_handle);
|
||||
}
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
{
|
||||
/* This call seems to be required by Linux xhci driver
|
||||
* even though it should be a no-op. Without it, the
|
||||
|
@ -2166,7 +2166,7 @@ sanei_usb_close (SANE_Int dn)
|
|||
devices[dn].interface_nr);
|
||||
libusb_close (devices[dn].lu_handle);
|
||||
}
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
DBG (1, "sanei_usb_close: libusb support missing\n");
|
||||
#endif
|
||||
devices[dn].open = SANE_FALSE;
|
||||
|
@ -2176,11 +2176,11 @@ sanei_usb_close (SANE_Int dn)
|
|||
void
|
||||
sanei_usb_set_timeout (SANE_Int timeout)
|
||||
{
|
||||
#if defined(HAVE_LIBUSB) || defined(HAVE_LIBUSB_1_0)
|
||||
#if defined(HAVE_LIBUSB_LEGACY) || defined(HAVE_LIBUSB)
|
||||
libusb_timeout = timeout;
|
||||
#else
|
||||
DBG (1, "sanei_usb_set_timeout: libusb support missing\n");
|
||||
#endif /* HAVE_LIBUSB || HAVE_LIBUSB_1_0 */
|
||||
#endif /* HAVE_LIBUSB_LEGACY || HAVE_LIBUSB */
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
|
@ -2204,7 +2204,7 @@ sanei_usb_clear_halt (SANE_Int dn)
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
|
||||
/* This call seems to be required by Linux xhci driver
|
||||
* even though it should be a no-op. Without it, the
|
||||
|
@ -2227,7 +2227,7 @@ sanei_usb_clear_halt (SANE_Int dn)
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
|
||||
/* This call seems to be required by Linux xhci driver
|
||||
* even though it should be a no-op. Without it, the
|
||||
|
@ -2249,9 +2249,9 @@ sanei_usb_clear_halt (SANE_Int dn)
|
|||
DBG (1, "sanei_usb_clear_halt: BULK_OUT ret=%d\n", ret);
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
DBG (1, "sanei_usb_clear_halt: libusb support missing\n");
|
||||
#endif /* HAVE_LIBUSB || HAVE_LIBUSB_1_0 */
|
||||
#endif /* HAVE_LIBUSB_LEGACY || HAVE_LIBUSB */
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
@ -2259,7 +2259,7 @@ sanei_usb_clear_halt (SANE_Int dn)
|
|||
SANE_Status
|
||||
sanei_usb_reset (SANE_Int dn)
|
||||
{
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
int ret;
|
||||
|
||||
ret = usb_reset (devices[dn].libusb_handle);
|
||||
|
@ -2268,7 +2268,7 @@ sanei_usb_reset (SANE_Int dn)
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
int ret;
|
||||
|
||||
ret = libusb_reset_device (devices[dn].lu_handle);
|
||||
|
@ -2277,9 +2277,9 @@ sanei_usb_reset (SANE_Int dn)
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
DBG (1, "sanei_usb_reset: libusb support missing\n");
|
||||
#endif /* HAVE_LIBUSB || HAVE_LIBUSB_1_0 */
|
||||
#endif /* HAVE_LIBUSB_LEGACY || HAVE_LIBUSB */
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
@ -2312,7 +2312,7 @@ sanei_usb_read_bulk (SANE_Int dn, SANE_Byte * buffer, size_t * size)
|
|||
strerror (errno));
|
||||
}
|
||||
else if (devices[dn].method == sanei_usb_method_libusb)
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
{
|
||||
if (devices[dn].bulk_in_ep)
|
||||
{
|
||||
|
@ -2331,7 +2331,7 @@ sanei_usb_read_bulk (SANE_Int dn, SANE_Byte * buffer, size_t * size)
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
}
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
{
|
||||
if (devices[dn].bulk_in_ep)
|
||||
{
|
||||
|
@ -2356,12 +2356,12 @@ sanei_usb_read_bulk (SANE_Int dn, SANE_Byte * buffer, size_t * size)
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
}
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
{
|
||||
DBG (1, "sanei_usb_read_bulk: libusb support missing\n");
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
#endif /* not HAVE_LIBUSB */
|
||||
#endif /* not HAVE_LIBUSB_LEGACY */
|
||||
else if (devices[dn].method == sanei_usb_method_usbcalls)
|
||||
{
|
||||
#ifdef HAVE_USBCALLS
|
||||
|
@ -2407,10 +2407,10 @@ sanei_usb_read_bulk (SANE_Int dn, SANE_Byte * buffer, size_t * size)
|
|||
|
||||
if (read_size < 0)
|
||||
{
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
if (devices[dn].method == sanei_usb_method_libusb)
|
||||
usb_clear_halt (devices[dn].libusb_handle, devices[dn].bulk_in_ep);
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
if (devices[dn].method == sanei_usb_method_libusb)
|
||||
libusb_clear_halt (devices[dn].lu_handle, devices[dn].bulk_in_ep);
|
||||
#endif
|
||||
|
@ -2462,7 +2462,7 @@ sanei_usb_write_bulk (SANE_Int dn, const SANE_Byte * buffer, size_t * size)
|
|||
strerror (errno));
|
||||
}
|
||||
else if (devices[dn].method == sanei_usb_method_libusb)
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
{
|
||||
if (devices[dn].bulk_out_ep)
|
||||
{
|
||||
|
@ -2481,7 +2481,7 @@ sanei_usb_write_bulk (SANE_Int dn, const SANE_Byte * buffer, size_t * size)
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
}
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
{
|
||||
if (devices[dn].bulk_out_ep)
|
||||
{
|
||||
|
@ -2509,12 +2509,12 @@ sanei_usb_write_bulk (SANE_Int dn, const SANE_Byte * buffer, size_t * size)
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
}
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
{
|
||||
DBG (1, "sanei_usb_write_bulk: libusb support missing\n");
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
#endif /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#endif /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
else if (devices[dn].method == sanei_usb_method_usbcalls)
|
||||
{
|
||||
#ifdef HAVE_USBCALLS
|
||||
|
@ -2562,10 +2562,10 @@ sanei_usb_write_bulk (SANE_Int dn, const SANE_Byte * buffer, size_t * size)
|
|||
if (write_size < 0)
|
||||
{
|
||||
*size = 0;
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
if (devices[dn].method == sanei_usb_method_libusb)
|
||||
usb_clear_halt (devices[dn].libusb_handle, devices[dn].bulk_out_ep);
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
if (devices[dn].method == sanei_usb_method_libusb)
|
||||
libusb_clear_halt (devices[dn].lu_handle, devices[dn].bulk_out_ep);
|
||||
#endif
|
||||
|
@ -2641,7 +2641,7 @@ sanei_usb_control_msg (SANE_Int dn, SANE_Int rtype, SANE_Int req,
|
|||
#endif /* not __linux__ */
|
||||
}
|
||||
else if (devices[dn].method == sanei_usb_method_libusb)
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -2658,7 +2658,7 @@ sanei_usb_control_msg (SANE_Int dn, SANE_Int rtype, SANE_Int req,
|
|||
print_buffer (data, len);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -2675,12 +2675,12 @@ sanei_usb_control_msg (SANE_Int dn, SANE_Int rtype, SANE_Int req,
|
|||
print_buffer (data, len);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0*/
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB*/
|
||||
{
|
||||
DBG (1, "sanei_usb_control_msg: libusb support missing\n");
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
#endif /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#endif /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
else if (devices[dn].method == sanei_usb_method_usbcalls)
|
||||
{
|
||||
#ifdef HAVE_USBCALLS
|
||||
|
@ -2717,7 +2717,7 @@ SANE_Status
|
|||
sanei_usb_read_int (SANE_Int dn, SANE_Byte * buffer, size_t * size)
|
||||
{
|
||||
ssize_t read_size = 0;
|
||||
#if defined(HAVE_LIBUSB) || defined(HAVE_LIBUSB_1_0)
|
||||
#if defined(HAVE_LIBUSB_LEGACY) || defined(HAVE_LIBUSB)
|
||||
SANE_Bool stalled = SANE_FALSE;
|
||||
#endif
|
||||
|
||||
|
@ -2742,7 +2742,7 @@ sanei_usb_read_int (SANE_Int dn, SANE_Byte * buffer, size_t * size)
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
else if (devices[dn].method == sanei_usb_method_libusb)
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
{
|
||||
if (devices[dn].int_in_ep)
|
||||
{
|
||||
|
@ -2764,7 +2764,7 @@ sanei_usb_read_int (SANE_Int dn, SANE_Byte * buffer, size_t * size)
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
}
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
{
|
||||
if (devices[dn].int_in_ep)
|
||||
{
|
||||
|
@ -2789,12 +2789,12 @@ sanei_usb_read_int (SANE_Int dn, SANE_Byte * buffer, size_t * size)
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
}
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
{
|
||||
DBG (1, "sanei_usb_read_int: libusb support missing\n");
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
#endif /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#endif /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
else if (devices[dn].method == sanei_usb_method_usbcalls)
|
||||
{
|
||||
#ifdef HAVE_USBCALLS
|
||||
|
@ -2833,11 +2833,11 @@ sanei_usb_read_int (SANE_Int dn, SANE_Byte * buffer, size_t * size)
|
|||
|
||||
if (read_size < 0)
|
||||
{
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
if (devices[dn].method == sanei_usb_method_libusb)
|
||||
if (stalled)
|
||||
usb_clear_halt (devices[dn].libusb_handle, devices[dn].int_in_ep);
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
if (devices[dn].method == sanei_usb_method_libusb)
|
||||
if (stalled)
|
||||
libusb_clear_halt (devices[dn].lu_handle, devices[dn].int_in_ep);
|
||||
|
@ -2883,7 +2883,7 @@ sanei_usb_set_configuration (SANE_Int dn, SANE_Int configuration)
|
|||
#endif /* not __linux__ */
|
||||
}
|
||||
else if (devices[dn].method == sanei_usb_method_libusb)
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -2897,7 +2897,7 @@ sanei_usb_set_configuration (SANE_Int dn, SANE_Int configuration)
|
|||
}
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -2910,12 +2910,12 @@ sanei_usb_set_configuration (SANE_Int dn, SANE_Int configuration)
|
|||
}
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
{
|
||||
DBG (1, "sanei_usb_set_configuration: libusb support missing\n");
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
#endif /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#endif /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
else
|
||||
{
|
||||
DBG (1,
|
||||
|
@ -2953,7 +2953,7 @@ sanei_usb_claim_interface (SANE_Int dn, SANE_Int interface_number)
|
|||
#endif /* not __linux__ */
|
||||
}
|
||||
else if (devices[dn].method == sanei_usb_method_libusb)
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -2966,7 +2966,7 @@ sanei_usb_claim_interface (SANE_Int dn, SANE_Int interface_number)
|
|||
}
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -2979,12 +2979,12 @@ sanei_usb_claim_interface (SANE_Int dn, SANE_Int interface_number)
|
|||
}
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
{
|
||||
DBG (1, "sanei_usb_claim_interface: libusb support missing\n");
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
#endif /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#endif /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
else
|
||||
{
|
||||
DBG (1, "sanei_usb_claim_interface: access method %d not implemented\n",
|
||||
|
@ -3020,7 +3020,7 @@ sanei_usb_release_interface (SANE_Int dn, SANE_Int interface_number)
|
|||
#endif /* not __linux__ */
|
||||
}
|
||||
else if (devices[dn].method == sanei_usb_method_libusb)
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -3033,7 +3033,7 @@ sanei_usb_release_interface (SANE_Int dn, SANE_Int interface_number)
|
|||
}
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -3046,12 +3046,12 @@ sanei_usb_release_interface (SANE_Int dn, SANE_Int interface_number)
|
|||
}
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
{
|
||||
DBG (1, "sanei_usb_release_interface: libusb support missing\n");
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
#endif /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#endif /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
else
|
||||
{
|
||||
DBG (1,
|
||||
|
@ -3086,7 +3086,7 @@ sanei_usb_set_altinterface (SANE_Int dn, SANE_Int alternate)
|
|||
#endif /* not __linux__ */
|
||||
}
|
||||
else if (devices[dn].method == sanei_usb_method_libusb)
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -3099,7 +3099,7 @@ sanei_usb_set_altinterface (SANE_Int dn, SANE_Int alternate)
|
|||
}
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -3113,12 +3113,12 @@ sanei_usb_set_altinterface (SANE_Int dn, SANE_Int alternate)
|
|||
}
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
{
|
||||
DBG (1, "sanei_set_altinterface: libusb support missing\n");
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
#endif /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#endif /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
else
|
||||
{
|
||||
DBG (1,
|
||||
|
@ -3140,7 +3140,7 @@ sanei_usb_get_descriptor( SANE_Int dn, struct sanei_usb_dev_descriptor *desc )
|
|||
}
|
||||
|
||||
DBG (5, "sanei_usb_get_descriptor\n");
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
{
|
||||
struct usb_device_descriptor *usb_descr;
|
||||
|
||||
|
@ -3155,7 +3155,7 @@ sanei_usb_get_descriptor( SANE_Int dn, struct sanei_usb_dev_descriptor *desc )
|
|||
desc->max_packet_size = usb_descr->bMaxPacketSize0;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
{
|
||||
struct libusb_device_descriptor lu_desc;
|
||||
int ret;
|
||||
|
@ -3180,10 +3180,10 @@ sanei_usb_get_descriptor( SANE_Int dn, struct sanei_usb_dev_descriptor *desc )
|
|||
desc->max_packet_size = lu_desc.bMaxPacketSize0;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
{
|
||||
DBG (1, "sanei_usb_get_descriptor: libusb support missing\n");
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
#endif /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#endif /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ TEST_LDADD = ../../sanei/libsanei.la ../../lib/liblib.la $(MATH_LIB) $(USB_LIBS)
|
|||
check_PROGRAMS = sanei_usb_test test_wire sanei_check_test sanei_config_test sanei_constrain_test
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include $(USB_CFLAGS)
|
||||
|
||||
sanei_constrain_test_SOURCES = sanei_constrain_test.c
|
||||
sanei_constrain_test_LDADD = $(TEST_LDADD)
|
||||
|
|
|
@ -130,13 +130,13 @@ create_mock_device (char *devname, device_list_type * device)
|
|||
device->devname = strdup (devname);
|
||||
device->vendor = 0xdead;
|
||||
device->product = 0xbeef;
|
||||
#if defined(HAVE_LIBUSB) || defined(HAVE_LIBUSB_1_0)
|
||||
#if defined(HAVE_LIBUSB_LEGACY) || defined(HAVE_LIBUSB)
|
||||
device->method = sanei_usb_method_libusb;
|
||||
#endif
|
||||
#ifdef HAVE_USBCALLS
|
||||
device->method = sanei_usb_method_usbcalls;
|
||||
#endif
|
||||
#if !defined(HAVE_LIBUSB) && !defined(HAVE_LIBUSB_1_0) && !defined(HAVE_USBCALLS)
|
||||
#if !defined(HAVE_LIBUSB_LEGACY) && !defined(HAVE_LIBUSB) && !defined(HAVE_USBCALLS)
|
||||
device->method == sanei_usb_method_scanner_driver;
|
||||
#endif
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ test_vendor_by_id (void)
|
|||
static int
|
||||
test_timeout (void)
|
||||
{
|
||||
#if defined(HAVE_LIBUSB) || defined(HAVE_LIBUSB_1_0)
|
||||
#if defined(HAVE_LIBUSB_LEGACY) || defined(HAVE_LIBUSB)
|
||||
int timeout = libusb_timeout;
|
||||
|
||||
sanei_usb_set_timeout (5000);
|
||||
|
@ -832,16 +832,16 @@ main (int argc, char **argv)
|
|||
int detected, opened, i;
|
||||
SANE_Int dn[MAX_DEVICES];
|
||||
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
printf ("\n%s built with old libusb\n\n", argv[0]);
|
||||
#endif
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
printf ("\n%s built with libusb-1.0\n\n", argv[0]);
|
||||
#endif
|
||||
#ifdef HAVE_USBCALLS
|
||||
printf ("\n%s built with usbcalls\n\n", argv[0]);
|
||||
#endif
|
||||
#if !defined(HAVE_LIBUSB) && !defined(HAVE_LIBUSB_1_0) && !defined(HAVE_USBCALLS)
|
||||
#if !defined(HAVE_LIBUSB_LEGACY) && !defined(HAVE_LIBUSB) && !defined(HAVE_USBCALLS)
|
||||
printf ("\n%s relying on deprecated scanner kernel module\n", argv[0]);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
## included LICENSE file for license information.
|
||||
|
||||
AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include \
|
||||
-I$(top_srcdir)/include
|
||||
-I$(top_srcdir)/include $(USB_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = sane-find-scanner gamma4scanimage
|
||||
noinst_PROGRAMS = sane-desc
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "../include/sane/config.h"
|
||||
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
|
||||
#include "../include/sane/sane.h"
|
||||
#include <stdio.h>
|
||||
|
@ -3430,9 +3430,9 @@ check_usb_chip (struct usb_device *dev, int verbosity, SANE_Bool from_file)
|
|||
return chip_name;
|
||||
}
|
||||
|
||||
#endif /* HAVE_LIBUSB */
|
||||
#endif /* HAVE_LIBUSB_LEGACY */
|
||||
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
|
||||
#include <libusb.h>
|
||||
|
||||
|
@ -4335,4 +4335,4 @@ check_usb_chip (int verbosity,
|
|||
libusb_release_interface (hdl, 0);
|
||||
return chip_name;
|
||||
}
|
||||
#endif /* HAVE_LIBUSB_1_0 */
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "../include/sane/sanei_pa4s2.h"
|
||||
#include "../include/sane/sanei_config.h"
|
||||
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
#ifdef HAVE_LUSB0_USB_H
|
||||
#include <lusb0_usb.h>
|
||||
#else
|
||||
|
@ -55,7 +55,7 @@
|
|||
extern char * check_usb_chip (struct usb_device *dev, int verbosity, SANE_Bool from_file);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
#include <libusb.h>
|
||||
extern char * check_usb_chip (int verbosity,
|
||||
struct libusb_device_descriptor desc,
|
||||
|
@ -76,7 +76,7 @@ static SANE_Bool device_found = SANE_FALSE;
|
|||
static SANE_Bool libusb_device_found = SANE_FALSE;
|
||||
static SANE_Bool unknown_found = SANE_FALSE;
|
||||
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
libusb_context *sfs_usb_ctx;
|
||||
#endif
|
||||
|
||||
|
@ -115,7 +115,7 @@ usage (char *msg)
|
|||
fprintf (stderr, "\t-f: force opening devname as SCSI even if it looks "
|
||||
"like USB\n");
|
||||
fprintf (stderr, "\t-p: enable scanning for parallel port devices\n");
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
fprintf (stderr, "\t-F file: try to detect chipset from given "
|
||||
"/proc/bus/usb/devices file\n");
|
||||
#endif
|
||||
|
@ -403,7 +403,7 @@ check_usb_file (char *file_name)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
|
||||
static char *
|
||||
get_libusb_string_descriptor (struct usb_device *dev, int index)
|
||||
|
@ -701,10 +701,10 @@ check_libusb_device (struct usb_device *dev, SANE_Bool from_file)
|
|||
if (product)
|
||||
free (product);
|
||||
}
|
||||
#endif /* HAVE_LIBUSB */
|
||||
#endif /* HAVE_LIBUSB_LEGACY */
|
||||
|
||||
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
#ifdef HAVE_LIBUSB
|
||||
static char *
|
||||
sfs_libusb_strerror (int errcode)
|
||||
{
|
||||
|
@ -1095,7 +1095,7 @@ check_libusb_device (libusb_device *dev, SANE_Bool from_file)
|
|||
if (product)
|
||||
free (product);
|
||||
}
|
||||
#endif /* HAVE_LIBUSB_1_0 */
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
|
||||
static DIR *
|
||||
|
@ -1355,7 +1355,7 @@ check_mustek_pp_device (void)
|
|||
return (found > 0 || scsi > 0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
static SANE_Bool
|
||||
parse_num (char* search, const char* line, int base, long int * number)
|
||||
{
|
||||
|
@ -1596,9 +1596,9 @@ main (int argc, char **argv)
|
|||
break;
|
||||
|
||||
case 'F':
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
parse_file ((char *) (*(++ap)));
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
printf ("option -F not implemented with libusb-1.0\n");
|
||||
#else
|
||||
printf ("libusb not available: option -F can't be used\n");
|
||||
|
@ -1948,7 +1948,7 @@ main (int argc, char **argv)
|
|||
check_usb_file (dev_name);
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_LIBUSB
|
||||
#ifdef HAVE_LIBUSB_LEGACY
|
||||
/* Now the libusb devices */
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
|
@ -1973,7 +1973,7 @@ main (int argc, char **argv)
|
|||
} /* for (bus) */
|
||||
}
|
||||
}
|
||||
#elif defined(HAVE_LIBUSB_1_0)
|
||||
#elif defined(HAVE_LIBUSB)
|
||||
/* Now the libusb-1.0 devices */
|
||||
{
|
||||
if (ap < argv + argc)
|
||||
|
@ -2026,10 +2026,10 @@ main (int argc, char **argv)
|
|||
; /* init failed, jumping here */
|
||||
}
|
||||
}
|
||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
if (verbose > 1)
|
||||
printf ("libusb not available\n");
|
||||
#endif /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
|
||||
#endif /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
|
||||
|
||||
if (device_found)
|
||||
{
|
||||
|
@ -2062,7 +2062,7 @@ main (int argc, char **argv)
|
|||
"make sure that\n # you have loaded a kernel driver for your USB host "
|
||||
"controller and have setup\n # the USB system correctly. "
|
||||
"See man sane-usb for details.\n");
|
||||
#if !defined(HAVE_LIBUSB) && !defined(HAVE_LIBUSB_1_0)
|
||||
#if !defined(HAVE_LIBUSB_LEGACY) && !defined(HAVE_LIBUSB)
|
||||
if (verbose > 0)
|
||||
printf (" # SANE has been built without libusb support. This may be a "
|
||||
"reason\n # for not detecting USB scanners. Read README for "
|
||||
|
|
Ładowanie…
Reference in New Issue