From 68c15af1b2b4a85cb20abe3efd2e75fccac6e9b4 Mon Sep 17 00:00:00 2001 From: Nicolas Martin Date: Tue, 4 Jan 2011 22:19:52 +0100 Subject: [PATCH] pixma: several updates for MP830, MP990, memmove bug fix, and 64 bits image size. modified: ChangeLog modified: backend/pixma.c modified: backend/pixma.h modified: backend/pixma_common.c modified: backend/pixma_common.h modified: backend/pixma_mp150.c --- ChangeLog | 5 +++++ backend/pixma.c | 8 ++++---- backend/pixma.h | 6 +++++- backend/pixma_common.c | 6 +++--- backend/pixma_common.h | 2 +- backend/pixma_mp150.c | 4 ++-- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index f7c73a63b..71911dd2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-01-04 Nicolas Martin + * backend/pixma_mp150.c, backend/pixma.c, backend/pixma.h + backend/pixma_common.c, backend/pixma_common.h: + pixma: several updates for MP830, MP990, memmove bug fix, and 64 bits image size. + 2011-01-04 Stéphane Voltz * backend/genesys.c backend/genesys_devices.c backend/genesys_gl124.c: fix 1200 dpi lineart issues for gl124, diff --git a/backend/pixma.c b/backend/pixma.c index b432ee1fe..f9e563e30 100644 --- a/backend/pixma.c +++ b/backend/pixma.c @@ -108,7 +108,7 @@ typedef struct pixma_sane_t pixma_paper_source_t source_map[4]; unsigned byte_pos_in_line, output_line_size; - unsigned image_bytes_read; + uint64_t image_bytes_read; unsigned page_count; /* valid for ADF */ SANE_Pid reader_taskid; @@ -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=%u channels=%u depth=%u\n", + pixma_dbg (level, " line_size=%u 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); @@ -994,8 +994,8 @@ read_image (pixma_sane_t * ss, void *buf, unsigned size, int *readlen) } else if (count == 0) { - PDBG (pixma_dbg (3, "read_image():reader task closed the pipe:" - "%u bytes received, %u bytes expected\n", + PDBG (pixma_dbg (3, "read_image():reader task closed the pipe:%" + PRIu64" bytes received, %"PRIu64" bytes expected\n", ss->image_bytes_read, ss->sp.image_size)); close (ss->rpipe); ss->rpipe = -1; diff --git a/backend/pixma.h b/backend/pixma.h index be9ad5580..0b7e476ae 100644 --- a/backend/pixma.h +++ b/backend/pixma.h @@ -103,6 +103,10 @@ typedef uint16_t uint16_t; typedef uint32_t uint32_t; #endif /* HAVE_STDINT_H */ +#ifdef HAVE_INTTYPES_H +# include /* available in ISO C99 */ +#endif /* HAVE_INTTYPES_H */ + /** \addtogroup API * @{ */ /** \name Version of the driver */ @@ -245,7 +249,7 @@ struct pixma_scan_param_t /** Size in bytes of the whole image. * image_size = line_size * h
* This field will be set by pixma_check_scan_param(). */ - unsigned image_size; + uint64_t image_size; /** Channels per pixel. 1 = grayscale, 3 = color */ unsigned channels; diff --git a/backend/pixma_common.c b/backend/pixma_common.c index 09a2890f7..76471c6c3 100644 --- a/backend/pixma_common.c +++ b/backend/pixma_common.c @@ -567,7 +567,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=%u channels=%u depth=%u\n", + pixma_dbg (3, " line_size=%u 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); @@ -659,10 +659,10 @@ pixma_read_image (pixma_t * s, void *buf, unsigned len) { pixma_dbg (1, "WARNING:image size mismatches\n"); pixma_dbg (1, - " %u expected (%d lines) but %u received (%d lines)\n", + " %"PRIu64" expected (%d lines) but %"PRIu64" received (%d lines)\n", s->param->image_size, s->param->h, s->cur_image_size, - s->cur_image_size / s->param->line_size); + (int) s->cur_image_size / s->param->line_size); if ((s->cur_image_size % s->param->line_size) != 0) { pixma_dbg (1, diff --git a/backend/pixma_common.h b/backend/pixma_common.h index 956154129..6175fd32c 100644 --- a/backend/pixma_common.h +++ b/backend/pixma_common.h @@ -119,7 +119,7 @@ struct pixma_t void *subdriver; /* can be used by model driver. */ /* private */ - unsigned cur_image_size; + uint64_t cur_image_size; pixma_imagebuf_t imagebuf; unsigned scanning:1; unsigned underrun:1; diff --git a/backend/pixma_mp150.c b/backend/pixma_mp150.c index 05c21a4b7..19387012c 100644 --- a/backend/pixma_mp150.c +++ b/backend/pixma_mp150.c @@ -680,7 +680,7 @@ send_scan_param (pixma_t * s) pixma_set_be16 (s->param->xdpi | 0x8000, data + 0x04); pixma_set_be16 (s->param->ydpi | 0x8000, data + 0x06); pixma_set_be32 (s->param->x, data + 0x08); - if (s->cfg->pid == MP460_PID || s->cfg->pid == MP510_PID) + if (mp->generation == 2) pixma_set_be32 (s->param->x - s->param->xs, data + 0x08); pixma_set_be32 (s->param->y, data + 0x0c); pixma_set_be32 (raw_width, data + 0x10); @@ -1104,7 +1104,7 @@ post_process_image_data (pixma_t * s, pixma_imagebuf_t * ib) mp970_reorder_pixels (mp->linebuf, sptr, c, s->param->wx, line_size); /* Crop line to selected borders */ - memcpy(cptr, sptr + cx, cw); + memmove(cptr, sptr + cx, cw); /* Color to Grayscale convert for CCD sensor */ if (is_ccd_grayscale (s))