sane-project-website/old-archive/1999-12/0020.html

155 wiersze
6.1 KiB
HTML

<!-- received="Thu Dec 2 13:09:23 1999 PST" -->
<!-- sent="Thu, 2 Dec 1999 22:17:35 +0100" -->
<!-- name="Dick Streefland" -->
<!-- email="Dick.Streefland@inter.NL.net" -->
<!-- subject="[patch] support for Ricoh IS50" -->
<!-- id="" -->
<!-- inreplyto="" -->
<title>sane-devel: [patch] support for Ricoh IS50</title>
<h1>[patch] support for Ricoh IS50</h1>
<b>Dick Streefland</b> (<a href="mailto:Dick.Streefland@inter.NL.net"><i>Dick.Streefland@inter.NL.net</i></a>)<br>
<i>Thu, 2 Dec 1999 22:17:35 +0100</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#20">[ date ]</a><a href="index.html#20">[ thread ]</a><a href="subject.html#20">[ subject ]</a><a href="author.html#20">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0021.html">Manuel Panea: "Re: Problem with SANE and SCSI scanner"</a>
<li> <b>Previous message:</b> <a href="0019.html">Brian Macy: "Re: SANE Net backend suggestion..."</a>
<!-- nextthread="start" -->
<li> <b>Next in thread:</b> <a href="0092.html">Petter Reinholdtsen: "Re: [patch] support for Ricoh IS50"</a>
<li> <b>Reply:</b> <a href="0092.html">Petter Reinholdtsen: "Re: [patch] support for Ricoh IS50"</a>
<!-- reply="end" -->
</ul>
<!-- body="start" -->
--huq684BweRXVnRxX<br>
Content-Type: text/plain; charset=us-ascii<br>
<p>
Hi,<br>
<p>
I made a small modification to the Ricoh backend to add support for<br>
the Ricoh IS50 scanner in addition to the IS60. The original author of<br>
this driver told me that he is not actively working on this driver<br>
anymore, and he suggested that I post this patch on this mailing list.<br>
<p>
So, here it is. The modifications are:<br>
* Recognize the IS50 in addition to the IS60.<br>
* Limited the resolution to 400 dpi for the IS50.<br>
* Reverse the sense of the contrast setting for the IS50.<br>
(slider to the right ==&gt; more contrast)<br>
These modifications shouldn't affect IS60 scanners. The attached patch<br>
is relative to the sane-1.0.1 source tree.<br>
<p>
<pre>
--
Dick Streefland //// De Bilt
<a href="mailto:dick.streefland@inter.nl.net">dick.streefland@inter.nl.net</a> (@ @) The Netherlands
------------------------------oOO--(_)--OOo------------------
<p>
--huq684BweRXVnRxX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sane-1.0.1-is50.patch"
<p>
--- sane-1.0.1/backend/ricoh.c.orig Sat Apr 3 06:06:07 1999
+++ sane-1.0.1/backend/ricoh.c Thu Nov 25 22:06:33 1999
@@ -75,6 +75,7 @@
static int num_devices = 0;
static Ricoh_Device *first_dev = NULL;
static Ricoh_Scanner *first_handle = NULL;
+static int is50;
#include "ricoh-scsi.c"
@@ -141,12 +142,14 @@
if (ibuf.devtype != 6
|| strncmp (ibuf.vendor, "RICOH", 5) != 0
- || strncmp (ibuf.product, "IS60", 4) != 0)
+ || (strncmp (ibuf.product, "IS60", 4) != 0
+ &amp;&amp; strncmp (ibuf.product, "IS50", 4) != 0))
{
DBG (1, "attach: device doesn't look like the Ricoh scanner I know\n");
sanei_scsi_close (fd);
return (SANE_STATUS_INVAL);
}
+ is50 = (strncmp (ibuf.product, "IS50", 4) == 0);
DBG (3, "attach: sending TEST_UNIT_READY\n");
status = test_unit_ready (fd);
@@ -241,7 +244,10 @@
if (wbuf.image_comp == RICOH_GRAYSCALE || wbuf.image_comp == RICOH_DITHERED_MONOCHROME)
{
dev-&gt;info.brightness_default = 256 - wbuf.brightness;
- dev-&gt;info.contrast_default = 256 - wbuf.contrast;
+ if (is50)
+ dev-&gt;info.contrast_default = wbuf.contrast;
+ else
+ dev-&gt;info.contrast_default = 256 - wbuf.contrast;
}
else /* wbuf.image_comp == RICOH_BINARY_MONOCHROME */
{
@@ -346,7 +352,7 @@
s-&gt;opt[OPT_X_RESOLUTION].type = SANE_TYPE_INT;
s-&gt;opt[OPT_X_RESOLUTION].unit = SANE_UNIT_DPI;
s-&gt;opt[OPT_X_RESOLUTION].constraint_type = SANE_CONSTRAINT_RANGE;
- s-&gt;opt[OPT_X_RESOLUTION].constraint.range = &amp;is60_res_range;
+ s-&gt;opt[OPT_X_RESOLUTION].constraint.range = (is50 ? &amp;is50_res_range : &amp;is60_res_range);
s-&gt;val[OPT_X_RESOLUTION].w = s-&gt;hw-&gt;info.xres_default;
/* y resolution */
@@ -356,7 +362,7 @@
s-&gt;opt[OPT_Y_RESOLUTION].type = SANE_TYPE_INT;
s-&gt;opt[OPT_Y_RESOLUTION].unit = SANE_UNIT_DPI;
s-&gt;opt[OPT_Y_RESOLUTION].constraint_type = SANE_CONSTRAINT_RANGE;
- s-&gt;opt[OPT_Y_RESOLUTION].constraint.range = &amp;is60_res_range;
+ s-&gt;opt[OPT_Y_RESOLUTION].constraint.range = (is50 ? &amp;is50_res_range : &amp;is60_res_range);
s-&gt;val[OPT_Y_RESOLUTION].w = s-&gt;hw-&gt;info.yres_default;
/* "Geometry" group: */
@@ -833,7 +839,10 @@
if (wbuf.image_comp == RICOH_DITHERED_MONOCHROME)
wbuf.mrif_filtering_gamma_id = (SANE_Byte) 0x10;
wbuf.brightness = 256 - (SANE_Byte) s-&gt;brightness;
- wbuf.contrast = 256 - (SANE_Byte) s-&gt;contrast;
+ if (is50)
+ wbuf.contrast = (SANE_Byte) s-&gt;contrast;
+ else
+ wbuf.contrast = 256 - (SANE_Byte) s-&gt;contrast;
}
else /* wbuf.image_comp == RICOH_BINARY_MONOCHROME */
{
--- sane-1.0.1/backend/ricoh.h.orig Sat Feb 27 21:16:52 1999
+++ sane-1.0.1/backend/ricoh.h Thu Nov 25 22:02:37 1999
@@ -80,6 +80,13 @@
0 /* quantization */
};
+static const SANE_Range is50_res_range =
+ {
+ 75, /* minimum */
+ 400, /* maximum */
+ 0 /* quantization */
+ };
+
static const SANE_Range is60_res_range =
{
100, /* minimum */
<p>
--huq684BweRXVnRxX--
<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="0021.html">Manuel Panea: "Re: Problem with SANE and SCSI scanner"</a>
<li> <b>Previous message:</b> <a href="0019.html">Brian Macy: "Re: SANE Net backend suggestion..."</a>
<!-- nextthread="start" -->
<li> <b>Next in thread:</b> <a href="0092.html">Petter Reinholdtsen: "Re: [patch] support for Ricoh IS50"</a>
<li> <b>Reply:</b> <a href="0092.html">Petter Reinholdtsen: "Re: [patch] support for Ricoh IS50"</a>
<!-- reply="end" -->
</ul>