Microtek backend patch

Ross Crawford (RCrawford@compuserve.com)
Tue, 07 Jul 1998 23:21:49 +1000

This is a multi-part message in MIME format.
--------------CE181589FBE03B83BD232823
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi.

I've attached a patch for microtek.c which lets me use the ADF on my
ScanMaker IIG. A couple of notes:

1. The line where the paper length is calculated generated strange
numbers for me - my patch includes a change which fixes it, but I have
only tested it with my scanner :-(

2. My scanner gets this message:

scsi0 : weirdness
STATUS_REG: 00
BASR: 08
ICR: 00
MODE: 00

many times while the scan head is returning after a scan. Does anyone
know what causes this?

--------------CE181589FBE03B83BD232823
Content-Type: text/plain; charset=us-ascii; name="microtek.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="microtek.c.diff"

--- microtek.c.0.8 Sun Jul 5 17:26:45 1998
+++ microtek.c Tue Jul 7 22:11:58 1998
@@ -104,6 +104,7 @@

#define M_OPAQUE "Opaque/Normal"
#define M_TRANS "Transparency"
+#define M_AUTOFEED "AutoFeeder"

#define M_NONE "None"
#define M_SCALAR "Scalar"
@@ -798,12 +799,14 @@
sod[OPT_SOURCE].constraint_type = SANE_CONSTRAINT_STRING_LIST;
{
SANE_String_Const *source_list;
- source_list = (SANE_String_Const *) malloc(3 * sizeof(SANE_String_Const));
+ source_list = (SANE_String_Const *) malloc(4 * sizeof(SANE_String_Const));
if (source_list == NULL) return SANE_STATUS_NO_MEM;
i = 0;
source_list[i++] = M_OPAQUE;
if (ms->dev->info.source_options & MI_SRC_HAS_TRANS)
source_list[i++] = M_TRANS;
+ if (ms->dev->info.source_options & MI_SRC_HAS_FEED)
+ source_list[i++] = M_AUTOFEED;
source_list[i] = NULL;
sod[OPT_SOURCE].constraint.string_list = source_list;
sod[OPT_SOURCE].size = max_string_size(source_list);
@@ -2105,8 +2108,8 @@
(dev->info.enhance_cap & MI_ENH_CAP_MIDTONE) ? SANE_TRUE : SANE_FALSE;
scanner->paper_length =
(scanner->unit_type == MS_UNIT_PIXELS) ?
- (SANE_Int)(SANE_UNFIX(dev->info.max_y) * dev->info.base_resolution) :
- (SANE_Int)(SANE_UNFIX(dev->info.max_y) * 8);
+ (SANE_Int)((double)(dev->info.max_y)) :
+ (SANE_Int)((double)(dev->info.max_y) / 8 * dev->info.base_resolution);

scanner->bright_r = 0;
scanner->bright_g = 0;
@@ -2562,6 +2565,7 @@
}

s->transparency = !(strcmp(s->val[OPT_SOURCE].s, M_TRANS));
+ s->useADF = !(strcmp(s->val[OPT_SOURCE].s, M_AUTOFEED));
/* disallow exp. res. during preview scan XXXXXXXXXXX */
/*s->expandedresolution =
(s->val[OPT_EXP_RES].w) && !(s->val[OPT_PREVIEW].w);*/
@@ -2721,6 +2725,9 @@
if (s->dev->info.source_options & (MI_SRC_FEED_BT | MI_SRC_HAS_TRANS)) {
if ((status = accessory(s)) != SANE_STATUS_GOOD) return status;
}
+ if (s->dev->info.source_options & (MI_SRC_FEED_SUPP | MI_SRC_HAS_FEED)) {
+ if ((status = accessory(s)) != SANE_STATUS_GOOD) return status;
+ }
/*if ((status = download_gamma(s)) != SANE_STATUS_GOOD) return status;*/
if ((status = mode_select(s)) != SANE_STATUS_GOOD) return status;
/* why would we even try if this were not true?... */
@@ -2834,6 +2841,9 @@
if (s->dev->info.source_options & (MI_SRC_FEED_BT | MI_SRC_HAS_TRANS)) {
if ((status = accessory(s)) != SANE_STATUS_GOOD) return status;
/* if SWslct ???? XXXXXXXXXXXXXXX */
+ }
+ if (s->dev->info.source_options & (MI_SRC_FEED_SUPP | MI_SRC_HAS_FEED)) {
+ if ((status = accessory(s)) != SANE_STATUS_GOOD) return status;
}
if ((status = download_gamma(s)) != SANE_STATUS_GOOD) return status;
if ((status = mode_select(s)) != SANE_STATUS_GOOD) return status;

--------------CE181589FBE03B83BD232823--

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com