diff --git a/ChangeLog b/ChangeLog index ed60b902a..646fc41ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-08-25 Stéphane Voltz + * backend/genesys_gl646.c backend/genesys_low.c backend/genesys_low.h + backend/genesys.c: add a no move during shading calibratiob flag, and + use it for MD5345 + 2011-08-23 Stéphane Voltz * backend/genesys_gl847.c backend/genesys_low.c backend/genesys_low.h backend/genesys.c backend/genesys_gl124.c backend/genesys_gl843.c: diff --git a/backend/genesys.c b/backend/genesys.c index d977055fe..ec681d21a 100644 --- a/backend/genesys.c +++ b/backend/genesys.c @@ -1843,6 +1843,7 @@ genesys_dark_shading_calibration (Genesys_Device * dev) uint32_t pixels_per_line; uint8_t channels; uint8_t *calibration_data; + SANE_Bool motor; DBG (DBG_proc, "genesys_dark_shading_calibration\n"); /* end pixel - start pixel */ @@ -1872,17 +1873,23 @@ genesys_dark_shading_calibration (Genesys_Device * dev) return SANE_STATUS_NO_MEM; } + motor=SANE_TRUE; + if (dev->model->flags & GENESYS_FLAG_SHADING_NO_MOVE) + { + motor=SANE_FALSE; + } + /* turn off motor and lamp power for flatbed scanners, but not for sheetfed scanners - * because they have a calibration sheet with a sufficent black strip */ + * because they have a calibration sheet with a sufficient black strip */ if (dev->model->is_sheetfed == SANE_FALSE) { dev->model->cmd_set->set_lamp_power (dev, dev->calib_reg, SANE_FALSE); - dev->model->cmd_set->set_motor_power (dev->calib_reg, SANE_TRUE); + dev->model->cmd_set->set_motor_power (dev->calib_reg, motor); } else { dev->model->cmd_set->set_lamp_power (dev, dev->calib_reg, SANE_TRUE); - dev->model->cmd_set->set_motor_power (dev->calib_reg, SANE_TRUE); + dev->model->cmd_set->set_motor_power (dev->calib_reg, motor); } status = @@ -1893,7 +1900,7 @@ genesys_dark_shading_calibration (Genesys_Device * dev) { free (calibration_data); DBG (DBG_error, - "genesys_dark_shading_calibration: Failed to bulk write registers: %s\n", + "genesys_dark_shading_calibration: failed to bulk write registers: %s\n", sane_strstatus (status)); return status; } @@ -2059,6 +2066,7 @@ genesys_white_shading_calibration (Genesys_Device * dev) uint32_t pixels_per_line; uint8_t *calibration_data; uint8_t channels; + SANE_Bool motor; DBG (DBG_proc, "genesys_white_shading_calibration (lines = %d)\n", dev->calib_lines); @@ -2087,9 +2095,15 @@ genesys_white_shading_calibration (Genesys_Device * dev) return SANE_STATUS_NO_MEM; } + motor=SANE_TRUE; + if (dev->model->flags & GENESYS_FLAG_SHADING_NO_MOVE) + { + motor=SANE_FALSE; + } + /* turn on motor and lamp power */ dev->model->cmd_set->set_lamp_power (dev, dev->calib_reg, SANE_TRUE); - dev->model->cmd_set->set_motor_power (dev->calib_reg, SANE_TRUE); + dev->model->cmd_set->set_motor_power (dev->calib_reg, motor); status = dev->model->cmd_set->bulk_write_register (dev, dev->calib_reg, @@ -2186,6 +2200,7 @@ genesys_dark_white_shading_calibration (Genesys_Device * dev) int y; uint32_t dark, white, dark_sum, white_sum, dark_count, white_count, col, dif; + SANE_Bool motor; DBG (DBG_proc, "genesys_black_white_shading_calibration (lines = %d)\n", @@ -2228,9 +2243,15 @@ genesys_dark_white_shading_calibration (Genesys_Device * dev) return SANE_STATUS_NO_MEM; } + motor=SANE_TRUE; + if (dev->model->flags & GENESYS_FLAG_SHADING_NO_MOVE) + { + motor=SANE_FALSE; + } + /* turn on motor and lamp power */ dev->model->cmd_set->set_lamp_power (dev, dev->calib_reg, SANE_TRUE); - dev->model->cmd_set->set_motor_power (dev->calib_reg, SANE_TRUE); + dev->model->cmd_set->set_motor_power (dev->calib_reg, motor); status = dev->model->cmd_set->bulk_write_register (dev, dev->calib_reg, diff --git a/backend/genesys_devices.c b/backend/genesys_devices.c index 412319027..ccc7a4b37 100644 --- a/backend/genesys_devices.c +++ b/backend/genesys_devices.c @@ -1992,6 +1992,7 @@ static Genesys_Model medion_md5345_model = { | GENESYS_FLAG_DARK_CALIBRATION | GENESYS_FLAG_OFFSET_CALIBRATION | GENESYS_FLAG_HALF_CCD_MODE + | GENESYS_FLAG_SHADING_NO_MOVE | GENESYS_FLAG_CUSTOM_GAMMA, GENESYS_HAS_COPY_SW | GENESYS_HAS_EMAIL_SW | GENESYS_HAS_POWER_SW | GENESYS_HAS_OCR_SW | GENESYS_HAS_SCAN_SW, 40, diff --git a/backend/genesys_gl646.c b/backend/genesys_gl646.c index fa47d679b..3ef1a07c1 100644 --- a/backend/genesys_gl646.c +++ b/backend/genesys_gl646.c @@ -3361,7 +3361,7 @@ gl646_init_regs_for_shading (Genesys_Device * dev) /* this is an hack to make calibration cache working .... */ /* if we don't do this, cache will be identified at the shading calibration - * dpi which is diferent from calibration one */ + * dpi which is different from calibration one */ dev->current_setup.xres = dev->settings.xres; DBG (DBG_info, "gl646_init_register_for_shading:\n\tdev->settings.xres=%d\n\tdev->settings.yres=%d\n", diff --git a/backend/genesys_low.h b/backend/genesys_low.h index b6f817c42..cc81fb6a4 100644 --- a/backend/genesys_low.h +++ b/backend/genesys_low.h @@ -98,6 +98,7 @@ #define GENESYS_FLAG_NO_CALIBRATION (1 << 14) /**> allow scanners to use skip the calibration, needed for sheetfed scanners */ #define GENESYS_FLAG_HALF_CCD_MODE (1 << 15) /**> scanner has setting for half ccd mode */ #define GENESYS_FLAG_SIS_SENSOR (1 << 16) /**> handling of multi-segments sensors in software */ +#define GENESYS_FLAG_SHADING_NO_MOVE (1 << 17) /**> scanner doesn't move sensor during shading calibration */ #define GENESYS_HAS_NO_BUTTONS 0 /**> scanner has no supported button */ #define GENESYS_HAS_SCAN_SW (1 << 0) /**> scanner has SCAN button */ @@ -460,6 +461,10 @@ typedef struct Genesys_Command_Set } Genesys_Command_Set; +/** @brief structure to describe a scanner model + * This structure describes a model. It is composed of information on the + * sensor, the motor, scanner geometry and flags to drive operation. + */ typedef struct Genesys_Model { SANE_String_Const name;