[patch] support for Ricoh IS50

Dick Streefland (Dick.Streefland@inter.NL.net)
Thu, 2 Dec 1999 22:17:35 +0100

--huq684BweRXVnRxX
Content-Type: text/plain; charset=us-ascii

Hi,

I made a small modification to the Ricoh backend to add support for
the Ricoh IS50 scanner in addition to the IS60. The original author of
this driver told me that he is not actively working on this driver
anymore, and he suggested that I post this patch on this mailing list.

So, here it is. The modifications are:
* Recognize the IS50 in addition to the IS60.
* Limited the resolution to 400 dpi for the IS50.
* Reverse the sense of the contrast setting for the IS50.
(slider to the right ==> more contrast)
These modifications shouldn't affect IS60 scanners. The attached patch
is relative to the sane-1.0.1 source tree.

-- 
Dick Streefland                    ////               De Bilt
dick.streefland@inter.nl.net      (@ @)       The Netherlands
------------------------------oOO--(_)--OOo------------------

--huq684BweRXVnRxX Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="sane-1.0.1-is50.patch"

--- 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 + && 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->info.brightness_default = 256 - wbuf.brightness; - dev->info.contrast_default = 256 - wbuf.contrast; + if (is50) + dev->info.contrast_default = wbuf.contrast; + else + dev->info.contrast_default = 256 - wbuf.contrast; } else /* wbuf.image_comp == RICOH_BINARY_MONOCHROME */ { @@ -346,7 +352,7 @@ s->opt[OPT_X_RESOLUTION].type = SANE_TYPE_INT; s->opt[OPT_X_RESOLUTION].unit = SANE_UNIT_DPI; s->opt[OPT_X_RESOLUTION].constraint_type = SANE_CONSTRAINT_RANGE; - s->opt[OPT_X_RESOLUTION].constraint.range = &is60_res_range; + s->opt[OPT_X_RESOLUTION].constraint.range = (is50 ? &is50_res_range : &is60_res_range); s->val[OPT_X_RESOLUTION].w = s->hw->info.xres_default; /* y resolution */ @@ -356,7 +362,7 @@ s->opt[OPT_Y_RESOLUTION].type = SANE_TYPE_INT; s->opt[OPT_Y_RESOLUTION].unit = SANE_UNIT_DPI; s->opt[OPT_Y_RESOLUTION].constraint_type = SANE_CONSTRAINT_RANGE; - s->opt[OPT_Y_RESOLUTION].constraint.range = &is60_res_range; + s->opt[OPT_Y_RESOLUTION].constraint.range = (is50 ? &is50_res_range : &is60_res_range); s->val[OPT_Y_RESOLUTION].w = s->hw->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->brightness; - wbuf.contrast = 256 - (SANE_Byte) s->contrast; + if (is50) + wbuf.contrast = (SANE_Byte) s->contrast; + else + wbuf.contrast = 256 - (SANE_Byte) s->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 */

--huq684BweRXVnRxX--

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