diff --git a/backend/genesys.cc b/backend/genesys.cc index c17d6a1c3..474a49169 100644 --- a/backend/genesys.cc +++ b/backend/genesys.cc @@ -1366,10 +1366,13 @@ genesys_average_white (Genesys_Device * dev, Genesys_Sensor& sensor, int channel range = size / 50; - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) /* transparency mode */ - gain_white_ref = sensor.fau_gain_white_ref * 256; - else - gain_white_ref = sensor.gain_white_ref * 256; + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { + gain_white_ref = sensor.fau_gain_white_ref * 256; + } else { + gain_white_ref = sensor.gain_white_ref * 256; + } if (range < 1) range = 1; @@ -1502,11 +1505,15 @@ static SANE_Status genesys_coarse_calibration(Genesys_Device * dev, Genesys_Sens double applied_multi; double gain_white_ref; - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) /* Transparency */ - gain_white_ref = sensor.fau_gain_white_ref * 256; - else - gain_white_ref = sensor.gain_white_ref * 256; - /* white and black are defined downwards */ + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { + gain_white_ref = sensor.fau_gain_white_ref * 256; + } else { + gain_white_ref = sensor.gain_white_ref * 256; + } + + // white and black are defined downwards uint8_t gain0 = genesys_adjust_gain(&applied_multi, gain_white_ref / (white[0] - dark[0]), @@ -1779,6 +1786,11 @@ genesys_dark_shading_calibration(Genesys_Device * dev, const Genesys_Sensor& sen dev->dark_average_data.clear(); dev->dark_average_data.resize(dev->average_size); + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) { + // FIXME: dark shading currently not supported on infrared transparency scans + return SANE_STATUS_GOOD; + } + // FIXME: the current calculation is likely incorrect on non-GENESYS_GL843 implementations, // but this needs checking if (dev->calib_total_bytes_to_read > 0) { @@ -1843,10 +1855,10 @@ genesys_dark_shading_calibration(Genesys_Device * dev, const Genesys_Sensor& sen } std::fill(dev->dark_average_data.begin(), - dev->dark_average_data.begin() + dev->calib_pixels_offset * channels, + dev->dark_average_data.begin() + dev->calib_pixels_offset * channels * 2, 0x00); - genesys_average_data(dev->dark_average_data.data() + dev->calib_pixels_offset * channels, + genesys_average_data(dev->dark_average_data.data() + dev->calib_pixels_offset * channels * 2, calibration_data.data(), dev->calib_lines, pixels_per_line * channels); @@ -1969,7 +1981,9 @@ static void genesys_repark_sensor_before_shading(Genesys_Device* dev) TIE(dev->model->cmd_set->slow_back_home(dev, SANE_TRUE)); } - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { dev->model->cmd_set->move_to_ta(dev); } } @@ -2053,10 +2067,10 @@ genesys_white_shading_calibration (Genesys_Device * dev, const Genesys_Sensor& s channels, pixels_per_line, dev->calib_lines); std::fill(dev->dark_average_data.begin(), - dev->dark_average_data.begin() + dev->calib_pixels_offset * channels, + dev->dark_average_data.begin() + dev->calib_pixels_offset * channels * 2, 0x00); - genesys_average_data (dev->white_average_data.data() + dev->calib_pixels_offset * channels, + genesys_average_data (dev->white_average_data.data() + dev->calib_pixels_offset * channels * 2, calibration_data.data(), dev->calib_lines, pixels_per_line * channels); @@ -2184,14 +2198,14 @@ genesys_dark_white_shading_calibration(Genesys_Device * dev, const Genesys_Senso std::fill(dev->dark_average_data.begin(), - dev->dark_average_data.begin() + dev->calib_pixels_offset * channels, + dev->dark_average_data.begin() + dev->calib_pixels_offset * channels * 2, 0x00); std::fill(dev->white_average_data.begin(), - dev->white_average_data.begin() + dev->calib_pixels_offset * channels, + dev->white_average_data.begin() + dev->calib_pixels_offset * channels * 2, 0x00); - average_white = dev->white_average_data.data() + dev->calib_pixels_offset * channels; - average_dark = dev->dark_average_data.data() + dev->calib_pixels_offset * channels; + average_white = dev->white_average_data.data() + dev->calib_pixels_offset * channels * 2; + average_dark = dev->dark_average_data.data() + dev->calib_pixels_offset * channels * 2; for (x = 0; x < pixels_per_line * channels; x++) { @@ -3274,7 +3288,9 @@ genesys_flatbed_calibration(Genesys_Device * dev, Genesys_Sensor& sensor) return status; } - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { RIE(dev->model->cmd_set->move_to_ta(dev)); } @@ -3846,8 +3862,9 @@ genesys_start_scan (Genesys_Device * dev, SANE_Bool lamp_off) } /* move to calibration area for transparency adapter */ - if ((dev->settings.scan_method == ScanMethod::TRANSPARENCY) - && dev->model->cmd_set->move_to_ta != NULL) + if ((dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) && + dev->model->cmd_set->move_to_ta != NULL) { status=dev->model->cmd_set->move_to_ta(dev); if (status != SANE_STATUS_GOOD) @@ -3930,7 +3947,9 @@ genesys_start_scan (Genesys_Device * dev, SANE_Bool lamp_off) RIE(dev->model->cmd_set->slow_back_home(dev, SANE_TRUE)); } - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { RIE(dev->model->cmd_set->move_to_ta(dev)); } @@ -5804,6 +5823,18 @@ init_options (Genesys_Scanner * s) s->opt[OPT_FORCE_CALIBRATION].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + // ignore offsets option + s->opt[OPT_IGNORE_OFFSETS].name = "ignore-internal-offsets"; + s->opt[OPT_IGNORE_OFFSETS].title = SANE_I18N("Ignore internal offsets"); + s->opt[OPT_IGNORE_OFFSETS].desc = + SANE_I18N("Acquires the image including the internal calibration areas of the scanner"); + s->opt[OPT_IGNORE_OFFSETS].type = SANE_TYPE_BUTTON; + s->opt[OPT_IGNORE_OFFSETS].unit = SANE_UNIT_NONE; + s->opt[OPT_IGNORE_OFFSETS].size = 0; + s->opt[OPT_IGNORE_OFFSETS].constraint_type = SANE_CONSTRAINT_NONE; + s->opt[OPT_IGNORE_OFFSETS].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | + SANE_CAP_ADVANCED; + RIE (calc_parameters (s)); DBGCOMPLETED; @@ -7093,6 +7124,10 @@ set_option_value (Genesys_Scanner * s, int option, void *val, *myinfo |= SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS; break; + case OPT_IGNORE_OFFSETS: { + s->dev->ignore_offsets = true; + break; + } default: DBG(DBG_warn, "%s: can't set unknown option %d\n", __func__, option); } diff --git a/backend/genesys.h b/backend/genesys.h index 47a684c00..f606d1b64 100644 --- a/backend/genesys.h +++ b/backend/genesys.h @@ -142,6 +142,7 @@ enum Genesys_Option OPT_CALIBRATE, OPT_CLEAR_CALIBRATION, OPT_FORCE_CALIBRATION, + OPT_IGNORE_OFFSETS, /* must come last: */ NUM_OPTIONS diff --git a/backend/genesys_devices.cc b/backend/genesys_devices.cc index b4ae5caf0..6d7c7d7fc 100644 --- a/backend/genesys_devices.cc +++ b/backend/genesys_devices.cc @@ -1639,6 +1639,8 @@ void genesys_init_sensor_tables() { 0x0c, 0x00 }, { 0x70, 0x00 }, { 0x71, 0x02 }, + { 0x72, 0x02 }, + { 0x73, 0x04 }, { 0x9e, 0x2d }, { 0xaa, 0x00 }, { 0x16, 0x13 }, @@ -1661,13 +1663,15 @@ void genesys_init_sensor_tables() }, {}, }, - { -1, 1200, 24000, ScanMethod::TRANSPARENCY, { + { -1, 1200, 45000, ScanMethod::TRANSPARENCY, { { 0x74, 0x03 }, { 0x75, 0xf0 }, { 0x76, 0xf0 }, { 0x77, 0x03 }, { 0x78, 0xfe }, { 0x79, 0x00 }, { 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0x49 }, { 0x0c, 0x00 }, { 0x70, 0x00 }, { 0x71, 0x02 }, + { 0x72, 0x02 }, + { 0x73, 0x04 }, { 0x9e, 0x2d }, { 0xaa, 0x00 }, { 0x16, 0x13 }, @@ -1690,13 +1694,15 @@ void genesys_init_sensor_tables() }, {}, }, - { 2400, 2400, 24000, ScanMethod::TRANSPARENCY, { + { 2400, 2400, 45000, ScanMethod::TRANSPARENCY, { { 0x74, 0x03 }, { 0x75, 0xfe }, { 0x76, 0x00 }, { 0x77, 0x03 }, { 0x78, 0xfe }, { 0x79, 0x00 }, { 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0x49 }, { 0x0c, 0x00 }, { 0x70, 0x00 }, { 0x71, 0x02 }, + { 0x72, 0x02 }, + { 0x73, 0x04 }, { 0x9e, 0x2d }, { 0xaa, 0x00 }, { 0x16, 0x13 }, @@ -1719,7 +1725,7 @@ void genesys_init_sensor_tables() }, {}, }, - { 4800, 4800, 24000, ScanMethod::TRANSPARENCY, { + { 4800, 4800, 45000, ScanMethod::TRANSPARENCY, { { 0x74, 0x03 }, { 0x75, 0xff }, { 0x76, 0xff }, { 0x77, 0x03 }, { 0x78, 0xff }, { 0x79, 0xff }, { 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0x49 }, @@ -1751,22 +1757,48 @@ void genesys_init_sensor_tables() { { 0x03, 0x1f }, }, }, + { -1, 1200, 45000, ScanMethod::TRANSPARENCY_INFRARED, { + { 0x74, 0x03 }, { 0x75, 0xf0 }, { 0x76, 0xf0 }, + { 0x77, 0x03 }, { 0x78, 0xfe }, { 0x79, 0x00 }, + { 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0x49 }, + { 0x0c, 0x00 }, + { 0x70, 0x00 }, + { 0x71, 0x02 }, + { 0x9e, 0x2d }, + { 0xaa, 0x00 }, + { 0x16, 0x13 }, + { 0x17, 0x0a }, + { 0x18, 0x10 }, + { 0x19, 0x2a }, + { 0x1a, 0x30 }, + { 0x1b, 0x00 }, + { 0x1c, 0x00 }, + { 0x1d, 0x6b }, + { 0x52, 0x0c }, + { 0x53, 0x0f }, + { 0x54, 0x00 }, + { 0x55, 0x03 }, + { 0x56, 0x06 }, + { 0x57, 0x09 }, + { 0x58, 0x6b }, + { 0x59, 0x00 }, + { 0x5a, 0x40 }, + }, + {}, + }, }; - auto base_custom_regs = sensor.custom_regs; for (const CustomSensorSettings& setting : custom_settings) { sensor.min_resolution = setting.min_resolution; sensor.max_resolution = setting.max_resolution; sensor.method = setting.method; sensor.exposure_lperiod = setting.exposure_lperiod; - sensor.custom_regs = base_custom_regs; - sensor.custom_regs.merge(setting.extra_custom_regs); + sensor.custom_regs = setting.extra_custom_regs; sensor.custom_fe_regs = setting.custom_fe_regs; s_sensors->push_back(sensor); } } - s_sensors->push_back(sensor); sensor = Genesys_Sensor(); @@ -2743,6 +2775,7 @@ static Genesys_Model umax_astra_4500_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX (0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -2794,6 +2827,7 @@ static Genesys_Model canon_lide_50_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX (0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -2851,6 +2885,7 @@ static Genesys_Model panasonic_kvss080_model = { SANE_FIX (0.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (0.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX (0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -2904,6 +2939,7 @@ static Genesys_Model hp4850c_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -2961,6 +2997,7 @@ static Genesys_Model hpg4010_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3018,6 +3055,7 @@ static Genesys_Model hpg4050_model = { SANE_FIX (217.9), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (250.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (40.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3076,6 +3114,7 @@ static Genesys_Model canon_4400f_model = { SANE_FIX (217.9), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (250.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (40.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3136,6 +3175,7 @@ static Genesys_Model canon_8400f_model = { SANE_FIX (217.9), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (250.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (40.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3191,12 +3231,13 @@ static Genesys_Model canon_8600f_model = { SANE_FIX(0.0), // Start of white strip in mm (y) SANE_FIX(8.0), // Start of black mark in mm (x) - SANE_FIX(95.0), // x_offset_ta + SANE_FIX(85.0), // x_offset_ta SANE_FIX(26.0), // y_offset_ta SANE_FIX(70.0), // x_size_ta SANE_FIX(230.0), // y_size_ta - SANE_FIX(12.5), // y_offset_calib + SANE_FIX(11.5), // y_offset_sensor_to_ta + SANE_FIX(14.0), // y_offset_calib_ta SANE_FIX(0.0), // Size of scan area after paper sensor stops // sensing document in mm @@ -3214,6 +3255,7 @@ static Genesys_Model canon_8600f_model = { GPO_CS8600F, MOTOR_CS8600F, GENESYS_FLAG_HAS_UTA | + GENESYS_FLAG_HAS_UTA_INFRARED | GENESYS_FLAG_LAZY_INIT | GENESYS_FLAG_OFFSET_CALIBRATION | GENESYS_FLAG_STAGGERED_LINE | @@ -3255,6 +3297,7 @@ static Genesys_Model canon_lide_100_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3311,6 +3354,7 @@ static Genesys_Model canon_lide_110_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3365,6 +3409,7 @@ static Genesys_Model canon_lide_120_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3420,6 +3465,7 @@ static Genesys_Model canon_lide_210_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3474,6 +3520,7 @@ static Genesys_Model canon_lide_220_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3528,6 +3575,7 @@ static Genesys_Model canon_5600f_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3583,6 +3631,7 @@ static Genesys_Model canon_lide_700f_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3640,6 +3689,7 @@ static Genesys_Model canon_lide_200_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3696,6 +3746,7 @@ static Genesys_Model canon_lide_60_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3753,6 +3804,7 @@ static Genesys_Model canon_lide_80_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3811,6 +3863,7 @@ static Genesys_Model hp2300c_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3868,6 +3921,7 @@ Genesys_Model hp2400c_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3925,6 +3979,7 @@ Genesys_Model visioneer_xp200_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -3980,6 +4035,7 @@ static Genesys_Model hp3670c_model = { SANE_FIX (25.6), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (78.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (76.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -4036,6 +4092,7 @@ static Genesys_Model plustek_st12_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -4086,6 +4143,7 @@ static Genesys_Model plustek_st24_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -4141,6 +4199,7 @@ static Genesys_Model medion_md5345_model = { SANE_FIX (0.00), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (0.00), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.00), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -4197,6 +4256,7 @@ static Genesys_Model visioneer_xp300_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (26.5), /* Size of scan area after paper sensor stops @@ -4252,6 +4312,7 @@ static Genesys_Model syscan_docketport_665_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (17.5), /* Size of scan area after paper sensor stops @@ -4306,6 +4367,7 @@ static Genesys_Model visioneer_roadwarrior_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (16.0), /* Size of scan area after paper sensor stops @@ -4360,6 +4422,7 @@ static Genesys_Model syscan_docketport_465_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (16.0), /* Size of scan area after paper sensor stops @@ -4414,6 +4477,7 @@ static Genesys_Model visioneer_xp100_r3_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (16.0), /* Size of scan area after paper sensor stops @@ -4468,6 +4532,7 @@ static Genesys_Model pentax_dsmobile_600_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (16.0), /* Size of scan area after paper sensor stops @@ -4522,6 +4587,7 @@ static Genesys_Model syscan_docketport_467_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (16.0), /* Size of scan area after paper sensor stops @@ -4576,6 +4642,7 @@ static Genesys_Model syscan_docketport_685_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (26.5), /* Size of scan area after paper sensor stops @@ -4631,6 +4698,7 @@ static Genesys_Model syscan_docketport_485_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (26.5), /* Size of scan area after paper sensor stops @@ -4686,6 +4754,7 @@ static Genesys_Model dct_docketport_487_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (26.5), /* Size of scan area after paper sensor stops @@ -4742,6 +4811,7 @@ static Genesys_Model visioneer_7100_model = { SANE_FIX (0.00), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (0.00), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.00), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -4798,6 +4868,7 @@ static Genesys_Model xerox_2400_model = { SANE_FIX (0.00), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (0.00), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.00), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -4855,6 +4926,7 @@ static Genesys_Model xerox_travelscanner_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (16.0), /* Size of scan area after paper sensor stops @@ -4908,6 +4980,7 @@ static Genesys_Model plustek_3600_model = { SANE_FIX (0.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (0.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -4965,6 +5038,7 @@ static Genesys_Model hpn6310_model = { SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0), /* Size of scan area after paper sensor stops @@ -5024,6 +5098,7 @@ static Genesys_Model plustek_3800_model = { SANE_FIX (0.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (0.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops @@ -5078,6 +5153,7 @@ static Genesys_Model canon_formula101_model = { SANE_FIX (0.0), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (0.0), /* Size of scan area in TA mode in mm (y) */ + SANE_FIX(0.0), // y_offset_sensor_to_ta SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */ SANE_FIX (0.0), /* Size of scan area after paper sensor stops diff --git a/backend/genesys_gl124.cc b/backend/genesys_gl124.cc index b6ab01fd2..cc2141a3d 100644 --- a/backend/genesys_gl124.cc +++ b/backend/genesys_gl124.cc @@ -2082,7 +2082,7 @@ gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse) local_reg = dev->reg; resolution=sanei_genesys_get_lowest_ydpi(dev); - const auto& sensor = sanei_genesys_find_sensor(dev, resolution); + const auto& sensor = sanei_genesys_find_sensor(dev, resolution, ScanMethod::FLATBED); SetupParams params; params.xres = resolution; @@ -2181,7 +2181,7 @@ gl124_search_start_position (Genesys_Device * dev) // FIXME: the current approach of doing search only for one resolution does not work on scanners // whith employ different sensors with potentially different settings. - auto& sensor = sanei_genesys_find_sensor_for_write(dev, dpi); + auto& sensor = sanei_genesys_find_sensor_for_write(dev, dpi, ScanMethod::FLATBED); SetupParams params; params.xres = dpi; diff --git a/backend/genesys_gl646.cc b/backend/genesys_gl646.cc index b2b9f6296..4fc211880 100644 --- a/backend/genesys_gl646.cc +++ b/backend/genesys_gl646.cc @@ -2481,7 +2481,7 @@ gl646_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home) settings.threshold = 0; settings.dynamic_lineart = SANE_FALSE; - const auto& sensor = sanei_genesys_find_sensor(dev, settings.xres); + const auto& sensor = sanei_genesys_find_sensor(dev, settings.xres, ScanMethod::FLATBED); status = setup_for_scan(dev, sensor, &dev->reg, settings, SANE_TRUE, SANE_TRUE, SANE_TRUE); if (status != SANE_STATUS_GOOD) @@ -2586,7 +2586,7 @@ gl646_search_start_position (Genesys_Device * dev) // FIXME: the current approach of doing search only for one resolution does not work on scanners // whith employ different sensors with potentially different settings. - auto& sensor = sanei_genesys_find_sensor_for_write(dev, resolution); + auto& sensor = sanei_genesys_find_sensor_for_write(dev, resolution, ScanMethod::FLATBED); /* fill settings for a gray level scan */ settings.scan_method = ScanMethod::FLATBED; @@ -3860,7 +3860,7 @@ gl646_repark_head (Genesys_Device * dev) settings.threshold = 0; settings.dynamic_lineart = SANE_FALSE; - const auto& sensor = sanei_genesys_find_sensor(dev, settings.xres); + const auto& sensor = sanei_genesys_find_sensor(dev, settings.xres, ScanMethod::FLATBED); status = setup_for_scan(dev, sensor, &dev->reg, settings, SANE_FALSE, SANE_FALSE, SANE_FALSE); if (status != SANE_STATUS_GOOD) @@ -4119,7 +4119,7 @@ gl646_move_to_ta (Genesys_Device * dev) SANE_Status status = SANE_STATUS_GOOD; DBGSTART; - if (simple_move (dev, SANE_UNFIX (dev->model->y_offset_calib_ta)) != + if (simple_move(dev, SANE_UNFIX(dev->model->y_offset_sensor_to_ta)) != SANE_STATUS_GOOD) { DBG(DBG_error, "%s: failed to move to calibration area\n", __func__); @@ -4367,7 +4367,7 @@ simple_move (Genesys_Device * dev, SANE_Int distance) int resolution = get_lowest_resolution(dev->model->ccd_type, 3); - const auto& sensor = sanei_genesys_find_sensor(dev, resolution); + const auto& sensor = sanei_genesys_find_sensor(dev, resolution, ScanMethod::FLATBED); /* TODO give a no AGOHOME flag */ settings.scan_method = ScanMethod::TRANSPARENCY; diff --git a/backend/genesys_gl841.cc b/backend/genesys_gl841.cc index 3e63b8334..43a2909a7 100644 --- a/backend/genesys_gl841.cc +++ b/backend/genesys_gl841.cc @@ -3557,7 +3557,7 @@ gl841_search_start_position (Genesys_Device * dev) // FIXME: the current approach of doing search only for one resolution does not work on scanners // whith employ different sensors with potentially different settings. - auto& sensor = sanei_genesys_find_sensor_for_write(dev, dpi); + auto& sensor = sanei_genesys_find_sensor_for_write(dev, dpi, ScanMethod::FLATBED); SetupParams params; params.xres = dpi; diff --git a/backend/genesys_gl843.cc b/backend/genesys_gl843.cc index f0a6d6dba..99d78abce 100644 --- a/backend/genesys_gl843.cc +++ b/backend/genesys_gl843.cc @@ -579,8 +579,8 @@ gl843_init_registers (Genesys_Device * dev) // CPL[0:4]: The position of falling edge of CCD CP signal in cycles SETREG(0x70, 0x01); // SENSOR_DEF SETREG(0x71, 0x03); // SENSOR_DEF - SETREG(0x72, 0x04); - SETREG(0x73, 0x05); + SETREG(0x72, 0x04); // SENSOR_DEF + SETREG(0x73, 0x05); // SENSOR_DEF if (dev->model->model_id == MODEL_CANON_CANOSCAN_4400F) { SETREG(0x70, 0x01); @@ -1697,14 +1697,17 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor /* depth */ depth = dev->settings.depth; - if (dev->settings.scan_mode == ScanColorMode::LINEART) - depth = 1; + if (dev->settings.scan_mode == ScanColorMode::LINEART) { + depth = 1; + } - /* start */ - if(dev->settings.scan_method==ScanMethod::TRANSPARENCY) - start = SANE_UNFIX (dev->model->x_offset_ta); - else - start = SANE_UNFIX (dev->model->x_offset); + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { + start = SANE_UNFIX(dev->model->x_offset_ta); + } else { + start = SANE_UNFIX(dev->model->x_offset); + } start /= ccd_size_divisor; @@ -2121,6 +2124,7 @@ static SANE_Status gl843_set_xpa_motor_power(Genesys_Device *dev, bool set) RIE(sanei_genesys_read_register(dev, REGA6, &val)); val |= REGA6_GPIO17; + val &= ~REGA6_GPIO23; RIE(sanei_genesys_write_register(dev, REGA6,val)); } else { RIE(sanei_genesys_read_register(dev, REG6C, &val)); @@ -2130,6 +2134,7 @@ static SANE_Status gl843_set_xpa_motor_power(Genesys_Device *dev, bool set) RIE(sanei_genesys_read_register(dev, REGA6, &val)); val &= ~REGA6_GPIO17; + val &= ~REGA6_GPIO23; RIE(sanei_genesys_write_register(dev, REGA6,val)); } DBGCOMPLETED; @@ -2201,7 +2206,9 @@ static SANE_Status gl843_set_xpa_lamp_power(Genesys_Device *dev, bool set) val &= ~(REGA6_GPIO24 | REGA6_GPIO23); // set XPA lamp power - val |= REGA6_GPIO22 | REGA6_GPIO21 | REGA6_GPIO19; + if (dev->settings.scan_method != ScanMethod::TRANSPARENCY_INFRARED) { + val |= REGA6_GPIO22 | REGA6_GPIO21 | REGA6_GPIO19; + } RIE(sanei_genesys_write_register(dev, REGA6, val)); @@ -2222,6 +2229,20 @@ static SANE_Status gl843_set_xpa_lamp_power(Genesys_Device *dev, bool set) RIE(sanei_genesys_write_register(dev, REGA6, val)); } + if (dev->model->model_id == MODEL_CANON_CANOSCAN_8600F && + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { + if (set) { + RIE(sanei_genesys_read_register(dev, REG6C, &val)); + val |= REG6C_GPIO16; + RIE(sanei_genesys_write_register(dev, REG6C, val)); + } else { + RIE(sanei_genesys_read_register(dev, REG6C, &val)); + val &= ~REG6C_GPIO16; + RIE(sanei_genesys_write_register(dev, REG6C, val)); + } + } + DBGCOMPLETED; return status; } @@ -2281,6 +2302,9 @@ gl843_begin_scan (Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys_Re RIE (sanei_genesys_write_register (dev, REG7E, 0x01)); break; case GPO_CS8600F: + if (reg->state.is_xpa_on && reg->state.is_lamp_on) { + RIE(gl843_set_xpa_lamp_power(dev, true)); + } if (reg->state.is_xpa_on) { dev->needs_home_ta = SANE_TRUE; RIE(gl843_set_xpa_motor_power(dev, true)); @@ -2490,7 +2514,7 @@ gl843_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home) local_reg = dev->reg; resolution=sanei_genesys_get_lowest_ydpi(dev); - const auto& sensor = sanei_genesys_find_sensor(dev, resolution); + const auto& sensor = sanei_genesys_find_sensor(dev, resolution, ScanMethod::FLATBED); ScanSession session; session.params.xres = resolution; @@ -2612,7 +2636,7 @@ gl843_search_start_position (Genesys_Device * dev) // FIXME: the current approach of doing search only for one resolution does not work on scanners // whith employ different sensors with potentially different settings. - auto& sensor = sanei_genesys_find_sensor_for_write(dev, dpi); + auto& sensor = sanei_genesys_find_sensor_for_write(dev, dpi, ScanMethod::FLATBED); ScanSession session; session.params.xres = dpi; @@ -2722,7 +2746,8 @@ gl843_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso SCAN_FLAG_SINGLE_LINE | SCAN_FLAG_IGNORE_LINE_DISTANCE; - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) { flags |= SCAN_FLAG_USE_XPA; } @@ -2784,7 +2809,7 @@ gl843_feed (Genesys_Device * dev, unsigned int steps) resolution=sanei_genesys_get_lowest_ydpi(dev); - const auto& sensor = sanei_genesys_find_sensor(dev, resolution); + const auto& sensor = sanei_genesys_find_sensor(dev, resolution, ScanMethod::FLATBED); ScanSession session; session.params.xres = resolution; @@ -2879,10 +2904,15 @@ gl843_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor, regs = dev->reg; dev->calib_channels = 3; - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) - dev->calib_lines = dev->model->shading_ta_lines; - else - dev->calib_lines = dev->model->shading_lines; + + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { + dev->calib_lines = dev->model->shading_ta_lines; + } else { + dev->calib_lines = dev->model->shading_lines; + } + dpihw = sanei_genesys_compute_dpihw_calibration(dev, sensor, dev->settings.xres); factor=sensor.optical_res/dpihw; resolution=dpihw; @@ -2890,7 +2920,8 @@ gl843_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor, const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, dev->settings.scan_method); - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY && + if ((dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) && dev->model->model_id == MODEL_CANON_CANOSCAN_8600F && dev->settings.xres == 4800) { @@ -2898,7 +2929,7 @@ gl843_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor, offset /= calib_sensor.get_ccd_size_divisor_for_dpi(resolution); offset = (offset * calib_sensor.optical_res) / MM_PER_INCH; - unsigned size = SANE_UNFIX(dev->model->x_size_ta); + float size = SANE_UNFIX(dev->model->x_size_ta); size /= calib_sensor.get_ccd_size_divisor_for_dpi(resolution); size = (size * calib_sensor.optical_res) / MM_PER_INCH; @@ -2918,11 +2949,13 @@ gl843_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor, SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE | SCAN_FLAG_IGNORE_LINE_DISTANCE; - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) - { + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { // note: move_to_ta() function has already been called and the sensor is at the // transparency adapter - move = 0; // already at dev->model->y_offset_calib_ta implicitly + move = SANE_UNFIX(dev->model->y_offset_calib_ta) - + SANE_UNFIX(dev->model->y_offset_sensor_to_ta); flags |= SCAN_FLAG_USE_XPA; } else @@ -3004,25 +3037,39 @@ gl843_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor) move_dpi = dev->motor.base_ydpi; flags = 0; - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) - { + + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { // note: move_to_ta() function has already been called and the sensor is at the // transparency adapter - move = SANE_UNFIX(dev->model->y_offset_ta) - SANE_UNFIX(dev->model->y_offset_calib_ta); - flags |= SCAN_FLAG_USE_XPA; - } - else - move = SANE_UNFIX(dev->model->y_offset); + if (dev->ignore_offsets) { + move = 0; + } else { + move = SANE_UNFIX(dev->model->y_offset_ta) - + SANE_UNFIX(dev->model->y_offset_sensor_to_ta); + } + flags |= SCAN_FLAG_USE_XPA; + } else { + if (dev->ignore_offsets) { + move = 0; + } else { + move = SANE_UNFIX(dev->model->y_offset); + } + } move += dev->settings.tl_y; move = (move * move_dpi) / MM_PER_INCH; DBG(DBG_info, "%s: move=%f steps\n", __func__, move); /* start */ - if(dev->settings.scan_method==ScanMethod::TRANSPARENCY) - start = SANE_UNFIX (dev->model->x_offset_ta); - else - start = SANE_UNFIX (dev->model->x_offset); + if (dev->settings.scan_method==ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { + start = SANE_UNFIX(dev->model->x_offset_ta); + } else { + start = SANE_UNFIX(dev->model->x_offset); + } start /= sensor.get_ccd_size_divisor_for_dpi(dev->settings.xres); start += dev->settings.tl_x; @@ -3364,7 +3411,8 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor, int start_pixel = 0; black_pixels = calib_sensor.black_pixels / factor; - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY && + if ((dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) && dev->model->model_id == MODEL_CANON_CANOSCAN_8600F && dev->settings.xres == 4800) { @@ -3382,10 +3430,11 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor, SCAN_FLAG_SINGLE_LINE | SCAN_FLAG_IGNORE_LINE_DISTANCE; - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) - { - flags |= SCAN_FLAG_USE_XPA; - } + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { + flags |= SCAN_FLAG_USE_XPA; + } ScanSession session; session.params.xres = resolution; @@ -3612,10 +3661,11 @@ gl843_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor SCAN_FLAG_SINGLE_LINE | SCAN_FLAG_IGNORE_LINE_DISTANCE; - if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) - { - flags |= SCAN_FLAG_USE_XPA; - } + if (dev->settings.scan_method == ScanMethod::TRANSPARENCY || + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { + flags |= SCAN_FLAG_USE_XPA; + } const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, dev->settings.scan_method); @@ -4036,7 +4086,7 @@ gl843_move_to_ta (Genesys_Device * dev) DBGSTART; resolution=sanei_genesys_get_lowest_ydpi(dev); - feed = 16*(SANE_UNFIX (dev->model->y_offset_calib_ta) * resolution) / MM_PER_INCH; + feed = 16*(SANE_UNFIX (dev->model->y_offset_sensor_to_ta) * resolution) / MM_PER_INCH; status = gl843_feed (dev, feed); if (status != SANE_STATUS_GOOD) { diff --git a/backend/genesys_gl846.cc b/backend/genesys_gl846.cc index 82dc9983a..afb22f07e 100644 --- a/backend/genesys_gl846.cc +++ b/backend/genesys_gl846.cc @@ -1807,7 +1807,7 @@ gl846_search_start_position (Genesys_Device * dev) // FIXME: the current approach of doing search only for one resolution does not work on scanners // whith employ different sensors with potentially different settings. - auto& sensor = sanei_genesys_find_sensor_for_write(dev, dpi); + auto& sensor = sanei_genesys_find_sensor_for_write(dev, dpi, ScanMethod::FLATBED); SetupParams params; params.xres = dpi; @@ -1974,7 +1974,7 @@ gl846_feed (Genesys_Device * dev, unsigned int steps) local_reg = dev->reg; resolution=sanei_genesys_get_lowest_ydpi(dev); - const auto& sensor = sanei_genesys_find_sensor(dev, resolution); + const auto& sensor = sanei_genesys_find_sensor(dev, resolution, ScanMethod::FLATBED); SetupParams params; params.xres = resolution; diff --git a/backend/genesys_gl847.cc b/backend/genesys_gl847.cc index 00bd1376d..fbfcfd98c 100644 --- a/backend/genesys_gl847.cc +++ b/backend/genesys_gl847.cc @@ -1873,7 +1873,7 @@ gl847_search_start_position (Genesys_Device * dev) // FIXME: the current approach of doing search only for one resolution does not work on scanners // whith employ different sensors with potentially different settings. - auto& sensor = sanei_genesys_find_sensor_for_write(dev, dpi); + auto& sensor = sanei_genesys_find_sensor_for_write(dev, dpi, ScanMethod::FLATBED); SetupParams params; params.xres = dpi; @@ -2040,7 +2040,7 @@ gl847_feed (Genesys_Device * dev, unsigned int steps) local_reg = dev->reg; resolution=sanei_genesys_get_lowest_ydpi(dev); - const auto& sensor = sanei_genesys_find_sensor(dev, resolution); + const auto& sensor = sanei_genesys_find_sensor(dev, resolution, ScanMethod::FLATBED); SetupParams params; params.xres = resolution; diff --git a/backend/genesys_low.cc b/backend/genesys_low.cc index e504dd2cf..683888d42 100644 --- a/backend/genesys_low.cc +++ b/backend/genesys_low.cc @@ -999,6 +999,13 @@ void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sen if (dev->model->asic_type == GENESYS_GL843) { sanei_genesys_set_exposure(regs, sensor.exposure); + + // we don't actually turn on lamp on infrared scan + if (dev->model->model_id == MODEL_CANON_CANOSCAN_8600F && + dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) + { + regs.find_reg(0x03).value &= ~REG03_LAMPPWR; + } } } else { regs.find_reg(0x03).value &= ~REG03_LAMPPWR; @@ -1009,7 +1016,11 @@ void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sen } if (dev->model->asic_type == GENESYS_GL843) { - if (dev->model->model_id != MODEL_CANON_CANOSCAN_8600F) { + if (dev->model->model_id == MODEL_PANASONIC_KV_SS080 || + dev->model->model_id == MODEL_HP_SCANJET_4850C || + dev->model->model_id == MODEL_HP_SCANJET_G4010 || + dev->model->model_id == MODEL_HP_SCANJET_G4050) + { // BUG: datasheet says we shouldn't set exposure to zero sanei_genesys_set_exposure(regs, {0, 0, 0}); } diff --git a/backend/genesys_low.h b/backend/genesys_low.h index 072a156c1..844d02ef3 100644 --- a/backend/genesys_low.h +++ b/backend/genesys_low.h @@ -1168,6 +1168,7 @@ typedef struct Genesys_Model SANE_Int bpp_gray_values[MAX_DPI]; /* possible depths in gray mode */ SANE_Int bpp_color_values[MAX_DPI]; /* possible depths in color mode */ + // All offsets below are with respect to the sensor home position SANE_Fixed x_offset; /* Start of scan area in mm */ SANE_Fixed y_offset; /* Start of scan area in mm (Amount of feeding needed to get to the medium) */ @@ -1182,6 +1183,9 @@ typedef struct Genesys_Model SANE_Fixed x_size_ta; /* Size of scan area in TA mode in mm */ SANE_Fixed y_size_ta; /* Size of scan area in TA mode in mm */ + // The position of the sensor when it's aligned with the lamp for transparency scanning + SANE_Fixed y_offset_sensor_to_ta; + SANE_Fixed y_offset_calib_ta; /* Start of white strip in TA mode in mm */ SANE_Fixed post_scan; /* Size of scan area after paper sensor stops @@ -1509,6 +1513,10 @@ struct Genesys_Device // if enabled, no calibration data will be loaded or saved to files SANE_Int force_calibration = 0; + // if enabled, will ignore the scan offsets and start scanning at true origin. This allows + // acquiring the positions of the black and white strips and the actual scan area + bool ignore_offsets = false; + Genesys_Model *model = nullptr; Genesys_Register_Set reg; @@ -1747,9 +1755,9 @@ extern void sanei_genesys_init_structs (Genesys_Device * dev); const Genesys_Sensor& sanei_genesys_find_sensor_any(Genesys_Device* dev); Genesys_Sensor& sanei_genesys_find_sensor_any_for_write(Genesys_Device* dev); const Genesys_Sensor& sanei_genesys_find_sensor(Genesys_Device* dev, int dpi, - ScanMethod scan_method = ScanMethod::FLATBED); + ScanMethod scan_method); Genesys_Sensor& sanei_genesys_find_sensor_for_write(Genesys_Device* dev, int dpi, - ScanMethod scan_method = ScanMethod::FLATBED); + ScanMethod scan_method); extern SANE_Status sanei_genesys_init_shading_data (Genesys_Device * dev, const Genesys_Sensor& sensor,