diff --git a/backend/genesys.cc b/backend/genesys.cc index 3d5a496eb..474a49169 100644 --- a/backend/genesys.cc +++ b/backend/genesys.cc @@ -5823,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; @@ -7112,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_gl843.cc b/backend/genesys_gl843.cc index 18fc55bff..0f3ea8db1 100644 --- a/backend/genesys_gl843.cc +++ b/backend/genesys_gl843.cc @@ -3037,16 +3037,26 @@ 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 || 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_sensor_to_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; diff --git a/backend/genesys_low.h b/backend/genesys_low.h index dafb4e955..f3c317477 100644 --- a/backend/genesys_low.h +++ b/backend/genesys_low.h @@ -1512,6 +1512,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;