kopia lustrzana https://gitlab.com/sane-project/website
242 wiersze
9.5 KiB
HTML
242 wiersze
9.5 KiB
HTML
<!-- received="Thu Nov 19 07:00:26 1998 PST" -->
|
|
<!-- sent="Thu, 19 Nov 1998 15:53:49 +0100 (MET)" -->
|
|
<!-- name="Sebastian Erdmann" -->
|
|
<!-- email="serdmann@cs.tu-berlin.de" -->
|
|
<!-- subject="Patch for Microtek ScanMaker X6 (microtek2 backend)" -->
|
|
<!-- id="199811191453.PAA07046@elephant.cs.tu-berlin.de" -->
|
|
<!-- inreplyto="" -->
|
|
<title>sane-devel: Patch for Microtek ScanMaker X6 (microtek2 backend)</title>
|
|
<h1>Patch for Microtek ScanMaker X6 (microtek2 backend)</h1>
|
|
<b>Sebastian Erdmann</b> (<a href="mailto:serdmann@cs.tu-berlin.de"><i>serdmann@cs.tu-berlin.de</i></a>)<br>
|
|
<i>Thu, 19 Nov 1998 15:53:49 +0100 (MET)</i>
|
|
<p>
|
|
<ul>
|
|
<li> <b>Messages sorted by:</b> <a href="date.html#162">[ date ]</a><a href="index.html#162">[ thread ]</a><a href="subject.html#162">[ subject ]</a><a href="author.html#162">[ author ]</a>
|
|
<!-- next="start" -->
|
|
<li> <b>Next message:</b> <a href="0163.html">Andreas Schrell: "Re: News from Minolta"</a>
|
|
<li> <b>Previous message:</b> <a href="0161.html">Matthias Fleischer: "Re: Mustek Paragon 12000SP V1.02 Problem"</a>
|
|
<!-- nextthread="start" -->
|
|
<li> <b>Next in thread:</b> <a href="0172.html">Bernd Schroeder: "Re: Patch for Microtek ScanMaker X6 (microtek2 backend)"</a>
|
|
<li> <b>Reply:</b> <a href="0172.html">Bernd Schroeder: "Re: Patch for Microtek ScanMaker X6 (microtek2 backend)"</a>
|
|
<!-- reply="end" -->
|
|
</ul>
|
|
<!-- body="start" -->
|
|
Hi,<br>
|
|
<p>
|
|
my Microtek Scanmaker X6 exhibits some strange behavior: After<br>
|
|
switching it on, colors (or greyscale tones) are "washed out" and<br>
|
|
horizontally unbalanced across the image. This occurs when using<br>
|
|
SANE 0.74 as well as SANE pre1.00. A simple workaround is to<br>
|
|
power-cycle the scanner (while keeping the computer running).<br>
|
|
<p>
|
|
But since the windoze twain drivers can get the scanner to work<br>
|
|
without that extra power-cycle, I wasn't satisfied with the<br>
|
|
situation and started to look for a better solution. Unfortunately,<br>
|
|
the trace information obtained from setting "option dump 4" in<br>
|
|
microtek2.conf and setting SANE_DEBUG_MICROTEK2=255 in the<br>
|
|
environment didn't show significant differences between the<br>
|
|
"colors washed out" case and the normal case. In fact, the only<br>
|
|
difference I found turned out to be unrelated to the problem, but<br>
|
|
I fixed it anyway to prevent potential problems: The scanner seems<br>
|
|
to come up with random values for the NTRACK and NCALIB bits in<br>
|
|
the system status. The fix (included in the patch below) was to<br>
|
|
explicitly set these bits to zero in sane_start().<br>
|
|
<p>
|
|
But the "colors washed out" problem did still persist.<br>
|
|
However, after some experimentation I found out that issuing<br>
|
|
a SEND DIAGNOSTIC command (which performs a scanner self test)<br>
|
|
fixes the problem. Since this command keeps the scanner busy for<br>
|
|
quite some time, I added a flag to the Microtek2_Device struct<br>
|
|
so the self test is only performed once in a xscanimage session.<br>
|
|
<p>
|
|
The most natural place for the SEND DIAGNOSTIC command seemed to<br>
|
|
be do_dummy_scan(), since this function already handles<br>
|
|
quirks of some scanner models.<br>
|
|
<p>
|
|
These changes should only affect ScanMaker 636 (model code 0x97)<br>
|
|
and ScanMaker X6 (model code 0x91), both with firmware revision<br>
|
|
1.00. For other models, my patch shouldn't make any difference<br>
|
|
(the NTRACK and NCALIB bits are just set to their default values).<br>
|
|
<p>
|
|
Below is the patch to the microtek2 backend relative to SANE pre-1.00.<br>
|
|
<p>
|
|
Sebastian<br>
|
|
<p>
|
|
<p>
|
|
--- microtek2.h-sane-pre1.00<br>
|
|
+++ microtek2.h Wed Nov 18 14:49:24 1998<br>
|
|
@@ -417,6 +417,13 @@<br>
|
|
#define RQS_ASINFO(s) &((s)[18])<br>
|
|
#define RQS_ASINFOLENGTH(s) (s)[7] - 11<br>
|
|
<br>
|
|
+<br>
|
|
+/* SEND DIAGNOSTIC */<br>
|
|
+#define SSD_CMD(d) (d)[0] = 0x1d; (d)[1] = 0x04; (d)[2] = 0x00; \<br>
|
|
+ (d)[3] = 0x00; (d)[4] = 0x00; (d)[5] = 0x00<br>
|
|
+#define SSD_CMD_L 6<br>
|
|
+<br>
|
|
+<br>
|
|
/******************************************************************************/<br>
|
|
/* enumeration of Option Descriptors */<br>
|
|
/******************************************************************************/<br>
|
|
@@ -606,6 +613,7 @@<br>
|
|
<br>
|
|
SANE_Int *custom_gamma_table[4]; /* used for the custom gamma */<br>
|
|
/* values before a scan starts */<br>
|
|
+ SANE_Bool did_self_test; /* self test has been performed */<br>
|
|
/* the following two are derived from lut_cap */<br>
|
|
int max_lut_size; /* in bytes */<br>
|
|
int lut_entry_size; /* word or byte transfer in LUT */<br>
|
|
@@ -998,5 +1006,8 @@<br>
|
|
<br>
|
|
static SANE_Status<br>
|
|
scsi_wait_for_image(Microtek2_Scanner *);<br>
|
|
+<br>
|
|
+static SANE_Status<br>
|
|
+scsi_send_diagnostic(Microtek2_Device *, int);<br>
|
|
<br>
|
|
#endif<br>
|
|
--- microtek2.c-sane-pre1.00<br>
|
|
+++ microtek2.c Wed Nov 18 14:41:20 1998<br>
|
|
@@ -1158,6 +1158,14 @@<br>
|
|
return status;<br>
|
|
}<br>
|
|
<br>
|
|
+ status = do_dummy_scan(ms);<br>
|
|
+ if ( status != SANE_STATUS_GOOD )<br>
|
|
+ {<br>
|
|
+ cleanup_scanner(ms);<br>
|
|
+ return status;<br>
|
|
+ }<br>
|
|
+<br>
|
|
+ /* toggle the lamp */<br>
|
|
if ( ms->scan_source != MS_SOURCE_TMA )<br>
|
|
{<br>
|
|
md->status.flamp |= MD_FLAMP_ON;<br>
|
|
@@ -1168,8 +1176,10 @@<br>
|
|
md->status.flamp &= ~MD_FLAMP_ON;<br>
|
|
md->status.tlamp |= MD_TLAMP_ON;<br>
|
|
}<br>
|
|
- <br>
|
|
- /* toggle the lamp */<br>
|
|
+<br>
|
|
+ md->status.ntrack = 0;<br>
|
|
+ md->status.ncalib = 0;<br>
|
|
+<br>
|
|
status = scsi_send_system_status(md, ms->sfd);<br>
|
|
if ( status != SANE_STATUS_GOOD )<br>
|
|
{<br>
|
|
@@ -1177,13 +1187,6 @@<br>
|
|
return status;<br>
|
|
}<br>
|
|
<br>
|
|
- status = do_dummy_scan(ms);<br>
|
|
- if ( status != SANE_STATUS_GOOD )<br>
|
|
- {<br>
|
|
- cleanup_scanner(ms);<br>
|
|
- return status;<br>
|
|
- }<br>
|
|
-<br>
|
|
status = scsi_set_window(ms, 1);<br>
|
|
if ( status != SANE_STATUS_GOOD )<br>
|
|
{<br>
|
|
@@ -1453,6 +1456,7 @@<br>
|
|
md->sane.vendor = NULL;<br>
|
|
md->sane.model = NULL;<br>
|
|
md->sane.type = NULL;<br>
|
|
+ md->did_self_test = SANE_FALSE;<br>
|
|
md->scan_source = MD_SOURCE_FLATBED;<br>
|
|
strncpy(md->name, hdev, PATH_MAX - 1);<br>
|
|
++md_num_devices;<br>
|
|
@@ -2008,6 +2012,19 @@<br>
|
|
DBG(1, "do_dummy_scan: malloc failed\n");<br>
|
|
return SANE_STATUS_NO_MEM;<br>
|
|
}<br>
|
|
+<br>
|
|
+ if ( ! md->did_self_test )<br>
|
|
+ {<br>
|
|
+ status = scsi_send_diagnostic(md, ms->sfd);<br>
|
|
+ if ( status != SANE_STATUS_GOOD ) <br>
|
|
+ {<br>
|
|
+ DBG(1, "do_dummy_scan: send_diagnostic '%s'\n", <br>
|
|
+ sane_strstatus(status));<br>
|
|
+ return status;<br>
|
|
+ }<br>
|
|
+ md->did_self_test = SANE_TRUE;<br>
|
|
+ }<br>
|
|
+<br>
|
|
ms_dummy->sfd = ms->sfd;<br>
|
|
/* scsi_read_image_info() checks the model code, so we need */<br>
|
|
/* something like this; all this is ugly */<br>
|
|
@@ -5143,5 +5160,44 @@<br>
|
|
DBG(1, "scsi_test_unit_ready: cmd '%s'\n", sane_strstatus(status));<br>
|
|
<br>
|
|
sanei_scsi_close(sfd); <br>
|
|
+ return status;<br>
|
|
+}<br>
|
|
+<br>
|
|
+/*---------- scsi_send_diagnostic() ------------------------------------------*/<br>
|
|
+<br>
|
|
+static SANE_Status<br>
|
|
+scsi_send_diagnostic(Microtek2_Device *md, int fd)<br>
|
|
+{<br>
|
|
+ u_int8_t sdiag[SSD_CMD_L];<br>
|
|
+ int sfd;<br>
|
|
+ SANE_Status status;<br>
|
|
+<br>
|
|
+<br>
|
|
+ DBG(30, "scsi_send_diagnostic: md=%p fd=%d\n", md, fd);<br>
|
|
+<br>
|
|
+ if ( fd == -1 )<br>
|
|
+ {<br>
|
|
+ status = sanei_scsi_open(md->name, &sfd, scsi_sense_handler, 0);<br>
|
|
+ if ( status != SANE_STATUS_GOOD ) <br>
|
|
+ {<br>
|
|
+ DBG(1, "scsi_send_diagnostic: open '%s'\n",<br>
|
|
+ sane_strstatus(status));<br>
|
|
+ return status;<br>
|
|
+ }<br>
|
|
+ }<br>
|
|
+ else<br>
|
|
+ sfd = fd;<br>
|
|
+<br>
|
|
+ SSD_CMD(sdiag);<br>
|
|
+<br>
|
|
+ if ( ms_dump >= 2)<br>
|
|
+ dump_area2(sdiag, SSD_CMD_L, "senddiagnostic");<br>
|
|
+<br>
|
|
+ status = sanei_scsi_cmd(sfd, sdiag, sizeof(sdiag), NULL, 0);<br>
|
|
+ if ( status != SANE_STATUS_GOOD ) <br>
|
|
+ DBG(1, "scsi_send_diagnostic: '%s'\n", sane_strstatus(status));<br>
|
|
+<br>
|
|
+ if ( fd == -1 )<br>
|
|
+ sanei_scsi_close(sfd);<br>
|
|
return status;<br>
|
|
}<br>
|
|
<p>
|
|
<p>
|
|
<pre>
|
|
--
|
|
___
|
|
Sebastian Erdmann /
|
|
<a href="mailto:serdmann@cs.tu-berlin.de">serdmann@cs.tu-berlin.de</a> ___|__
|
|
<a href="mailto:se@pobox.com">se@pobox.com</a> (_ |
|
|
<a href="http://pobox.com/~se">http://pobox.com/~se</a> __) \___
|
|
<p>
|
|
<pre>
|
|
--
|
|
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
|
|
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
|
|
</pre>
|
|
<!-- body="end" -->
|
|
<p>
|
|
<ul>
|
|
<!-- next="start" -->
|
|
<li> <b>Next message:</b> <a href="0163.html">Andreas Schrell: "Re: News from Minolta"</a>
|
|
<li> <b>Previous message:</b> <a href="0161.html">Matthias Fleischer: "Re: Mustek Paragon 12000SP V1.02 Problem"</a>
|
|
<!-- nextthread="start" -->
|
|
<li> <b>Next in thread:</b> <a href="0172.html">Bernd Schroeder: "Re: Patch for Microtek ScanMaker X6 (microtek2 backend)"</a>
|
|
<li> <b>Reply:</b> <a href="0172.html">Bernd Schroeder: "Re: Patch for Microtek ScanMaker X6 (microtek2 backend)"</a>
|
|
<!-- reply="end" -->
|
|
</ul>
|