sane-project-website/old-archive/1999-02/0209.html

271 wiersze
9.1 KiB
HTML
Czysty Zwykły widok Historia

<!-- received="Sat Feb 27 13:10:49 1999 PST" -->
<!-- sent="Sat, 27 Feb 1999 22:10:13 +0100" -->
<!-- name="Ewald R. de Wit" -->
<!-- email="ewald@pobox.com" -->
<!-- subject="Ok here it is" -->
<!-- id="" -->
<!-- inreplyto="" -->
<title>sane-devel: Ok here it is</title>
<h1>Ok here it is</h1>
<b>Ewald R. de Wit</b> (<a href="mailto:ewald@pobox.com"><i>ewald@pobox.com</i></a>)<br>
<i>Sat, 27 Feb 1999 22:10:13 +0100</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#209">[ date ]</a><a href="index.html#209">[ thread ]</a><a href="subject.html#209">[ subject ]</a><a href="author.html#209">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0210.html">Douglas Gilbert: "Announcement: Linux sg driver for testing"</a>
<li> <b>Previous message:</b> <a href="0208.html">Ewald R. de Wit: "Photosmart patch for better slide scanning"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
--zYM0uCDKw75PZbzx<br>
Content-Type: text/plain; charset=us-ascii<br>
<p>
I forgot the attachment but here it is.<br>
<p>
<pre>
--
-- Ewald
<p>
<p>
<p>
--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-photosmart-slide-scanning
<p>
Only in sane/backend: .libs
Only in sane/backend: Makefile
diff -X EXCLUDE-DIFF -u sane-1.00/backend/hp-handle.c sane/backend/hp-handle.c
--- sane-1.00/backend/hp-handle.c Sat Nov 14 22:16:10 1998
+++ sane/backend/hp-handle.c Sat Feb 27 00:58:12 1999
@@ -172,6 +172,7 @@
hp_handle_uploadParameters (HpHandle this, HpScsi scsi)
{
SANE_Parameters * p = &amp;this-&gt;scan_params;
+ int data_width;
assert(scsi);
@@ -183,7 +184,9 @@
&amp;p-&gt;bytes_per_line,0,0) );
RETURN_IF_FAIL( sanei_hp_scl_inquire(scsi, SCL_NUMBER_OF_LINES,
&amp;p-&gt;lines,0,0));
-
+ RETURN_IF_FAIL( sanei_hp_scl_inquire(scsi, SCL_DATA_WIDTH,
+ &amp;data_width,0,0));
+
switch (sanei_hp_optset_scanmode(this-&gt;dev-&gt;options, this-&gt;data)) {
case HP_SCANMODE_LINEART: /* Lineart */
case HP_SCANMODE_HALFTONE: /* Halftone */
@@ -196,7 +199,9 @@
break;
case HP_SCANMODE_COLOR: /* RGB */
p-&gt;format = SANE_FRAME_RGB;
- p-&gt;depth = 8;
+ /* p-&gt;depth = 8; */
+ p-&gt;depth = data_width/3;
+ DBG(1, "DATAWIDTH ========= %d\n", data_width);
break;
default:
assert(!"Aack");
diff -X EXCLUDE-DIFF -u sane-1.00/backend/hp-option.c sane/backend/hp-option.c
--- sane-1.00/backend/hp-option.c Sat Nov 14 23:09:56 1998
+++ sane/backend/hp-option.c Sat Feb 27 00:59:39 1999
@@ -891,6 +891,29 @@
return SANE_STATUS_GOOD;
}
+/* pseudo probe for exposure times in Photosmart */
+static SANE_Status
+_probe_ps_exposure_time (_HpOption this, HpScsi scsi, HpOptSet optset, HpData data)
+{
+ int minval = 0, maxval = 9, val = 3;
+ HpChoice choices;
+
+ choices = _make_choice_list(this-&gt;descriptor-&gt;choices, minval, maxval);
+ if (choices &amp;&amp; !choices-&gt;name) /* FIXME: hack */
+ return SANE_STATUS_NO_MEM;
+
+ if (!(this-&gt;data_acsr = sanei_hp_accessor_choice_new(data, choices)))
+ return SANE_STATUS_NO_MEM;
+ sanei_hp_accessor_setint(this-&gt;data_acsr, data, val);
+
+ _set_stringlist(this, data,
+ sanei_hp_accessor_choice_strlist((HpAccessorChoice)this-&gt;data_acsr,
+ 0, 0));
+ _set_size(this, data,
+ sanei_hp_accessor_choice_maxsize((HpAccessorChoice)this-&gt;data_acsr));
+ return SANE_STATUS_GOOD;
+}
+
static SANE_Status
_probe_mirror_horiz (_HpOption this, HpScsi scsi, HpOptSet optset, HpData data)
{
@@ -1575,6 +1598,58 @@
return (status);
}
+/* The exposure time of the HP Photosmart can be changed by overwriting some headers
+ of the calibration data. The scanner uses a slower stepping speed for higher
+ exposure times */
+static SANE_Status
+_program_ps_exposure_time (HpOption this, HpScsi scsi, HpOptSet optset, HpData data)
+{
+ SANE_Status status = SANE_STATUS_GOOD;
+ size_t calib_size;
+ char *calib_buf;
+ int i;
+ int option = hp_option_getint(this, data);
+ char *exposure[] = {"\x00\x64\x00\x64\x00\x64", /* 100% */
+ "\x00\x7d\x00\x7d\x00\x7d", /* 125% */
+ "\x00\x96\x00\x96\x00\x96", /* 150% */
+ "\x00\xaf\x00\xaf\x00\xaf", /* 175% */
+ "\x00\xc0\x00\xc0\x00\xc0", /* 200% */
+ "\x00\xe1\x00\xe1\x00\xe1", /* 225% */
+ "\x00\xfa\x00\xfa\x00\xfa", /* 250% */
+ "\x01\x13\x01\x13\x01\x13", /* 275% */
+ "\x01\x24\x01\x24\x01\x24", /* 300% */
+ "\x00\x64\x00\xc0\x01\x24"}; /* Negatives */
+ /* Negatives get some extra blue to penetrate the orange mask and less
+ red to not saturate the red channel; R:G:B = 100:200:300 */
+
+ if ((option &lt; 0) || (option &gt; 9)) return 0;
+ RETURN_IF_FAIL ( sanei_hp_scl_upload_binary (scsi, SCL_CALIB_MAP,
+ &amp;calib_size, &amp;calib_buf) );
+
+ DBG(3, "_program_ps_exposure_time: Got %lu bytes of calibration data\n",
+ (unsigned long) calib_size);
+
+ for (i = 0; i &lt; 9; i++)
+ calib_buf[24 + i] = exposure[option][i];
+
+ status = sanei_hp_scl_download ( scsi, SCL_CALIB_MAP, calib_buf,
+ (size_t) calib_size);
+
+ /* see what the scanner did to our alterations */
+ /*
+ RETURN_IF_FAIL ( sanei_hp_scl_upload_binary (scsi, SCL_CALIB_MAP,
+ &amp;calib_size, &amp;calib_buf) );
+
+ for (i = 0; i &lt; 9; i++)
+ DBG(1, "&gt;%x ", (unsigned char) calib_buf[24 + i]);
+ */
+
+ sanei_hp_free (calib_buf);
+
+ return (status);
+}
+
+
static SANE_Status
_program_scanmode (HpOption this, HpScsi scsi, HpOptSet optset, HpData data)
{
@@ -1697,7 +1772,6 @@
/* If we dont have the media button, we should have calibrate */
if ( !media ) return 1;
-
return hp_option_getint(media, data) == HP_MEDIA_PRINT;
}
@@ -2028,7 +2102,7 @@
static const struct hp_choice_s _media_choices[] = {
{ HP_MEDIA_PRINT, "Print" },
{ HP_MEDIA_SLIDE, "Slide" },
- { HP_MEDIA_NEGATIVE, "Negative" },
+ { HP_MEDIA_NEGATIVE, "Film Strip" },
{ 0, 0 }
};
static const struct hp_option_descriptor_s MEDIA[1] = {{
@@ -2042,6 +2116,32 @@
1, 1, 1, 0, SCL_MEDIA, _media_choices
}};
+static const struct hp_choice_s _data_widths[] = {
+ {24, "24"}, {30, "30"}, {36, "36"}, {42, "42"}, {48, "48"}, {0, 0}
+};
+
+static const struct hp_option_descriptor_s DATA_WIDTH[1] = {{
+ SCANNER_OPTION(DATA_WIDTH, STRING, NONE),
+ REQUIRES (HP_COMPAT_PS),
+ _probe_choice, _program_generic, 0,
+ 0, 0, 0, 0, SCL_DATA_WIDTH, _data_widths
+}};
+
+static const struct hp_choice_s _ps_exposure_times[] = {
+ {0, "100%"}, {1, "125%"}, {2, "150%"},
+ {3, "175%"}, {4, "200%"}, {5, "225%"},
+ {6, "250%"}, {7, "275%"}, {8, "300%"},
+ {9, "Negative"}, {0, 0}
+};
+
+/* Photosmart exposure time */
+static const struct hp_option_descriptor_s PS_EXPOSURE_TIME[1] = {{
+ SCANNER_OPTION(PS_EXPOSURE_TIME, STRING, NONE),
+ REQUIRES( HP_COMPAT_PS ),
+ _probe_ps_exposure_time, _program_ps_exposure_time, 0,
+ 0, 0, 0, 0, 0, _ps_exposure_times
+}};
+
/* There is no inquire ID-for the calibrate command. */
/* So here we need the requiries. */
static const struct hp_option_descriptor_s CALIBRATE[1] = {{
@@ -2195,7 +2295,7 @@
#endif
HALFTONE_PATTERN_8x8, HORIZONTAL_DITHER_8x8,
- SCAN_SPEED, SMOOTHING, MEDIA, CALIBRATE, UNLOAD,
+ SCAN_SPEED, SMOOTHING, MEDIA, PS_EXPOSURE_TIME, DATA_WIDTH, CALIBRATE, UNLOAD,
GEOMETRY_GROUP,
SCAN_TL_X, SCAN_TL_Y, SCAN_BR_X, SCAN_BR_Y,
@@ -2593,3 +2693,4 @@
return 0;
return hp_option_saneoption(opt, data);
}
+
diff -X EXCLUDE-DIFF -u sane-1.00/backend/hp-option.h sane/backend/hp-option.h
--- sane-1.00/backend/hp-option.h Sat Nov 14 22:05:09 1998
+++ sane/backend/hp-option.h Sat Feb 27 00:24:22 1999
@@ -88,6 +88,21 @@
# define SANE_DESC_MEDIA "Set type of media."
#endif
+#ifndef SANE_NAME_PS_EXPOSURE_TIME
+# define SANE_NAME_PS_EXPOSURE_TIME "ps-exposure-time"
+# define SANE_TITLE_PS_EXPOSURE_TIME "Exposure time"
+# define SANE_DESC_PS_EXPOSURE_TIME "A longer exposure time lets the scanner \
+collect more light. Suggested use is 175% for prints, \
+150% for normal slides; 300% for dark slides and \"Negatives\" for \
+negative film"
+#endif
+
+#ifndef SANE_NAME_DATA_WIDTH
+# define SANE_NAME_DATA_WIDTH "data-width"
+# define SANE_TITLE_DATA_WIDTH "Data width"
+# define SANE_DESC_DATA_WIDTH "Precision of the analog to digital conversion, in bits"
+#endif
+
#ifndef SANE_NAME_MATRIX_TYPE
# define SANE_NAME_MATRIX_TYPE "matrix-type"
# define SANE_TITLE_MATRIX_TYPE "Color Matrix"
Only in sane/backend: hp-s.c
<p>
--zYM0uCDKw75PZbzx--
<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="0210.html">Douglas Gilbert: "Announcement: Linux sg driver for testing"</a>
<li> <b>Previous message:</b> <a href="0208.html">Ewald R. de Wit: "Photosmart patch for better slide scanning"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>