From 206b740d88a8b3ed8466c69e6e5de72de930b0b2 Mon Sep 17 00:00:00 2001 From: Nicolas Martin Date: Tue, 2 Jun 2009 23:02:12 +0200 Subject: [PATCH 2/4] Add modified files for previous commit - backend/pixma_imageclass.c - backend/pixma_mp730.c --- backend/pixma_imageclass.c | 2 -- backend/pixma_mp730.c | 44 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/backend/pixma_imageclass.c b/backend/pixma_imageclass.c index 18cab8ebc..dc179481f 100644 --- a/backend/pixma_imageclass.c +++ b/backend/pixma_imageclass.c @@ -77,7 +77,6 @@ #define MF8100_PID 0x2659 #define MF5730_PID 0x265d #define MF5750_PID 0x265e -#define MF5770_PID 0x265f #define MF3110_PID 0x2660 #define MF3200_PID 0x2684 #define MF6500_PID 0x2686 @@ -674,7 +673,6 @@ const pixma_config_t pixma_iclass_devices[] = { DEV ("Canon imageCLASS MF8170c", "MF8170c", MF8100_PID, 600, 640, 877, PIXMA_CAP_ADF), DEV ("Canon imageCLASS MF5730", "MF5730", MF5730_PID, 600, 640, 877, PIXMA_CAP_ADF), DEV ("Canon imageCLASS MF5750", "MF5750", MF5750_PID, 600, 640, 877, PIXMA_CAP_ADF), - DEV ("Canon imageCLASS MF5770", "MF5770", MF5770_PID, 600, 640, 877, PIXMA_CAP_ADF), DEV ("Canon imageCLASS MF3110", "MF3110", MF3110_PID, 600, 640, 877, 0), DEV ("Canon imageCLASS MF3240", "MF3240", MF3200_PID, 600, 640, 877, 0), DEV ("Canon imageClass MF6500", "MF6500", MF6500_PID, 600, 640, 877, PIXMA_CAP_ADF), diff --git a/backend/pixma_mp730.c b/backend/pixma_mp730.c index c391b61b0..691775f07 100644 --- a/backend/pixma_mp730.c +++ b/backend/pixma_mp730.c @@ -71,6 +71,9 @@ #define MP710_PID 0x264d #define MP730_PID 0x262f +#define MF5770_PID 0x265f + + enum mp730_state_t { state_idle, @@ -90,6 +93,7 @@ enum mp730_cmd_t cmd_abort_session = 0xef20, cmd_time = 0xeb80, cmd_read_image = 0xd420, + cmd_error_info = 0xff20, cmd_activate = 0xcf60, cmd_calibrate = 0xe920 @@ -281,6 +285,7 @@ handle_interrupt (pixma_t * s, int timeout) case MP360_PID: case MP370_PID: case MP390_PID: + case MF5770_PID: if (len != 16) { PDBG (pixma_dbg @@ -324,8 +329,32 @@ handle_interrupt (pixma_t * s, int timeout) static int has_ccd_sensor (pixma_t * s) { - return (s->cfg->pid == MP360_PID || s->cfg->pid == MP370_PID - || s->cfg->pid == MP390_PID); + return (s->cfg->pid == MP360_PID || + s->cfg->pid == MP370_PID || + s->cfg->pid == MP390_PID || + s->cfg->pid == MF5770_PID); +} + +static int +read_error_info (pixma_t * s, void *buf, unsigned size) +{ + unsigned len = 16; + mp730_t *mp = (mp730_t *) s->subdriver; + uint8_t *data; + int error; + + data = pixma_newcmd (&mp->cb, cmd_error_info, 0, len); + error = pixma_exec (s, &mp->cb); + if (error < 0) + return error; + if (buf && len < size) + { + size = len; + /* NOTE: I've absolutely no idea what the returned data mean. */ + memcpy (buf, data, size); + error = len; + } + return error; } static int @@ -340,8 +369,16 @@ step1 (pixma_t * s) return PIXMA_ENO_PAPER; if (has_ccd_sensor (s)) { + /* MF5770: Wait 25 sec before starting */ + if (s->cfg->pid == MF5770_PID) + pixma_sleep (25000000); + activate (s, 0); error = calibrate (s); + + /* MF5770: calibration returns PIXMA_STATUS_FAILED */ + if (s->cfg->pid == MF5770_PID && error == PIXMA_ECANCELED) + error = read_error_info (s, NULL, 0); } if (error >= 0) error = activate (s, 0); @@ -641,5 +678,8 @@ const pixma_config_t pixma_mp730_devices[] = { DEVICE ("Canon MultiPASS MP710", "MP710", MP710_PID, 1200, 637, 868, 0), DEVICE ("Canon MultiPASS MP730", "MP730", MP730_PID, 1200, 637, 868, PIXMA_CAP_ADF), DEVICE ("Canon MultiPASS MP740", "MP740", MP740_PID, 1200, 637, 868, PIXMA_CAP_ADF), + + DEVICE ("Canon imageCLASS MF5770", "MF5770", MF5770_PID, 600, 640, 877, PIXMA_CAP_ADF), + DEVICE (NULL, NULL, 0, 0, 0, 0, 0) }; From e4589350f0d77323e51dcc4520cea9084a7c6e67 Mon Sep 17 00:00:00 2001 From: Nicolas Martin Date: Tue, 2 Jun 2009 23:28:13 +0200 Subject: [PATCH 3/4] backend pixma: modified warmup tempo for MF5770 - backend/pixma_mp730.c: modified tempo for warmup to handle interruptions --- backend/pixma_mp730.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/backend/pixma_mp730.c b/backend/pixma_mp730.c index 691775f07..dadeb5757 100644 --- a/backend/pixma_mp730.c +++ b/backend/pixma_mp730.c @@ -360,7 +360,7 @@ read_error_info (pixma_t * s, void *buf, unsigned size) static int step1 (pixma_t * s) { - int error; + int error, tmo; error = query_status (s); if (error < 0) @@ -371,7 +371,18 @@ step1 (pixma_t * s) { /* MF5770: Wait 25 sec before starting */ if (s->cfg->pid == MF5770_PID) - pixma_sleep (25000000); + { + tmo = 25; /* like Windows driver, 25 sec CCD calibration ? */ + while (--tmo >= 0) + { + error = handle_interrupt (s, 1000); \ + if (s->cancel) \ + return PIXMA_ECANCELED; \ + if (error != PIXMA_ECANCELED && error < 0) \ + return error; + PDBG (pixma_dbg (2, "CCD Calibration ends in %d sec.\n", tmo)); + } + } activate (s, 0); error = calibrate (s); From 228861b6b2ce5c2639459484f0fe3f435ebede62 Mon Sep 17 00:00:00 2001 From: Nicolas Martin Date: Mon, 8 Jun 2009 22:32:34 +0200 Subject: [PATCH 4/4] Second set of modifications in pixma backend for Canon ImageClass MF5770. File pixma_mp730.c: - first page scan warmup time set to 10 sec - no image post processing required in color mode --- backend/pixma_mp730.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/pixma_mp730.c b/backend/pixma_mp730.c index dadeb5757..8ade8cf9a 100644 --- a/backend/pixma_mp730.c +++ b/backend/pixma_mp730.c @@ -369,10 +369,10 @@ step1 (pixma_t * s) return PIXMA_ENO_PAPER; if (has_ccd_sensor (s)) { - /* MF5770: Wait 25 sec before starting */ - if (s->cfg->pid == MF5770_PID) + /* MF5770: Wait 10 sec before starting for 1st page only */ + if (s->cfg->pid == MF5770_PID && s->param->adf_pageid == 0) { - tmo = 25; /* like Windows driver, 25 sec CCD calibration ? */ + tmo = 10; /* like Windows driver, 10 sec CCD calibration ? */ while (--tmo >= 0) { error = handle_interrupt (s, 1000); \ @@ -582,7 +582,7 @@ mp730_fill_buffer (pixma_t * s, pixma_imagebuf_t * ib) /* n = number of full lines (rows) we have in the buffer. */ if (n != 0) { - if (s->param->channels != 1) + if (s->param->channels != 1 && s->cfg->pid != MF5770_PID) { /* color */ pack_rgb (mp->imgbuf, n, mp->raw_width, mp->lbuf);