summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-10-08 12:32:49 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-10-08 12:32:49 +0200
commitcfd27ef2ad8b005fd47ab41ef29b71d9e3d48201 (patch)
tree56cb8849a5df91b19b72fd4f48c79c343cd9bc5e /tools
parentba8d09abe681600aad991f4a75e904615b7ed29f (diff)
Imported Upstream version 1.0.25upstream/1.0.25
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am7
-rw-r--r--tools/Makefile.in21
-rw-r--r--tools/check-usb-chip.c210
-rw-r--r--tools/sane-desc.c11
-rw-r--r--tools/sane-find-scanner.c2
5 files changed, 239 insertions, 12 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 7c2a616..2024180 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -8,7 +8,12 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include \
-I$(top_srcdir)/include
bin_PROGRAMS = sane-find-scanner gamma4scanimage
-noinst_PROGRAMS = sane-desc umax_pp
+noinst_PROGRAMS = sane-desc
+if INSTALL_UMAX_PP_TOOLS
+bin_PROGRAMS = umax_pp
+else
+noinst_PROGRAMS = umax_pp
+endif
if CROSS_COMPILING
HOTPLUG =
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 367a70b..49d5953 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.13.4 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
@@ -80,8 +80,15 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-bin_PROGRAMS = sane-find-scanner$(EXEEXT) gamma4scanimage$(EXEEXT)
-noinst_PROGRAMS = sane-desc$(EXEEXT) umax_pp$(EXEEXT)
+@INSTALL_UMAX_PP_TOOLS_FALSE@bin_PROGRAMS = \
+@INSTALL_UMAX_PP_TOOLS_FALSE@ sane-find-scanner$(EXEEXT) \
+@INSTALL_UMAX_PP_TOOLS_FALSE@ gamma4scanimage$(EXEEXT)
+@INSTALL_UMAX_PP_TOOLS_TRUE@bin_PROGRAMS = umax_pp$(EXEEXT) \
+@INSTALL_UMAX_PP_TOOLS_TRUE@ sane-find-scanner$(EXEEXT) \
+@INSTALL_UMAX_PP_TOOLS_TRUE@ gamma4scanimage$(EXEEXT)
+@INSTALL_UMAX_PP_TOOLS_FALSE@noinst_PROGRAMS = umax_pp$(EXEEXT) \
+@INSTALL_UMAX_PP_TOOLS_FALSE@ sane-desc$(EXEEXT)
+@INSTALL_UMAX_PP_TOOLS_TRUE@noinst_PROGRAMS = sane-desc$(EXEEXT)
subdir = tools
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/mkinstalldirs $(srcdir)/sane-config.in \
@@ -303,6 +310,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PNG_LIBS = @PNG_LIBS@
PRELOADABLE_BACKENDS = @PRELOADABLE_BACKENDS@
PRELOADABLE_BACKENDS_ENABLED = @PRELOADABLE_BACKENDS_ENABLED@
PTHREAD_LIBS = @PTHREAD_LIBS@
@@ -314,11 +322,14 @@ SCSI_LIBS = @SCSI_LIBS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
SNMP_CONFIG_PATH = @SNMP_CONFIG_PATH@
+SNMP_LIBS = @SNMP_LIBS@
SOCKET_LIBS = @SOCKET_LIBS@
STRICT_LDFLAGS = @STRICT_LDFLAGS@
STRIP = @STRIP@
SYSLOG_LIBS = @SYSLOG_LIBS@
+SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@
SYSTEMD_LIBS = @SYSTEMD_LIBS@
TIFF_LIBS = @TIFF_LIBS@
USB_LIBS = @USB_LIBS@
@@ -584,14 +595,14 @@ distclean-compile:
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/tools/check-usb-chip.c b/tools/check-usb-chip.c
index 68b8f79..e851855 100644
--- a/tools/check-usb-chip.c
+++ b/tools/check-usb-chip.c
@@ -4063,6 +4063,213 @@ check_genesys (libusb_device_handle * handle,
return "GL646_HP";
}
+/********** the lm983x section **********/
+
+static int
+lm983x_wb (libusb_device_handle *handle, unsigned char reg, unsigned char val)
+{
+ unsigned char buf[5];
+ int written;
+ int result;
+
+ buf[0] = 0;
+ buf[1] = reg;
+ buf[2] = 0;
+ buf[3] = 1;
+ buf[4] = val;
+
+ result = libusb_bulk_transfer(handle, 0x03, buf, 5, &written, TIMEOUT);
+ if (result < 0)
+ return 0;
+
+ if (written != 5)
+ return 0;
+
+ return 1;
+}
+
+static int
+lm983x_rb (libusb_device_handle *handle, unsigned char reg, unsigned char *val)
+{
+ unsigned char buf[5];
+ int result;
+ int tfx;
+
+ buf[0] = 1;
+ buf[1] = reg;
+ buf[2] = 0;
+ buf[3] = 1;
+
+ result = libusb_bulk_transfer(handle, 0x03, buf, 4, &tfx, TIMEOUT);
+ if (result < 0)
+ return 0;
+
+ if (tfx != 4)
+ return 0;
+
+ result = libusb_bulk_transfer(handle, 0x82, val, 1, &tfx, TIMEOUT);
+ if (result < 0)
+ return 0;
+
+ if (tfx != 1)
+ return 0;
+
+ return 1;
+}
+
+/** @brief check for known LM983x chip (aka Merlin)
+ *
+ * Try to check if the scanner uses a LM983x ASIC.
+ *
+ * @param dev libusb device
+ * @param hdl libusb opened handle
+ * @param config0 configuration 0 from get config _descriptor
+ * @return a string with ASIC name, or NULL if not recognized
+ */
+static char *
+check_merlin(libusb_device_handle * handle,
+ struct libusb_device_descriptor desc,
+ struct libusb_config_descriptor *config0)
+{
+ unsigned char val;
+ int result;
+
+ if (verbose > 2)
+ printf (" checking for LM983[1,2,3] ...\n");
+
+ /* Check device descriptor */
+ if (((desc.bDeviceClass != LIBUSB_CLASS_VENDOR_SPEC)
+ && (desc.bDeviceClass != 0))
+ || (config0->interface[0].altsetting[0].bInterfaceClass !=
+ LIBUSB_CLASS_VENDOR_SPEC))
+ {
+ if (verbose > 2)
+ printf
+ (" this is not a LM983x (bDeviceClass = %d, bInterfaceClass = %d)\n",
+ desc.bDeviceClass,
+ config0->interface[0].altsetting[0].bInterfaceClass);
+ return 0;
+ }
+ if ((desc.bcdUSB != 0x110)
+ && (desc.bcdUSB != 0x101)
+ && (desc.bcdUSB != 0x100))
+ {
+ if (verbose > 2)
+ printf (" this is not a LM983x (bcdUSB = 0x%x)\n", desc.bcdUSB);
+ return 0;
+ }
+ if (desc.bDeviceSubClass != 0x00)
+ {
+ if (verbose > 2)
+ printf (" this is not a LM983x (bDeviceSubClass = 0x%x)\n",
+ desc.bDeviceSubClass);
+ return 0;
+ }
+ if ((desc.bDeviceProtocol != 0) &&
+ (desc.bDeviceProtocol != 0xff))
+ {
+ if (verbose > 2)
+ printf (" this is not a LM983x (bDeviceProtocol = 0x%x)\n",
+ desc.bDeviceProtocol);
+ return 0;
+ }
+
+ /* Check endpoints */
+ if (config0->interface[0].altsetting[0].bNumEndpoints != 3)
+ {
+ if (verbose > 2)
+ printf (" this is not a LM983x (bNumEndpoints = %d)\n",
+ config0->interface[0].altsetting[0].bNumEndpoints);
+ return 0;
+ }
+
+ if ((config0->interface[0].altsetting[0].endpoint[0].bEndpointAddress != 0x81)
+ || (config0->interface[0].altsetting[0].endpoint[0].bmAttributes != 0x03)
+ || (config0->interface[0].altsetting[0].endpoint[0].wMaxPacketSize != 0x1)
+ || (config0->interface[0].altsetting[0].endpoint[0].bInterval != 0x10))
+ {
+ if (verbose > 2)
+ printf
+ (" this is not a LM983x (bEndpointAddress = 0x%x, bmAttributes = 0x%x, "
+ "wMaxPacketSize = 0x%x, bInterval = 0x%x)\n",
+ config0->interface[0].altsetting[0].endpoint[0].bEndpointAddress,
+ config0->interface[0].altsetting[0].endpoint[0].bmAttributes,
+ config0->interface[0].altsetting[0].endpoint[0].wMaxPacketSize,
+ config0->interface[0].altsetting[0].endpoint[0].bInterval);
+ return 0;
+ }
+
+ if ((config0->interface[0].altsetting[0].endpoint[1].bEndpointAddress != 0x82)
+ || (config0->interface[0].altsetting[0].endpoint[1].bmAttributes != 0x02)
+ || (config0->interface[0].altsetting[0].endpoint[1].wMaxPacketSize != 0x40)
+ /* Currently disabled as we have some problems in detection here ! */
+ /*|| (config0->interface[0].altsetting[0].endpoint[1].bInterval != 0) */
+ )
+ {
+ if (verbose > 2)
+ printf
+ (" this is not a LM983x (bEndpointAddress = 0x%x, bmAttributes = 0x%x, "
+ "wMaxPacketSize = 0x%x, bInterval = 0x%x)\n",
+ config0->interface[0].altsetting[0].endpoint[1].bEndpointAddress,
+ config0->interface[0].altsetting[0].endpoint[1].bmAttributes,
+ config0->interface[0].altsetting[0].endpoint[1].wMaxPacketSize,
+ config0->interface[0].altsetting[0].endpoint[1].bInterval);
+ return 0;
+ }
+
+ if ((config0->interface[0].altsetting[0].endpoint[2].bEndpointAddress != 0x03)
+ || (config0->interface[0].altsetting[0].endpoint[2].bmAttributes != 0x02)
+ || (config0->interface[0].altsetting[0].endpoint[2].wMaxPacketSize != 0x40)
+ /* Currently disabled as we have some problems in detection here ! */
+ /* || (config0->interface[0].altsetting[0].endpoint[2].bInterval != 0) */
+ )
+ {
+ if (verbose > 2)
+ printf
+ (" this is not a LM983x (bEndpointAddress = 0x%x, bmAttributes = 0x%x, "
+ "wMaxPacketSize = 0x%x, bInterval = 0x%x)\n",
+ config0->interface[0].altsetting[0].endpoint[2].bEndpointAddress,
+ config0->interface[0].altsetting[0].endpoint[2].bmAttributes,
+ config0->interface[0].altsetting[0].endpoint[2].wMaxPacketSize,
+ config0->interface[0].altsetting[0].endpoint[2].bInterval);
+ return 0;
+ }
+
+ result = lm983x_wb (handle, 0x07, 0x00);
+ if (1 == result)
+ result = lm983x_wb (handle, 0x08, 0x02);
+ if (1 == result)
+ result = lm983x_rb (handle, 0x07, &val);
+ if (1 == result)
+ result = lm983x_rb (handle, 0x08, &val);
+ if (1 == result)
+ result = lm983x_rb (handle, 0x69, &val);
+
+ if (0 == result)
+ {
+ if (verbose > 2)
+ printf (" Couldn't access LM983x registers.\n");
+ return 0;
+ }
+
+ switch (val)
+ {
+ case 4:
+ return "LM9832/3";
+ break;
+ case 3:
+ return "LM9831";
+ break;
+ case 2:
+ return "LM9830";
+ break;
+ default:
+ return "LM983x?";
+ break;
+ }
+}
+
+
char *
check_usb_chip (int verbosity,
struct libusb_device_descriptor desc,
@@ -4102,6 +4309,9 @@ check_usb_chip (int verbosity,
/* now USB is opened and set up, actual chip detection */
if (!chip_name)
+ chip_name = check_merlin (hdl, desc, config0);
+
+ if (!chip_name)
chip_name = check_gt6801 (hdl, desc, config0);
if (!chip_name)
diff --git a/tools/sane-desc.c b/tools/sane-desc.c
index 3cc4407..badc8ce 100644
--- a/tools/sane-desc.c
+++ b/tools/sane-desc.c
@@ -2878,7 +2878,7 @@ static void
html_print_legend_model (void)
{
printf
- (" <dt><b>Model:</b></dt>\n" " <dd>Name of the the device.</dd>\n");
+ (" <dt><b>Model:</b></dt>\n" " <dd>Name of the device.</dd>\n");
}
static void
@@ -3568,7 +3568,8 @@ print_udev (void)
printf ("\nLABEL=\"libsane_usb_rules_end\"\n\n");
- printf ("SUBSYSTEMS!=\"scsi\", GOTO=\"libsane_scsi_rules_end\"\n\n");
+ printf ("SUBSYSTEMS==\"scsi\", GOTO=\"libsane_scsi_rules_begin\"\n");
+ printf ("GOTO=\"libsane_scsi_rules_end\"\n\n");
printf ("LABEL=\"libsane_scsi_rules_begin\"\n");
printf ("# Generic: SCSI device type 6 indicates a scanner\n");
@@ -3695,7 +3696,9 @@ print_udevhwdb (void)
printf("# The following rule will disable USB autosuspend for the device\n");
printf("ENV{DEVTYPE}==\"usb_device\", ENV{libsane_matched}==\"yes\", TEST==\"power/control\", ATTR{power/control}=\"on\"\n\n");
- printf ("SUBSYSTEMS!=\"scsi\", GOTO=\"libsane_rules_end\"\n");
+ printf ("SUBSYSTEMS==\"scsi\", GOTO=\"libsane_scsi_rules_begin\"\n");
+ printf ("GOTO=\"libsane_rules_end\"\n\n");
+ printf ("LABEL=\"libsane_scsi_rules_begin\"\n");
printf ("KERNEL!=\"sg[0-9]*\", GOTO=\"libsane_rules_end\"\n\n");
printf ("# Generic: SCSI device type 6 indicates a scanner\n");
@@ -3827,7 +3830,7 @@ print_hwdb (void)
for(j = 0; j < 4; j++) {
vendor_id[j] = toupper(vendor_id[j]);
- product_id[j] = toupper(vendor_id[j]);
+ product_id[j] = toupper(product_id[j]);
}
printf ("usb:v%sp%s*\n libsane_matched=yes\n\n",
diff --git a/tools/sane-find-scanner.c b/tools/sane-find-scanner.c
index dbfd0da..ae0e116 100644
--- a/tools/sane-find-scanner.c
+++ b/tools/sane-find-scanner.c
@@ -757,8 +757,6 @@ sfs_libusb_strerror (int errcode)
default:
return "Unknown libusb-1.0 error code";
}
-
- return "Unknown libusb-1.0 error code";
}
static char *