summaryrefslogtreecommitdiff
path: root/backend/pixma/pixma.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2021-05-18 07:43:35 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2021-05-18 07:43:35 +0200
commit9f8889f928ce86ba4a78659d378c6ba29bc9f735 (patch)
treec9567cb0d015b68ce3da8d03472b6443f1cb1ca9 /backend/pixma/pixma.c
parent446e9454b8cbe5b689149415d11d36e88442ca88 (diff)
parent154785ab2d5df7ddc8c2cf813b773c340e5e2aea (diff)
Merge branch 'release/debian/1.0.32-1'debian/1.0.32-1
Diffstat (limited to 'backend/pixma/pixma.c')
-rw-r--r--backend/pixma/pixma.c57
1 files changed, 42 insertions, 15 deletions
diff --git a/backend/pixma/pixma.c b/backend/pixma/pixma.c
index c32907c..b4e423d 100644
--- a/backend/pixma/pixma.c
+++ b/backend/pixma/pixma.c
@@ -17,9 +17,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
As a special exception, the authors of SANE give permission for
additional uses of the libraries contained in this release of SANE.
@@ -116,6 +114,8 @@ typedef struct pixma_sane_t
uint8_t gamma_table[4096];
SANE_String_Const source_list[4];
pixma_paper_source_t source_map[4];
+ SANE_String_Const calibrate_list[PIXMA_CALIBRATE_NUM_OPTS + 1];
+ pixma_calibrate_option_t calibrate_map[PIXMA_CALIBRATE_NUM_OPTS + 1];
unsigned byte_pos_in_line, output_line_size;
uint64_t image_bytes_read;
@@ -159,10 +159,11 @@ static void mark_all_button_options_cached ( struct pixma_sane_t * ss )
ss -> button_option_is_cached[i] = 1;
}
-static SANE_Status config_attach_pixma(SANEI_Config * config, const char *devname)
+static SANE_Status config_attach_pixma(SANEI_Config __sane_unused__ * config,
+ const char *devname,
+ void __sane_unused__ *data)
{
int i;
- UNUSED(config);
for (i=0; i < (MAX_CONF_DEVICES -1); i++)
{
if(conf_devices[i] == NULL)
@@ -504,6 +505,22 @@ create_dpi_list (pixma_sane_t * ss)
/*PDBG (pixma_dbg (4, "*create_dpi_list***** min_dpi = %d, max_dpi = %d\n", min_dpi, max_dpi));*/
}
+
+static void
+create_calibrate_list (pixma_sane_t * ss)
+{
+ int i = 0;
+ ss->calibrate_list[i] = SANE_I18N ("Once");
+ ss->calibrate_map[i] = PIXMA_CALIBRATE_ONCE;
+ i++;
+ ss->calibrate_list[i] = SANE_I18N ("Always");
+ ss->calibrate_map[i] = PIXMA_CALIBRATE_ALWAYS;
+ i++;
+ ss->calibrate_list[i] = SANE_I18N ("Never");
+ ss->calibrate_map[i] = PIXMA_CALIBRATE_NEVER;
+ i++;
+}
+
static void
select_value_from_list (pixma_sane_t * ss, SANE_Int n, void *v,
SANE_Int * info)
@@ -935,6 +952,7 @@ calc_scan_param (pixma_sane_t * ss, pixma_scan_param_t * sp)
sp->threshold = 2.55 * OVAL (opt_threshold).w;
sp->threshold_curve = OVAL (opt_threshold_curve).w;
sp->adf_wait = OVAL (opt_adf_wait).w;
+ sp->calibrate = ss->calibrate_map[OVAL (opt_calibrate).w];
error = pixma_check_scan_param (ss->s, sp);
if (error < 0)
@@ -997,6 +1015,8 @@ init_option_descriptors (pixma_sane_t * ss)
i++;
}
+ create_calibrate_list (ss);
+
build_option_descriptors (ss);
/* Enable options that are available only in some scanners. */
@@ -1433,8 +1453,8 @@ static void
pixma_jpeg_read(pixma_sane_t *ss, SANE_Byte *data,
SANE_Int max_length, SANE_Int *length)
{
- struct jpeg_decompress_struct cinfo = ss->jpeg_cinfo;
- pixma_jpeg_src_mgr *src = (pixma_jpeg_src_mgr *)ss->jpeg_cinfo.src;
+ struct jpeg_decompress_struct *cinfo = &ss->jpeg_cinfo;
+ pixma_jpeg_src_mgr *src = (pixma_jpeg_src_mgr *)cinfo->src;
int l;
@@ -1454,7 +1474,7 @@ pixma_jpeg_read(pixma_sane_t *ss, SANE_Byte *data,
return;
}
- if (cinfo.output_scanline >= cinfo.output_height)
+ if (cinfo->output_scanline >= cinfo->output_height)
{
*length = 0;
return;
@@ -1464,7 +1484,7 @@ pixma_jpeg_read(pixma_sane_t *ss, SANE_Byte *data,
* only one line at time is supported
*/
- l = jpeg_read_scanlines(&cinfo, ss->jdst->buffer, 1);
+ l = jpeg_read_scanlines(cinfo, ss->jdst->buffer, 1);
if (l == 0)
return;
@@ -1472,7 +1492,7 @@ pixma_jpeg_read(pixma_sane_t *ss, SANE_Byte *data,
* linebuffer holds width * bytesperpixel
*/
- (*ss->jdst->put_pixel_rows)(&cinfo, ss->jdst, 1, (char *)src->linebuffer);
+ (*ss->jdst->put_pixel_rows)(cinfo, ss->jdst, 1, (char *)src->linebuffer);
*length = ss->sp.w * ss->sp.channels;
/* Convert RGB into grayscale */
@@ -1505,9 +1525,9 @@ pixma_jpeg_read(pixma_sane_t *ss, SANE_Byte *data,
b = (b << 1) | 0;
else
b = (b << 1) | 1;
+ if ((i % 8) == 0)
+ *(d++) = b;
}
- if ((i % 8) == 0)
- *(d++) = b;
}
src->linebuffer_size = *length;
@@ -1656,8 +1676,8 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
config.descriptors = NULL;
config.values = NULL;
- if (sanei_configure_attach(PIXMA_CONFIG_FILE, &config, config_attach_pixma) !=
- SANE_STATUS_GOOD)
+ if (sanei_configure_attach(PIXMA_CONFIG_FILE, &config,
+ config_attach_pixma, NULL) != SANE_STATUS_GOOD)
PDBG(pixma_dbg(2, "Could not read pixma configuration file: %s\n",
PIXMA_CONFIG_FILE));
@@ -2255,9 +2275,16 @@ type int adf-wait
default 0
constraint (0,3600,1)
title ADF Waiting Time
- desc When set, the scanner waits upto the specified time in seconds for a new document inserted into the automatic document feeder.
+ desc When set, the scanner waits up to the specified time in seconds for a new document inserted into the automatic document feeder.
cap soft_select soft_detect automatic inactive
+type string calibrate[30]
+ constraint @string_list = ss->calibrate_list
+ title Calibration
+ desc When to perform scanner calibration. If you choose \"Once\" it will be performed a single time per driver init for single page scans, and for the first page for each ADF scan.
+ default Once
+ cap soft_select soft_detect automatic
+
rem -------------------------------------------
END SANE_Option_Descriptor
*/