Updated Pixma backend from Gernot Hassenpflug.

merge-requests/1/head
m. allan noah 2012-01-14 21:48:19 -05:00
rodzic 599112d549
commit 1da5bcc2aa
12 zmienionych plików z 2222 dodań i 177 usunięć

Wyświetl plik

@ -1,3 +1,10 @@
2012-01-14 m. allan noah <kitno455 at gmail dot com>
* backend/Makefile.{am,in}, backend/pixma.[ch],
backend/pixma_common.c, backend/pixma_mp[17]50.c,
backend/pixma_mp810.c, backend/pixma_rename.h,
doc/descriptions/pixma.desc, doc/sane-pixma.man:
Updated Pixma backend from Gernot Hassenpflug.
2012-01-03 Stéphane Voltz <stef.dev@free.fr>
* backend/genesys_gl646.c backend/genesys_gl847.c
backend/genesys_gl43.[ch]: fixd scan line number for gl646 CCD

Wyświetl plik

@ -810,7 +810,7 @@ libsane_pint_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pint
libsane_pint_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS)
libsane_pint_la_LIBADD = $(COMMON_LIBS) libpint.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo
libpixma_la_SOURCES = pixma.c pixma.h pixma_io_sanei.c pixma_io.h pixma_common.c pixma_common.h pixma_mp150.c pixma_mp730.c pixma_mp750.c pixma_imageclass.c pixma_bjnp.c pixma_bjnp.h pixma_bjnp_private.h pixma_rename.h
libpixma_la_SOURCES = pixma.c pixma.h pixma_io_sanei.c pixma_io.h pixma_common.c pixma_common.h pixma_mp150.c pixma_mp730.c pixma_mp750.c pixma_mp810.c pixma_imageclass.c pixma_bjnp.c pixma_bjnp.h pixma_bjnp_private.h pixma_rename.h
libpixma_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pixma
nodist_libsane_pixma_la_SOURCES = pixma-s.c

Wyświetl plik

@ -273,8 +273,8 @@ libpixma_la_LIBADD =
am_libpixma_la_OBJECTS = libpixma_la-pixma.lo \
libpixma_la-pixma_io_sanei.lo libpixma_la-pixma_common.lo \
libpixma_la-pixma_mp150.lo libpixma_la-pixma_mp730.lo \
libpixma_la-pixma_mp750.lo libpixma_la-pixma_imageclass.lo \
libpixma_la-pixma_bjnp.lo
libpixma_la-pixma_mp750.lo libpixma_la-pixma_mp810.lo \
libpixma_la-pixma_imageclass.lo libpixma_la-pixma_bjnp.lo
libpixma_la_OBJECTS = $(am_libpixma_la_OBJECTS)
libplustek_la_LIBADD =
am_libplustek_la_OBJECTS = libplustek_la-plustek.lo
@ -2253,7 +2253,7 @@ nodist_libsane_pint_la_SOURCES = pint-s.c
libsane_pint_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pint
libsane_pint_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS)
libsane_pint_la_LIBADD = $(COMMON_LIBS) libpint.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo
libpixma_la_SOURCES = pixma.c pixma.h pixma_io_sanei.c pixma_io.h pixma_common.c pixma_common.h pixma_mp150.c pixma_mp730.c pixma_mp750.c pixma_imageclass.c pixma_bjnp.c pixma_bjnp.h pixma_bjnp_private.h pixma_rename.h
libpixma_la_SOURCES = pixma.c pixma.h pixma_io_sanei.c pixma_io.h pixma_common.c pixma_common.h pixma_mp150.c pixma_mp730.c pixma_mp750.c pixma_mp810.c pixma_imageclass.c pixma_bjnp.c pixma_bjnp.h pixma_bjnp_private.h pixma_rename.h
libpixma_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pixma
nodist_libsane_pixma_la_SOURCES = pixma-s.c
libsane_pixma_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=pixma
@ -3007,6 +3007,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpixma_la-pixma_mp150.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpixma_la-pixma_mp730.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpixma_la-pixma_mp750.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpixma_la-pixma_mp810.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libplustek_la-plustek.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libplustek_pp_la-plustek_pp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpnm_la-pnm.Plo@am__quote@
@ -3834,6 +3835,13 @@ libpixma_la-pixma_mp750.lo: pixma_mp750.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpixma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpixma_la-pixma_mp750.lo `test -f 'pixma_mp750.c' || echo '$(srcdir)/'`pixma_mp750.c
libpixma_la-pixma_mp810.lo: pixma_mp810.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpixma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpixma_la-pixma_mp810.lo -MD -MP -MF $(DEPDIR)/libpixma_la-pixma_mp810.Tpo -c -o libpixma_la-pixma_mp810.lo `test -f 'pixma_mp810.c' || echo '$(srcdir)/'`pixma_mp810.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpixma_la-pixma_mp810.Tpo $(DEPDIR)/libpixma_la-pixma_mp810.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pixma_mp810.c' object='libpixma_la-pixma_mp810.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpixma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpixma_la-pixma_mp810.lo `test -f 'pixma_mp810.c' || echo '$(srcdir)/'`pixma_mp810.c
libpixma_la-pixma_imageclass.lo: pixma_imageclass.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpixma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpixma_la-pixma_imageclass.lo -MD -MP -MF $(DEPDIR)/libpixma_la-pixma_imageclass.Tpo -c -o libpixma_la-pixma_imageclass.lo `test -f 'pixma_imageclass.c' || echo '$(srcdir)/'`pixma_imageclass.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpixma_la-pixma_imageclass.Tpo $(DEPDIR)/libpixma_la-pixma_imageclass.Plo

Wyświetl plik

@ -556,7 +556,7 @@ static void
print_scan_param (int level, const pixma_scan_param_t * sp)
{
pixma_dbg (level, "Scan parameters\n");
pixma_dbg (level, " line_size=%u image_size=%"PRIu64" channels=%u depth=%u\n",
pixma_dbg (level, " line_size=%"PRIu64" image_size=%"PRIu64" channels=%u depth=%u\n",
sp->line_size, sp->image_size, sp->channels, sp->depth);
pixma_dbg (level, " dpi=%ux%u offset=(%u,%u) dimension=%ux%u\n",
sp->xdpi, sp->ydpi, sp->x, sp->y, sp->w, sp->h);
@ -603,6 +603,7 @@ calc_scan_param (pixma_sane_t * ss, pixma_scan_param_t * sp)
sp->w = 1;
if (sp->h == 0)
sp->h = 1;
sp->tpu_offset_added = 0;
sp->gamma_table = (OVAL (opt_custom_gamma).b) ? ss->gamma_table : NULL;
sp->source = ss->source_map[OVAL (opt_source).w];

Wyświetl plik

@ -244,7 +244,7 @@ struct pixma_scan_param_t
/** Size in bytes of one image line (row).
* line_size >= depth / 8 * channels * w <br>
* This field will be set by pixma_check_scan_param(). */
unsigned line_size;
uint64_t line_size;
/** Size in bytes of the whole image.
* image_size = line_size * h <br>
@ -272,6 +272,11 @@ struct pixma_scan_param_t
unsigned x, y, w, h, xs, wx;
/*@} */
/** Flag indicating whether the offset correction for TPU scans
* was already performed (to avoid repeated corrections).
* Currently only used in pixma_mp810.c sub-driver */
unsigned tpu_offset_added;
/** Gamma table. 4096 entries, 12 bit => 8 bit. If \c NULL, default gamma
* specified by subdriver will be used. */
const uint8_t *gamma_table;

Wyświetl plik

@ -66,12 +66,14 @@
extern const pixma_config_t pixma_mp150_devices[];
extern const pixma_config_t pixma_mp750_devices[];
extern const pixma_config_t pixma_mp730_devices[];
extern const pixma_config_t pixma_mp810_devices[];
extern const pixma_config_t pixma_iclass_devices[];
static const pixma_config_t *const pixma_devices[] = {
pixma_mp150_devices,
pixma_mp750_devices,
pixma_mp730_devices,
pixma_mp810_devices,
pixma_iclass_devices,
NULL
};
@ -378,7 +380,7 @@ pixma_cmd_transaction (pixma_t * s, const void *cmd, unsigned cmdlen,
{
/* Write timeout is too low? */
PDBG (pixma_dbg
(1, "ERROR:incomplete write, %u out of %u written\n",
(1, "ERROR: incomplete write, %u out of %u written\n",
(unsigned) error, cmdlen));
error = PIXMA_ETIMEDOUT;
}
@ -403,7 +405,7 @@ pixma_cmd_transaction (pixma_t * s, const void *cmd, unsigned cmdlen,
while (error == PIXMA_ETIMEDOUT && --tmo != 0);
if (error < 0)
{
PDBG (pixma_dbg (1, "WARNING:Error in response phase. cmd:%02x%02x\n",
PDBG (pixma_dbg (1, "WARNING: Error in response phase. cmd:%02x%02x\n",
((const uint8_t *) cmd)[0],
((const uint8_t *) cmd)[1]));
PDBG (pixma_dbg (1," If the scanner hangs, reset it and/or unplug the "
@ -544,7 +546,7 @@ pixma_close (pixma_t * s)
{
if (s->scanning)
{
PDBG (pixma_dbg (3, "pixma_close():scanning in progress, call"
PDBG (pixma_dbg (3, "pixma_close(): scanning in progress, call"
" finish_scan()\n"));
s->ops->finish_scan (s);
}
@ -567,7 +569,7 @@ pixma_scan (pixma_t * s, pixma_scan_param_t * sp)
#ifndef NDEBUG
pixma_dbg (3, "\n");
pixma_dbg (3, "pixma_scan(): start\n");
pixma_dbg (3, " line_size=%u image_size=%"PRIu64" channels=%u depth=%u\n",
pixma_dbg (3, " line_size=%"PRIu64" image_size=%"PRIu64" channels=%u depth=%u\n",
sp->line_size, sp->image_size, sp->channels, sp->depth);
pixma_dbg (3, " dpi=%ux%u offset=(%u,%u) dimension=%ux%u\n",
sp->xdpi, sp->ydpi, sp->x, sp->y, sp->w, sp->h);
@ -601,7 +603,7 @@ fill_pixels (pixma_t * s, uint8_t * ptr, uint8_t * end, uint8_t value)
{
if (s->cur_image_size < s->param->image_size)
{
int n = s->param->image_size - s->cur_image_size;
long n = s->param->image_size - s->cur_image_size;
if (n > (end - ptr))
n = end - ptr;
memset (ptr, value, n);
@ -638,7 +640,7 @@ pixma_read_image (pixma_t * s, void *buf, unsigned len)
else
{
PDBG (pixma_dbg
(3, "pixma_read_image():completed (underrun detected)\n"));
(3, "pixma_read_image(): completed (underrun detected)\n"));
s->scanning = 0;
}
return ib.wptr - (uint8_t *) buf;
@ -659,10 +661,10 @@ pixma_read_image (pixma_t * s, void *buf, unsigned len)
{
pixma_dbg (1, "WARNING:image size mismatches\n");
pixma_dbg (1,
" %"PRIu64" expected (%d lines) but %"PRIu64" received (%d lines)\n",
" %"PRIu64" expected (%d lines) but %"PRIu64" received (%"PRIu64" lines)\n",
s->param->image_size, s->param->h,
s->cur_image_size,
(int) s->cur_image_size / s->param->line_size);
s->cur_image_size / s->param->line_size);
if ((s->cur_image_size % s->param->line_size) != 0)
{
pixma_dbg (1,
@ -682,6 +684,7 @@ pixma_read_image (pixma_t * s, void *buf, unsigned len)
break;
}
s->cur_image_size += result;
PASSERT (s->cur_image_size <= s->param->image_size);
}
if (ib.rptr)
@ -700,7 +703,7 @@ cancel:
s->scanning = 0;
if (result == PIXMA_ECANCELED)
{
PDBG (pixma_dbg (3, "pixma_read_image():cancelled by %sware\n",
PDBG (pixma_dbg (3, "pixma_read_image(): cancelled by %sware\n",
(s->cancel) ? "soft" : "hard"));
}
else

Wyświetl plik

@ -111,8 +111,6 @@
#define MP510_PID 0x1717
#define MP600_PID 0x1718
#define MP600R_PID 0x1719
#define MP810_PID 0x171a
#define MP960_PID 0x171b
#define MP140_PID 0x172b
@ -124,17 +122,12 @@
#define MP470_PID 0x1723
#define MP520_PID 0x1724
#define MP610_PID 0x1725
#define MP970_PID 0x1726
#define MX300_PID 0x1727
#define MX310_PID 0x1728
#define MX700_PID 0x1729
#define MX850_PID 0x172c
/* Flatbed scanner CCD (2007) */
#define CS8800F_PID 0x1901
/* PIXMA 2008 vintage */
#define MP980_PID 0x172d
#define MP630_PID 0x172e
#define MP620_PID 0x172f
#define MP540_PID 0x1730
@ -155,13 +148,27 @@
#define MP550_PID 0x173d
#define MP560_PID 0x173e
#define MP640_PID 0x173f
#define MP990_PID 0x1740
/* PIXMA 2010 vintage */
#define MX340_PID 0x1741
#define MX350_PID 0x1742
#define MX870_PID 0x1743
/* 2010 new devices (untested) */
#define MP280_PID 0x1746
#define MP495_PID 0x1747
#define MG5100_PID 0x1748
#define MG5200_PID 0x1749
#define MG6100_PID 0x174a
/* 2011 new devices (untested) */
#define MG2100_PID 0x1751
#define MG3100_PID 0x1752
#define MG4100_PID 0x1753
#define MG5300_PID 0x1754
#define MG6200_PID 0x1755
#define MP493_PID 0x1757
/* Generation 4 XML messages that encapsulates the Pixma protocol messages */
#define XML_START_1 \
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\
@ -577,9 +584,9 @@ calc_shifting (pixma_t * s)
mp->stripe_shift = 0;
switch (s->cfg->pid)
{
case MP970_PID: /* MP970 at 4800 dpi */
case CS8800F_PID: /* CanoScan 8800F at 4800 dpi */
if (s->param->xdpi == 4800)
case MP800_PID:
case MP800R_PID:
if (s->param->xdpi == 2400)
{
if (is_scanning_from_tpu(s))
mp->stripe_shift = 6;
@ -588,17 +595,14 @@ calc_shifting (pixma_t * s)
}
break;
case MP800_PID:
case MP800R_PID:
case MP960_PID:
if (s->param->xdpi == 2400)
mp->stripe_shift = 6;
break;
case MP830_PID:
case MP810_PID:
if (s->param->xdpi == 2400)
{
if (is_scanning_from_tpu(s))
mp->stripe_shift = 6;
else
mp->stripe_shift = 3;
}
break;
default: /* Default, and all CIS devices */
@ -610,25 +614,6 @@ calc_shifting (pixma_t * s)
{
switch (s->cfg->pid)
{
case MP970_PID:
case CS8800F_PID: /* CanoScan 8800F */
mp->color_shift = s->param->ydpi / 50;
mp->shift[1] = mp->color_shift * get_cis_ccd_line_size (s);
mp->shift[0] = 0;
mp->shift[2] = 2 * mp->shift[1];
break;
case MP980_PID:
case MP990_PID:
if (s->param->ydpi > 150)
{
mp->color_shift = s->param->ydpi / 75;
mp->shift[1] = mp->color_shift * get_cis_ccd_line_size (s);
mp->shift[0] = 0;
mp->shift[2] = 2 * mp->shift[1];
}
break;
case MP800_PID:
case MP800R_PID:
case MP830_PID:
@ -650,14 +635,6 @@ calc_shifting (pixma_t * s)
}
break;
case MP810_PID:
case MP960_PID:
mp->color_shift = s->param->ydpi / 50;
mp->shift[1] = mp->color_shift * get_cis_ccd_line_size (s);
mp->shift[0] = 2 * mp->shift[1];
mp->shift[2] = 0;
break;
default:
break;
}
@ -702,7 +679,7 @@ send_scan_param (pixma_t * s)
{
data[0x00] = 0x04;
data[0x01] = 0x02;
data[0x1e] = 0x02; /* NB: CanoScan 8800F: 0x02->negatives, 0x01->positives, paper->0x00 */
data[0x1e] = 0x02;
}
data[0x02] = 0x01;
if (is_scanning_from_adfdup (s))
@ -733,9 +710,6 @@ send_scan_param (pixma_t * s)
data[0x21] = 0x81;
data[0x23] = 0x02;
data[0x24] = 0x01;
if (s->cfg->pid == CS8800F_PID) /* CS8800F addition */
data[0x25] = (is_scanning_from_tpu (s)) ? 0x00 : 0x01; /* 0x01 normally, 0x00 for TPU color management*/
data[0x30] = 0x01;
}
return pixma_exec (s, &mp->cb);
@ -962,7 +936,7 @@ shift_colors (uint8_t * dptr, uint8_t * sptr,
sr = colshft[0]; sg = colshft[1]; sb = colshft[2];
for (i = 0; i < w; i++)
{
/* stripes shift for MP970 at 4800 dpi, MP800, MP800R, MP810 at 2400 dpi */
/* stripes shift for MP800, MP800R at 2400 dpi */
st = (i % 2 == 0) ? strshft : 0;
*sptr++ = *(dptr++ + sr + st);
@ -1008,20 +982,6 @@ reorder_pixels (uint8_t * linebuf, uint8_t * sptr, unsigned c, unsigned n,
memcpy (sptr, linebuf, line_size);
}
static void
mp970_reorder_pixels (uint8_t * linebuf, uint8_t * sptr, unsigned c,
unsigned w, unsigned line_size)
{
unsigned i, i8;
for (i = 0; i < w; i++)
{
i8 = i % 8;
memcpy (linebuf + c * (i + i8 - ((i8 > 3) ? 7 : 0)), sptr + c * i, c);
}
memcpy (sptr, linebuf, line_size);
}
#ifndef TPU_48
static unsigned
pack_48_24_bpc (uint8_t * sptr, unsigned n)
@ -1064,11 +1024,6 @@ post_process_image_data (pixma_t * s, pixma_imagebuf_t * ib)
else /* FIXME: maybe need different values for CIS and CCD sensors */
n = s->param->xdpi / 2400;
/* Some exceptions to global rules here */
if (s->cfg->pid == MP970_PID ||
s->cfg->pid == MP990_PID ||
s->cfg->pid == CS8800F_PID)
n = MIN (n, 4);
if (s->cfg->pid == MP600_PID || s->cfg->pid == MP600R_PID)
n = s->param->xdpi / 1200;
@ -1098,11 +1053,6 @@ post_process_image_data (pixma_t * s, pixma_imagebuf_t * ib)
if (s->cfg->pid != MP220_PID && n > 0)
reorder_pixels (mp->linebuf, sptr, c, n, m, s->param->wx, line_size);
/* MP970 and CS8800F specific reordering for 4800 dpi */
if ((s->cfg->pid == MP970_PID || s->cfg->pid == CS8800F_PID)
&& s->param->xdpi == 4800)
mp970_reorder_pixels (mp->linebuf, sptr, c, s->param->wx, line_size);
/* Crop line to selected borders */
memmove(cptr, sptr + cx, cw);
@ -1159,25 +1109,16 @@ mp150_open (pixma_t * s)
if (s->cfg->pid == MP140_PID)
mp->generation = 2;
if (s->cfg->pid == CS8800F_PID)
mp->generation = 3;
/* TPU info data setup */
mp->tpu_datalen = 0;
if (mp->generation < 4)
{
/* Canoscan 8800F ignores commands if not initialized */
if (s->cfg->pid == CS8800F_PID)
abort_session (s);
else
{
query_status (s);
handle_interrupt (s, 200);
if (mp->generation == 3 && has_ccd_sensor (s))
send_cmd_start_calibrate_ccd_3 (s);
}
}
return 0;
}
@ -1196,7 +1137,6 @@ static int
mp150_check_param (pixma_t * s, pixma_scan_param_t * sp)
{
mp150_t *mp = (mp150_t *) s->subdriver;
uint8_t fixed_offset = 35; /* TPU offset for CanoScan 8800F, or other CCD at 300dpi. */
sp->depth = 8; /* MP150 only supports 8 bit per channel. */
#ifdef TPU_48
@ -1236,15 +1176,6 @@ mp150_check_param (pixma_t * s, pixma_scan_param_t * sp)
if (sp->source == PIXMA_SOURCE_TPU)
{
uint8_t k;
/* CanoScan 8800F and others adding an offset depending on resolution */
if (s->cfg->pid == CS8800F_PID)
{
/* deal with overlap of calibration area as well */
if ( (sp->y) < (fixed_offset*(sp->xdpi)/300) )
sp->y = (fixed_offset*(sp->xdpi)/300) - ((fixed_offset*(sp->xdpi)/300)-(sp->y));
else
sp->y += (fixed_offset*(sp->xdpi)/300);
}
/* TPU mode: lowest res is 150 or 300 dpi */
if (mp->generation >= 3)
@ -1595,10 +1526,6 @@ const pixma_config_t pixma_mp150_devices[] = {
DEVICE ("Canon PIXMA MP600", "MP600", MP600_PID, 2400, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP600R", "MP600R", MP600R_PID, 2400, 638, 877, PIXMA_CAP_CIS),
/* Generation 2: CCD */
DEVICE ("Canon PIXMA MP810", "MP810", MP810_PID, 4800, 638, 877, PIXMA_CAP_CCD | PIXMA_CAP_TPU),
DEVICE ("Canon PIXMA MP960", "MP960", MP960_PID, 4800, 638, 877, PIXMA_CAP_CCD | PIXMA_CAP_TPU),
/* Generation 3: CIS */
DEVICE ("Canon PIXMA MP210", "MP210", MP210_PID, 600, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP220", "MP220", MP220_PID, 1200, 638, 877, PIXMA_CAP_CIS),
@ -1612,15 +1539,6 @@ const pixma_config_t pixma_mp150_devices[] = {
DEVICE ("Canon PIXMA MX850", "MX850", MX850_PID, 2400, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADFDUP),
DEVICE ("Canon PIXMA MX7600", "MX7600", MX7600_PID, 4800, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADFDUP),
/* Generation 3 CCD not managed as Generation 2 */
DEVICE ("Canon Pixma MP970", "MP970", MP970_PID, 4800, 638, 877, PIXMA_CAP_CCD | PIXMA_CAP_TPU),
/* Flatbed scanner CCD (2007) */
DEVICE ("Canoscan 8800F", "8800F", CS8800F_PID, 4800, 638, 877, PIXMA_CAP_CCD | PIXMA_CAP_TPU),
/* PIXMA 2008 vintage CCD and CIS */
DEVICE ("Canon MP980 series", "MP980", MP980_PID, 4800, 638, 877, PIXMA_CAP_CCD | PIXMA_CAP_TPU),
DEVICE ("Canon PIXMA MP630", "MP630", MP630_PID, 4800, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP620", "MP620", MP620_PID, 2400, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP540", "MP540", MP540_PID, 2400, 638, 877, PIXMA_CAP_CIS),
@ -1650,8 +1568,20 @@ const pixma_config_t pixma_mp150_devices[] = {
DEVICE ("Canon PIXMA MP250", "MP250", MP250_PID, 600, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP270", "MP270", MP270_PID, 1200, 638, 877, PIXMA_CAP_CIS),
/* Generation 4 CCD */
DEVICE ("Canon MP990 series", "MP990", MP990_PID, 4800, 638, 877, PIXMA_CAP_CCD | PIXMA_CAP_TPU),
/* Latest devices (2010) Generation 4 CIS/CCD */
DEVICE ("Canon PIXMA MP280", "MP280", MP280_PID, 1200, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP495", "MP495", MP495_PID, 1200, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MG5100", "MG5100", MG5100_PID, 1200, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MG5200", "MG5200", MG5200_PID, 2400, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MG6100", "MG6200", MG6100_PID, 2400, 638, 877, PIXMA_CAP_CIS),
/* Latest devices (2011) Generation 4 CIS/CCD */
DEVICE ("Canon PIXMA MG2100", "MG2100", MG2100_PID, 1200, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MG3100", "MG3100", MG3100_PID, 1200, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MG4100", "MG4100", MG4100_PID, 1200, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MG5300", "MG5300", MG5300_PID, 2400, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MG6200", "MG6200", MG6200_PID, 4800, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP493", "MP493", MP493_PID, 1200, 638, 877, PIXMA_CAP_CIS),
END_OF_DEVICE_LIST
};

Wyświetl plik

@ -107,6 +107,10 @@ typedef struct mp750_t
uint8_t current_status[12];
uint8_t *buf, *rawimg, *img;
/* make new buffer for rgb_to_gray to act on */
uint8_t *imgcol;
unsigned line_size; /* need in 2 functions */
unsigned rawimg_left, imgbuf_len, last_block_size, imgbuf_ofs;
int shifted_bytes;
int stripe_shift; /* for 2400dpi */
@ -208,6 +212,26 @@ select_source (pixma_t * s)
return pixma_exec (s, &mp->cb);
}
static int
has_ccd_sensor (pixma_t * s)
{
return ((s->cfg->cap & PIXMA_CAP_CCD) != 0);
}
static int
is_ccd_grayscale (pixma_t * s)
{
return (has_ccd_sensor (s) && (s->param->channels == 1));
}
/* CCD sensors don't have a Grayscale mode, but use color mode instead */
static unsigned
get_cis_ccd_line_size (pixma_t * s)
{
return (s->param->wx ? s->param->line_size / s->param->w * s->param->wx
: s->param->line_size) * ((is_ccd_grayscale (s)) ? 3 : 1);
}
static int
send_scan_param (pixma_t * s)
{
@ -222,7 +246,8 @@ send_scan_param (pixma_t * s)
pixma_set_be32 (mp->raw_width, data + 0x10);
pixma_set_be32 (mp->raw_height, data + 0x14);
data[0x18] = 8; /* 8 = color, 4 = grayscale(?) */
data[0x19] = s->param->channels * s->param->depth;
/* GH: No, there is no grayscale for CCD devices, Windows shows same */
data[0x19] = s->param->depth * ((is_ccd_grayscale (s)) ? 3 : s->param->channels); /* bits per pixel */
data[0x20] = 0xff;
data[0x23] = 0x81;
data[0x26] = 0x02;
@ -302,7 +327,7 @@ read_image_block (pixma_t * s, uint8_t * data)
if ((error = pixma_read (s->io, &temp, 0)) < 0)
{
PDBG (pixma_dbg
(1, "WARNING:reading zero-length packet failed %d\n", error));
(1, "WARNING: reading zero-length packet failed %d\n", error));
}
}
return count;
@ -351,7 +376,7 @@ handle_interrupt (pixma_t * s, int timeout)
return error;
if (error != 16)
{
PDBG (pixma_dbg (1, "WARNING:unexpected interrupt packet length %d\n",
PDBG (pixma_dbg (1, "WARNING: unexpected interrupt packet length %d\n",
error));
return PIXMA_EPROTO;
}
@ -423,6 +448,29 @@ shift_rgb (const uint8_t * src, unsigned pixels,
}
}
static uint8_t *
rgb_to_gray (uint8_t * gptr, const uint8_t * cptr, unsigned pixels, unsigned c)
{
unsigned i, j, g;
/* gptr: destination gray scale buffer */
/* cptr: source color scale buffer */
/* c: 3 for 3-channel single-byte data, 6 for double-byte data */
for (i=0; i < pixels; i++)
{
for (j = 0, g = 0; j < 3; j++)
{
g += *cptr++;
if (c == 6) g += (*cptr++ << 8);
}
g /= 3;
*gptr++ = g;
if (c == 6) *gptr++ = (g >> 8);
}
return gptr;
}
static int
calc_component_shifting (pixma_t * s)
{
@ -494,7 +542,6 @@ workaround_first_command (pixma_t * s)
}
}
static int
mp750_open (pixma_t * s)
{
@ -553,11 +600,18 @@ mp750_check_param (pixma_t * s, pixma_scan_param_t * sp)
UNUSED (s);
sp->depth = 8; /* FIXME: Does MP750 supports other depth? */
if (sp->channels == 1)
raw_width = ALIGN_SUP (sp->w, 12);
else
/* GH: my implementation */
/* if ((sp->channels == 3) || (is_ccd_grayscale (s)))
raw_width = ALIGN_SUP (sp->w, 4);
sp->line_size = raw_width * sp->channels;
else
raw_width = ALIGN_SUP (sp->w, 12);*/
/* the above code gives segmentation fault?!? why... it seems to work in the mp750_scan function */
raw_width = ALIGN_SUP (sp->w, 4);
/*sp->line_size = raw_width * sp->channels;*/
sp->line_size = raw_width * sp->channels * (sp->depth / 8); /* no cropping? */
return 0;
}
@ -569,6 +623,10 @@ mp750_scan (pixma_t * s)
uint8_t *buf;
unsigned size, dpi, spare;
dpi = s->param->ydpi;
/* add a stripe shift for 2400dpi */
mp->stripe_shift = (dpi == 2400) ? 4 : 0;
if (mp->state != state_idle)
return PIXMA_EBUSY;
@ -577,15 +635,17 @@ mp750_scan (pixma_t * s)
{
}
if (s->param->channels == 1)
/* if (s->param->channels == 1)
mp->raw_width = ALIGN_SUP (s->param->w, 12);
else
mp->raw_width = ALIGN_SUP (s->param->w, 4);*/
/* change to use CCD grayscale mode --- why does this give segmentation error at runtime in mp750_check_param? */
if ((s->param->channels == 3) || (is_ccd_grayscale (s)))
mp->raw_width = ALIGN_SUP (s->param->w, 4);
dpi = s->param->ydpi;
/* add a stripe shift for 2400dpi */
mp->stripe_shift = (dpi == 2400) ? 4 : 0;
else
mp->raw_width = ALIGN_SUP (s->param->w, 12);
/* not sure about MP750, but there is no need for aligning at 12 for the MP760/770, MP780/790 since always use CCD color mode */
/* modify for stripe shift */
spare = 2 * calc_component_shifting (s) + 2 * mp->stripe_shift; /* FIXME: or maybe (2*... + 1)? */
@ -593,13 +653,18 @@ mp750_scan (pixma_t * s)
PDBG (pixma_dbg (3, "raw_width=%u raw_height=%u dpi=%u\n",
mp->raw_width, mp->raw_height, dpi));
size = 8 + 2 * IMAGE_BLOCK_SIZE + spare * s->param->line_size;
/* PDBG (pixma_dbg (4, "line_size=%"PRIu64"\n",s->param->line_size)); */
mp->line_size = get_cis_ccd_line_size (s); /* scanner hardware line_size multiplied by 3 for CCD grayscale */
size = 8 + 2 * IMAGE_BLOCK_SIZE + spare * mp->line_size;
buf = (uint8_t *) malloc (size);
if (!buf)
return PIXMA_ENOMEM;
mp->buf = buf;
mp->rawimg = buf;
mp->imgbuf_ofs = spare * s->param->line_size;
mp->imgbuf_ofs = spare * mp->line_size;
mp->imgcol = mp->rawimg + IMAGE_BLOCK_SIZE + 8; /* added to make rgb->gray */
mp->img = mp->rawimg + IMAGE_BLOCK_SIZE + 8;
mp->imgbuf_len = IMAGE_BLOCK_SIZE + mp->imgbuf_ofs;
mp->rawimg_left = 0;
@ -623,6 +688,7 @@ mp750_scan (pixma_t * s)
return 0;
}
static int
mp750_fill_buffer (pixma_t * s, pixma_imagebuf_t * ib)
{
@ -631,6 +697,9 @@ mp750_fill_buffer (pixma_t * s, pixma_imagebuf_t * ib)
uint8_t info;
unsigned block_size, bytes_received, n;
int shift[3], base_shift;
int c;
c = ((is_ccd_grayscale (s)) ? 3 : s->param->channels) * s->param->depth / 8; /* single-byte or double-byte data */
if (mp->state == state_warmup)
{
@ -652,14 +721,14 @@ mp750_fill_buffer (pixma_t * s, pixma_imagebuf_t * ib)
}
if (tmo < 0)
{
PDBG (pixma_dbg (1, "WARNING:Timed out waiting for calibration\n"));
PDBG (pixma_dbg (1, "WARNING: Timed out waiting for calibration\n"));
return PIXMA_ETIMEDOUT;
}
pixma_sleep (100000);
query_status (s);
if (is_warming_up (s) || !is_calibrated (s))
{
PDBG (pixma_dbg (1, "WARNING:Wrong status: wup=%d cal=%d\n",
PDBG (pixma_dbg (1, "WARNING: Wrong status: wup=%d cal=%d\n",
is_warming_up (s), is_calibrated (s)));
return PIXMA_EPROTO;
}
@ -670,7 +739,7 @@ mp750_fill_buffer (pixma_t * s, pixma_imagebuf_t * ib)
}
/* TODO: Move to other place, values are constant. */
base_shift = calc_component_shifting (s) * s->param->line_size;
base_shift = calc_component_shifting (s) * mp->line_size;
if (s->param->source == PIXMA_SOURCE_ADF)
{
shift[0] = 0;
@ -754,22 +823,45 @@ mp750_fill_buffer (pixma_t * s, pixma_imagebuf_t * ib)
/* TODO: simplify! */
mp->rawimg_left += bytes_received;
n = mp->rawimg_left / 3;
/* n = number of pixels in the buffer */
shift_rgb (mp->rawimg, n, shift[0], shift[1], shift[2],
mp->stripe_shift, s->param->line_size,
/* n = number of pixels in the buffer? */
/* Color to Grayscale converion for CCD sensor */
if (is_ccd_grayscale (s)) {
shift_rgb (mp->rawimg, n, shift[0], shift[1], shift[2], mp->stripe_shift, mp->line_size,
mp->imgcol + mp->imgbuf_ofs);
/* dst: img, src: imgcol */
rgb_to_gray (mp->img, mp->imgcol, n, c); /* cropping occurs later? */
PDBG (pixma_dbg (4, "*fill_buffer: did grayscale conversion \n"));
}
/* Color image processing */
else {
shift_rgb (mp->rawimg, n, shift[0], shift[1], shift[2], mp->stripe_shift, mp->line_size,
mp->img + mp->imgbuf_ofs);
PDBG (pixma_dbg (4, "*fill_buffer: no grayscale conversion---keep color \n"));
}
/* entering remaining unprocessed bytes after last complete pixel into mp->rawimg buffer -- no influence on mp->img */
n *= 3;
mp->shifted_bytes += n;
mp->rawimg_left -= n; /* rawimg_left = 0, 1 or 2 bytes left in the buffer. */
mp->last_block_size = n;
memcpy (mp->rawimg, mp->rawimg + n, mp->rawimg_left);
}
while (mp->shifted_bytes <= 0);
if ((unsigned) mp->shifted_bytes < mp->last_block_size)
{
if (is_ccd_grayscale (s))
ib->rptr = mp->img + mp->last_block_size/3 - mp->shifted_bytes/3; /* testing---works OK */
else
ib->rptr = mp->img + mp->last_block_size - mp->shifted_bytes;
}
else
ib->rptr = mp->img;
if (is_ccd_grayscale (s))
ib->rend = mp->img + mp->last_block_size/3; /* testing---works OK */
else
ib->rend = mp->img + mp->last_block_size;
return ib->rend - ib->rptr;
}
@ -863,12 +955,12 @@ static const pixma_scan_ops_t pixma_mp750_ops = {
&pixma_mp750_ops, /* ops */ \
dpi, 2*(dpi), /* xdpi, ydpi */ \
637, 877, /* width, height */ \
PIXMA_CAP_EVENTS|cap \
PIXMA_CAP_GRAY|PIXMA_CAP_EVENTS|cap \
}
const pixma_config_t pixma_mp750_devices[] = {
DEVICE ("Canon PIXMA MP750", "MP750", MP750_PID, 2400, PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MP760", "MP760", MP760_PID, 2400, PIXMA_CAP_TPU),
DEVICE ("Canon PIXMA MP780", "MP780", MP780_PID, 2400, PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MP750", "MP750", MP750_PID, 2400, PIXMA_CAP_CCD | PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MP760/770", "MP760/770", MP760_PID, 2400, PIXMA_CAP_CCD | PIXMA_CAP_TPU),
DEVICE ("Canon PIXMA MP780/790", "MP780/790", MP780_PID, 2400, PIXMA_CAP_CCD | PIXMA_CAP_ADF),
DEVICE (NULL, NULL, 0, 0, 0)
};

1991
backend/pixma_mp810.c 100644

Plik diff jest za duży Load Diff

Wyświetl plik

@ -81,6 +81,7 @@
#define pixma_mp150_devices sanei_pixma_mp150_devices
#define pixma_mp730_devices sanei_pixma_mp730_devices
#define pixma_mp750_devices sanei_pixma_mp750_devices
#define pixma_mp810_devices sanei_pixma_mp810_devices
#define pixma_iclass_devices sanei_pixma_iclass_devices
#define pixma_newcmd sanei_pixma_newcmd
#define pixma_open sanei_pixma_open

Wyświetl plik

@ -142,20 +142,20 @@
:model "PIXMA MP800"
:interface "USB"
:usbid "0x04a9" "0x170d"
:status :good
:comment "All resolutions supported up to 2400DPI. TPU scan up to 1200DPI."
:status :complete
:comment "All resolutions supported up to 2400DPI. Full TPU support up to 2400DPI."
:model "PIXMA MP800R"
:interface "USB"
:usbid "0x04a9" "0x170e"
:status :good
:comment "All resolutions supported up to 2400DPI. TPU scan up to 1200DPI."
:status :complete
:comment "All resolutions supported up to 2400DPI. Full TPU support up to 2400DPI."
:model "PIXMA MP810"
:interface "USB"
:usbid "0x04a9" "0x171a"
:status :good
:comment "All resolutions supported up to 2400DPI. Vertical stripes at 4800DPI. USB Snoops needed for TPU film scan."
:status :complete
:comment "All resolutions supported up to 4800DPI. Full TPU support (negative and slides) up to 4800DPI."
:model "PIXMA MP830"
:interface "USB"
@ -166,7 +166,8 @@
:model "PIXMA MP960"
:interface "USB"
:usbid "0x04a9" "0x171b"
:status :minimal
:status :complete
:comment "All resolutions supported up to 4800DPI. Full TPU support (negative and slides) up to 4800DPI."
:model "PIXMA MP970"
:interface "USB Ethernet"
@ -521,3 +522,9 @@
:usbid "0x04a9" "0x1901"
:status :complete
:comment "Flatbed scan. TPU for negatives and slides. All resolutions supported (up to 4800DPI)."
:model "CanoScan 9000F"
:interface "USB"
:usbid "0x04a9" "0x1908"
:status :complete
:comment "Full flatbed support up to 4800DPI (Note: flatbed does not have 9600DPI capability). Full TPU support (negatives and slides) up to 9600DPI."

Wyświetl plik

@ -43,14 +43,14 @@ ImageCLASS MF4660, MF4690, MF5770, MF6550, D480
.br
I-SENSYS MF4320d, MF4330d
.br
CanoScan 8800F
CanoScan 8800F, 9000F
.RE
.PP
The following models are not well tested and/or the scanner sometimes hangs
and must be switched off and on.
.PP
.RS
PIXMA PIXMA MP760, PIXMA MP780
PIXMA MP760, MP770, MP780, MP790
.RE
.PP
The following models may use the same Pixma protocol as those listed
@ -77,7 +77,7 @@ ImageCLASS MF5630, MF5650, MF5730, MF5750, MF8170c
The backend supports:
.PP
.RS
* resolutions of 75, 150, 300, 600, 1200, 2400, and 4800 DPI (some maybe buggy),
* resolutions of 75, 150, 300, 600, 1200, 2400, 4800, and 9600 DPI (some maybe buggy),
.br
* color and grayscale mode, as well as lineart on certain models,
.br