From e1da48acae7de45cedea1e827a43c946b69021d0 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower III" Date: Wed, 16 Mar 2005 08:09:19 +0000 Subject: [PATCH] SM3840: Added SM4800, PPC endianness fix, Makefile deps fix --- ChangeLog | 7 +++++++ backend/Makefile.in | 1 + backend/sm3840.c | 20 ++++++++++++++++++-- backend/sm3840.conf | 2 ++ backend/sm3840_scan.c | 7 ++++++- doc/descriptions/sm3840.desc | 12 +++++++++++- doc/sane-sm3840.man | 11 ++++++++--- 7 files changed, 53 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3d5b27eb..0709a568a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-03-16 Earle F. Philhower III + * backend/sm3840.c backend/sm3840_scan.c backend/sm3840.conf + backend/Makefile.in doc/descriptions/sm3840.desc + doc/sane-sm3840.man: Added ScanMaker 4800 USB ID and + documentation, fixed PPC endianness problems, fixed + Makefile dependencies for sm3840 driver + 2005-03-13 Henning Meier-Geinitz * doc/descriptions/unsupported.desc diff --git a/backend/Makefile.in b/backend/Makefile.in index c25f25c3d..dfc824f96 100644 --- a/backend/Makefile.in +++ b/backend/Makefile.in @@ -400,6 +400,7 @@ libsane-sm3600.la: ../sanei/sanei_constrain_value.lo libsane-sm3840.la: ../sanei/sanei_config2.lo libsane-sm3840.la: ../sanei/sanei_constrain_value.lo libsane-sm3840.la: ../sanei/sanei_usb.lo +libsane-sm3840.la: ../sanei/sanei_scsi.lo libsane-snapscan.la: ../sanei/sanei_config2.lo libsane-snapscan.la: ../sanei/sanei_constrain_value.lo libsane-snapscan.la: ../sanei/sanei_scsi.lo diff --git a/backend/sm3840.c b/backend/sm3840.c index d561ab99e..6f317952e 100755 --- a/backend/sm3840.c +++ b/backend/sm3840.c @@ -493,7 +493,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize) static SANE_Status -add_sm3840_device (SANE_String_Const devname) +add_sm_device (SANE_String_Const devname, SANE_String_Const modname) { SM3840_Device *dev; @@ -503,7 +503,7 @@ add_sm3840_device (SANE_String_Const devname) memset (dev, 0, sizeof (*dev)); dev->sane.name = strdup (devname); - dev->sane.model = "ScanMaker 3840"; + dev->sane.model = modname; dev->sane.vendor = "Microtek"; dev->sane.type = "flatbed scanner"; ++num_devices; @@ -513,6 +513,19 @@ add_sm3840_device (SANE_String_Const devname) return (SANE_STATUS_GOOD); } +static SANE_Status +add_sm3840_device (SANE_String_Const devname) +{ + return add_sm_device (devname, "ScanMaker 3840"); +} + +static SANE_Status +add_sm4800_device (SANE_String_Const devname) +{ + return add_sm_device (devname, "ScanMaker 4800"); +} + + /*--------------------------------------------------------------------------*/ SANE_Status sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only) @@ -532,7 +545,10 @@ sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only) first_dev = NULL; num_devices = 0; + /* If we get enough scanners should use an array, but for now */ + /* do it one-by-one... */ sanei_usb_find_devices (0x05da, 0x30d4, add_sm3840_device); + sanei_usb_find_devices (0x05da, 0x30cf, add_sm4800_device); if (devlist) free (devlist); diff --git a/backend/sm3840.conf b/backend/sm3840.conf index fd4d3ce92..177abd5eb 100644 --- a/backend/sm3840.conf +++ b/backend/sm3840.conf @@ -1,3 +1,5 @@ # usb vendor product # Microtek ScanMaker 3840 ID usb 0x05da 0x30d4 +# Microtek ScanMaker 4800 ID +usb 0x05da 0x30cf diff --git a/backend/sm3840_scan.c b/backend/sm3840_scan.c index d87aaa25c..d1007db4c 100755 --- a/backend/sm3840_scan.c +++ b/backend/sm3840_scan.c @@ -128,7 +128,9 @@ main (int argc, char *argv[]) params.width = rightin - leftin; prepare_params (¶ms); - udev = find_device (0x05da, 0x30d4); + udev = find_device (0x05da, 0x30d4); /* 3840 */ + if (!udev) + udev = find_device (0x05da, 0x30cf); /* 4800 */ if (!udev) fprintf (stderr, "Unable to open scanner.\n"); else @@ -420,6 +422,7 @@ setup_scan (usb_dev_handle * udev, SM3840_Params * p) len = usb_bulk_read (udev, 1, (unsigned char *) whitebalance, whitebalancesize, rd_timeout); + fix_endian_short (whitebalance, whitebalancesize/2); if (!donered) { red = (whitebalance[0] + whitebalance[3] + whitebalance[6]) / 3; @@ -485,6 +488,7 @@ setup_scan (usb_dev_handle * udev, SM3840_Params * p) len = usb_bulk_read (udev, 1, (unsigned char *) whitebalance, whitebalancesize, rd_timeout); + fix_endian_short (whitebalance, whitebalancesize/2); if (!donered) { red = @@ -599,6 +603,7 @@ setup_scan (usb_dev_handle * udev, SM3840_Params * p) write_vctl (udev, 0x0c, 0x0001, 0x0000, 0x00); record_mem (udev, (unsigned char **) (void *)&whitescan, (5632 * 2 * 3 * (dpi == 1200 ? 2 : 1)) * 4); + fix_endian_short (whitescan, (5632 * 2 * 3 * (dpi == 1200 ? 2 : 1)) * 2); write_regs (udev, 5, 0x83, 0x00, 0xa3, 0xff, 0xa4, 0xff, 0xa1, 0xff, 0xa2, 0xff); write_vctl (udev, 0x0c, 0x0001, 0x0000, 0x00); diff --git a/doc/descriptions/sm3840.desc b/doc/descriptions/sm3840.desc index 66ea6ebf0..bb9131ff9 100644 --- a/doc/descriptions/sm3840.desc +++ b/doc/descriptions/sm3840.desc @@ -11,7 +11,7 @@ ; See doc/descriptions.txt for details. :backend "sm3840" ; name of backend -:version "1.0" ; version of backend (or "unmaintained") +:version "1.1" ; version of backend (or "unmaintained") :new :yes ; Is the backend new to this SANE release? ; :yes or :no :manpage "sane-sm3840" ; name of manpage (if it exists) @@ -38,6 +38,16 @@ ; or "Proprietary". :comment "8 and 16 bit, color and grayscale" ; comment about the model +:model "ScanMaker 4800" ; name models for above-specified mfg. +:status :good ; :minimal, :basic, :good, :complete + ; :untested, or :unsupported +:interface "USB" ; interface type of the device: + ; "SCSI", "USB", "Parport (EPP)", + ; "Parport (SPP)", "Parport (ECP)", + ; "Serial port", "IEEE-1394", "JetDirect", + ; or "Proprietary". +:comment "Same hardware as SM3840, different color box" ; comment + ; :comment and :url specifiers are optional after :mfg, :model, :desc, ; and at the top-level. diff --git a/doc/sane-sm3840.man b/doc/sane-sm3840.man index ead46ca1f..31f8a80d4 100644 --- a/doc/sane-sm3840.man +++ b/doc/sane-sm3840.man @@ -1,4 +1,4 @@ -.TH sane-sm3840 5 "Feb 6, 2005" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy" +.TH sane-sm3840 5 "Mar 15, 2005" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy" .IX sane-sm3840 .SH NAME sane-sm3840 \- SANE backend for Microtek scanners with SCAN08 USB chip @@ -12,15 +12,20 @@ USB chip. There exist backends for Microtek scanners with SCSI command set. Refer to sane-microtek(5) and sane-microtek2(5) for details. .PP +There also exists a Microtek 3600 series driver, see sane-sm3600(5) for +details. +.PP At present, the following scanners are known positively to work with this backend: .PP .RS -Vendor Product id: Remark: +Vendor Product ID: Remark: .br -------- -------------- ----------- .br -Microtek ScanMaker 3840 all modes ok +Microtek ScanMaker 3840 All modes OK +.br +Microtek ScanMaker 4800 All modes OK .RE .PP If you own a Microtek scanner with the SCAN08 chip other than the ones