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..8ade8cf9a 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,14 +329,38 @@ 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 step1 (pixma_t * s) { - int error; + int error, tmo; error = query_status (s); if (error < 0) @@ -340,8 +369,27 @@ step1 (pixma_t * s) return PIXMA_ENO_PAPER; if (has_ccd_sensor (s)) { + /* MF5770: Wait 10 sec before starting for 1st page only */ + if (s->cfg->pid == MF5770_PID && s->param->adf_pageid == 0) + { + tmo = 10; /* like Windows driver, 10 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); + + /* 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); @@ -534,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); @@ -641,5 +689,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) };