Merge branch 'genesys-default-scan-method' into 'master'

genesys: Add a way to specify default scan method

See merge request sane-project/backends!173
merge-requests/175/head
Povilas Kanapickas 2019-09-27 20:55:51 +00:00
commit c59f9a037b
9 zmienionych plików z 104 dodań i 53 usunięć

Wyświetl plik

@ -192,16 +192,31 @@ const Genesys_Sensor& sanei_genesys_find_sensor_any(Genesys_Device* dev)
throw std::runtime_error("Given device does not have sensor defined"); throw std::runtime_error("Given device does not have sensor defined");
} }
const Genesys_Sensor& sanei_genesys_find_sensor(Genesys_Device* dev, int dpi, unsigned channels, Genesys_Sensor* find_sensor_impl(Genesys_Device* dev, unsigned dpi, unsigned channels,
ScanMethod scan_method) ScanMethod scan_method)
{ {
for (const auto& sensor : *s_sensors) { for (auto& sensor : *s_sensors) {
if (dev->model->ccd_type == sensor.sensor_id && sensor.resolutions.matches(dpi) && if (dev->model->ccd_type == sensor.sensor_id && sensor.resolutions.matches(dpi) &&
sensor.matches_channel_count(channels) && sensor.method == scan_method) sensor.matches_channel_count(channels) && sensor.method == scan_method)
{ {
return sensor; return &sensor;
} }
} }
return nullptr;
}
bool sanei_genesys_has_sensor(Genesys_Device* dev, unsigned dpi, unsigned channels,
ScanMethod scan_method)
{
return find_sensor_impl(dev, dpi, channels, scan_method) != nullptr;
}
const Genesys_Sensor& sanei_genesys_find_sensor(Genesys_Device* dev, int dpi, unsigned channels,
ScanMethod scan_method)
{
const auto* sensor = find_sensor_impl(dev, dpi, channels, scan_method);
if (sensor)
return *sensor;
throw std::runtime_error("Given device does not have sensor defined"); throw std::runtime_error("Given device does not have sensor defined");
} }
@ -209,13 +224,9 @@ Genesys_Sensor& sanei_genesys_find_sensor_for_write(Genesys_Device* dev, int dpi
unsigned channels, unsigned channels,
ScanMethod scan_method) ScanMethod scan_method)
{ {
for (auto& sensor : *s_sensors) { auto* sensor = find_sensor_impl(dev, dpi, channels, scan_method);
if (dev->model->ccd_type == sensor.sensor_id && sensor.resolutions.matches(dpi) && if (sensor)
sensor.matches_channel_count(channels) && sensor.method == scan_method) return *sensor;
{
return sensor;
}
}
throw std::runtime_error("Given device does not have sensor defined"); throw std::runtime_error("Given device does not have sensor defined");
} }
@ -276,7 +287,7 @@ sanei_genesys_init_structs (Genesys_Device * dev)
} }
if (!motor_ok || !gpo_ok || !fe_ok) { if (!motor_ok || !gpo_ok || !fe_ok) {
DBG(DBG_error0, "%s: bad description(s) for fe/gpo/motor=%d/%d/%d\n", __func__, throw SaneException("bad description(s) for fe/gpo/motor=%d/%d/%d\n",
dev->model->ccd_type, dev->model->gpo_type, dev->model->motor_type); dev->model->ccd_type, dev->model->gpo_type, dev->model->motor_type);
} }
@ -5696,9 +5707,14 @@ get_option_value (Genesys_Scanner * s, int option, void *val)
unsigned option_size = 0; unsigned option_size = 0;
SANE_Status status = SANE_STATUS_GOOD; SANE_Status status = SANE_STATUS_GOOD;
const Genesys_Sensor& sensor = sanei_genesys_find_sensor(s->dev, s->dev->settings.xres, const Genesys_Sensor* sensor = nullptr;
if (sanei_genesys_has_sensor(s->dev, s->dev->settings.xres, s->dev->settings.get_channels(),
s->dev->settings.scan_method))
{
sensor = &sanei_genesys_find_sensor(s->dev, s->dev->settings.xres,
s->dev->settings.get_channels(), s->dev->settings.get_channels(),
s->dev->settings.scan_method); s->dev->settings.scan_method);
}
switch (option) switch (option)
{ {
@ -5793,13 +5809,16 @@ get_option_value (Genesys_Scanner * s, int option, void *val)
/* word array options */ /* word array options */
case OPT_GAMMA_VECTOR: case OPT_GAMMA_VECTOR:
if (!sensor)
throw SaneException("Unsupported scanner mode selected");
table = (SANE_Word *) val; table = (SANE_Word *) val;
if (s->color_filter == "Red") { if (s->color_filter == "Red") {
gamma_table = get_gamma_table(s->dev, sensor, GENESYS_RED); gamma_table = get_gamma_table(s->dev, *sensor, GENESYS_RED);
} else if (s->color_filter == "Blue") { } else if (s->color_filter == "Blue") {
gamma_table = get_gamma_table(s->dev, sensor, GENESYS_BLUE); gamma_table = get_gamma_table(s->dev, *sensor, GENESYS_BLUE);
} else { } else {
gamma_table = get_gamma_table(s->dev, sensor, GENESYS_GREEN); gamma_table = get_gamma_table(s->dev, *sensor, GENESYS_GREEN);
} }
option_size = s->opt[option].size / sizeof (SANE_Word); option_size = s->opt[option].size / sizeof (SANE_Word);
if (gamma_table.size() != option_size) { if (gamma_table.size() != option_size) {
@ -5810,8 +5829,11 @@ get_option_value (Genesys_Scanner * s, int option, void *val)
} }
break; break;
case OPT_GAMMA_VECTOR_R: case OPT_GAMMA_VECTOR_R:
if (!sensor)
throw SaneException("Unsupported scanner mode selected");
table = (SANE_Word *) val; table = (SANE_Word *) val;
gamma_table = get_gamma_table(s->dev, sensor, GENESYS_RED); gamma_table = get_gamma_table(s->dev, *sensor, GENESYS_RED);
option_size = s->opt[option].size / sizeof (SANE_Word); option_size = s->opt[option].size / sizeof (SANE_Word);
if (gamma_table.size() != option_size) { if (gamma_table.size() != option_size) {
throw std::runtime_error("The size of the gamma tables does not match"); throw std::runtime_error("The size of the gamma tables does not match");
@ -5821,8 +5843,11 @@ get_option_value (Genesys_Scanner * s, int option, void *val)
} }
break; break;
case OPT_GAMMA_VECTOR_G: case OPT_GAMMA_VECTOR_G:
if (!sensor)
throw SaneException("Unsupported scanner mode selected");
table = (SANE_Word *) val; table = (SANE_Word *) val;
gamma_table = get_gamma_table(s->dev, sensor, GENESYS_GREEN); gamma_table = get_gamma_table(s->dev, *sensor, GENESYS_GREEN);
option_size = s->opt[option].size / sizeof (SANE_Word); option_size = s->opt[option].size / sizeof (SANE_Word);
if (gamma_table.size() != option_size) { if (gamma_table.size() != option_size) {
throw std::runtime_error("The size of the gamma tables does not match"); throw std::runtime_error("The size of the gamma tables does not match");
@ -5832,8 +5857,11 @@ get_option_value (Genesys_Scanner * s, int option, void *val)
} }
break; break;
case OPT_GAMMA_VECTOR_B: case OPT_GAMMA_VECTOR_B:
if (!sensor)
throw SaneException("Unsupported scanner mode selected");
table = (SANE_Word *) val; table = (SANE_Word *) val;
gamma_table = get_gamma_table(s->dev, sensor, GENESYS_BLUE); gamma_table = get_gamma_table(s->dev, *sensor, GENESYS_BLUE);
option_size = s->opt[option].size / sizeof (SANE_Word); option_size = s->opt[option].size / sizeof (SANE_Word);
if (gamma_table.size() != option_size) { if (gamma_table.size() != option_size) {
throw std::runtime_error("The size of the gamma tables does not match"); throw std::runtime_error("The size of the gamma tables does not match");
@ -5855,12 +5883,15 @@ get_option_value (Genesys_Scanner * s, int option, void *val)
*(SANE_Bool *) val = s->buttons[genesys_option_to_button(option)].read(); *(SANE_Bool *) val = s->buttons[genesys_option_to_button(option)].read();
break; break;
case OPT_NEED_CALIBRATION_SW: case OPT_NEED_CALIBRATION_SW:
if (!sensor)
throw SaneException("Unsupported scanner mode selected");
/* scanner needs calibration for current mode unless a matching /* scanner needs calibration for current mode unless a matching
* calibration cache is found */ * calibration cache is found */
*(SANE_Bool *) val = SANE_TRUE; *(SANE_Bool *) val = SANE_TRUE;
for (auto& cache : s->dev->calibration_cache) for (auto& cache : s->dev->calibration_cache)
{ {
if (s->dev->cmd_set->is_compatible_calibration(s->dev, sensor, &cache, SANE_FALSE)) { if (s->dev->cmd_set->is_compatible_calibration(s->dev, *sensor, &cache, SANE_FALSE)) {
*(SANE_Bool *) val = SANE_FALSE; *(SANE_Bool *) val = SANE_FALSE;
} }
} }

Wyświetl plik

@ -99,6 +99,9 @@ struct Genesys_Model
// possible depths in color mode // possible depths in color mode
std::vector<unsigned> bpp_color_values; std::vector<unsigned> bpp_color_values;
// the default scanning method. This is used when moving the head for example
ScanMethod default_method = ScanMethod::FLATBED;
// All offsets below are with respect to the sensor home position // All offsets below are with respect to the sensor home position
// Start of scan area in mm // Start of scan area in mm

Wyświetl plik

@ -1503,7 +1503,7 @@ static void gl124_feed(Genesys_Device* dev, unsigned int steps, int reverse)
local_reg = dev->reg; local_reg = dev->reg;
resolution=sanei_genesys_get_lowest_ydpi(dev); resolution=sanei_genesys_get_lowest_ydpi(dev);
const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, dev->model->default_method);
ScanSession session; ScanSession session;
session.params.xres = resolution; session.params.xres = resolution;
@ -1637,7 +1637,9 @@ static void gl124_search_start_position(Genesys_Device* dev)
/* update regs to copy ASIC internal state */ /* update regs to copy ASIC internal state */
dev->reg = local_reg; dev->reg = local_reg;
for (auto& sensor_update : sanei_genesys_find_sensors_all_for_write(dev, ScanMethod::FLATBED)) { for (auto& sensor_update :
sanei_genesys_find_sensors_all_for_write(dev, dev->model->default_method))
{
sanei_genesys_search_reference_point(dev, sensor_update, data.data(), 0, dpi, pixels, sanei_genesys_search_reference_point(dev, sensor_update, data.data(), 0, dpi, pixels,
dev->model->search_lines); dev->model->search_lines);
} }

Wyświetl plik

@ -1812,8 +1812,8 @@ static void gl646_slow_back_home(Genesys_Device* dev, SANE_Bool wait_until_home)
throw SaneException(SANE_STATUS_DEVICE_BUSY, "motor is still on: device busy"); throw SaneException(SANE_STATUS_DEVICE_BUSY, "motor is still on: device busy");
} }
/* setup for a backward scan of 65535 steps, with no actual data reading */ // setup for a backward scan of 65535 steps, with no actual data reading
settings.scan_method = ScanMethod::FLATBED; settings.scan_method = dev->model->default_method;
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
settings.xres = get_lowest_resolution(dev->model->ccd_type, 1); settings.xres = get_lowest_resolution(dev->model->ccd_type, 1);
settings.yres = settings.xres; settings.yres = settings.xres;
@ -1829,7 +1829,8 @@ static void gl646_slow_back_home(Genesys_Device* dev, SANE_Bool wait_until_home)
settings.threshold = 0; settings.threshold = 0;
settings.dynamic_lineart = SANE_FALSE; settings.dynamic_lineart = SANE_FALSE;
const auto& sensor = sanei_genesys_find_sensor(dev, settings.xres, 3, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, settings.xres, 3,
dev->model->default_method);
setup_for_scan(dev, sensor, &dev->reg, settings, SANE_TRUE, SANE_TRUE, SANE_TRUE); setup_for_scan(dev, sensor, &dev->reg, settings, SANE_TRUE, SANE_TRUE, SANE_TRUE);
@ -1903,10 +1904,11 @@ static void gl646_search_start_position(Genesys_Device* dev)
// FIXME: the current approach of doing search only for one resolution does not work on scanners // FIXME: the current approach of doing search only for one resolution does not work on scanners
// whith employ different sensors with potentially different settings. // whith employ different sensors with potentially different settings.
const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 1, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 1,
dev->model->default_method);
/* fill settings for a gray level scan */ /* fill settings for a gray level scan */
settings.scan_method = ScanMethod::FLATBED; settings.scan_method = dev->model->default_method;
settings.scan_mode = ScanColorMode::GRAY; settings.scan_mode = ScanColorMode::GRAY;
settings.xres = resolution; settings.xres = resolution;
settings.yres = resolution; settings.yres = resolution;
@ -1950,7 +1952,9 @@ static void gl646_search_start_position(Genesys_Device* dev)
} }
// now search reference points on the data // now search reference points on the data
for (auto& sensor_update : sanei_genesys_find_sensors_all_for_write(dev, ScanMethod::FLATBED)) { for (auto& sensor_update :
sanei_genesys_find_sensors_all_for_write(dev, dev->model->default_method))
{
sanei_genesys_search_reference_point(dev, sensor_update, data.data(), 0, sanei_genesys_search_reference_point(dev, sensor_update, data.data(), 0,
resolution, settings.pixels, settings.lines); resolution, settings.pixels, settings.lines);
} }
@ -2267,7 +2271,7 @@ static SensorExposure gl646_led_calibration(Genesys_Device* dev, const Genesys_S
resolution = get_closest_resolution(dev->model->ccd_type, sensor.optical_res, channels); resolution = get_closest_resolution(dev->model->ccd_type, sensor.optical_res, channels);
/* offset calibration is always done in color mode */ /* offset calibration is always done in color mode */
settings.scan_method = ScanMethod::FLATBED; settings.scan_method = dev->model->default_method;
settings.xres = resolution; settings.xres = resolution;
settings.yres = resolution; settings.yres = resolution;
settings.tl_x = 0; settings.tl_x = 0;
@ -2436,7 +2440,7 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
black_pixels = (calib_sensor.black_pixels * resolution) / calib_sensor.optical_res; black_pixels = (calib_sensor.black_pixels * resolution) / calib_sensor.optical_res;
DBG(DBG_io2, "%s: black_pixels=%d\n", __func__, black_pixels); DBG(DBG_io2, "%s: black_pixels=%d\n", __func__, black_pixels);
settings.scan_method = ScanMethod::FLATBED; settings.scan_method = dev->model->default_method;
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
settings.xres = resolution; settings.xres = resolution;
settings.yres = resolution; settings.yres = resolution;
@ -2546,7 +2550,7 @@ static void gl646_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
DBG(DBG_io2, "%s: black_pixels=%d\n", __func__, black_pixels); DBG(DBG_io2, "%s: black_pixels=%d\n", __func__, black_pixels);
settings.scan_method = ScanMethod::FLATBED; settings.scan_method = dev->model->default_method;
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
settings.xres = resolution; settings.xres = resolution;
settings.yres = resolution; settings.yres = resolution;
@ -2677,7 +2681,7 @@ static void ad_fe_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
settings.scan_method = ScanMethod::FLATBED; settings.scan_method = dev->model->default_method;
settings.xres = resolution; settings.xres = resolution;
settings.yres = resolution; settings.yres = resolution;
settings.tl_x = 0; settings.tl_x = 0;
@ -2933,7 +2937,7 @@ static void gl646_init_regs_for_warmup(Genesys_Device* dev, const Genesys_Sensor
dev->settings.scan_method); dev->settings.scan_method);
/* set up for a half width 2 lines gray scan without moving */ /* set up for a half width 2 lines gray scan without moving */
settings.scan_method = ScanMethod::FLATBED; settings.scan_method = dev->model->default_method;
settings.scan_mode = ScanColorMode::GRAY; settings.scan_mode = ScanColorMode::GRAY;
settings.xres = resolution; settings.xres = resolution;
settings.yres = resolution; settings.yres = resolution;
@ -2986,7 +2990,7 @@ static void gl646_repark_head(Genesys_Device* dev)
Genesys_Settings settings; Genesys_Settings settings;
unsigned int expected, steps; unsigned int expected, steps;
settings.scan_method = ScanMethod::FLATBED; settings.scan_method = dev->model->default_method;
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
settings.xres = get_closest_resolution(dev->model->ccd_type, 75, 1); settings.xres = get_closest_resolution(dev->model->ccd_type, 75, 1);
settings.yres = settings.xres; settings.yres = settings.xres;
@ -3002,7 +3006,8 @@ static void gl646_repark_head(Genesys_Device* dev)
settings.threshold = 0; settings.threshold = 0;
settings.dynamic_lineart = SANE_FALSE; settings.dynamic_lineart = SANE_FALSE;
const auto& sensor = sanei_genesys_find_sensor(dev, settings.xres, 3, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, settings.xres, 3,
dev->model->default_method);
setup_for_scan(dev, sensor, &dev->reg, settings, SANE_FALSE, SANE_FALSE, SANE_FALSE); setup_for_scan(dev, sensor, &dev->reg, settings, SANE_FALSE, SANE_FALSE, SANE_FALSE);
@ -3387,10 +3392,10 @@ static void simple_move(Genesys_Device* dev, SANE_Int distance)
int resolution = get_lowest_resolution(dev->model->ccd_type, 3); int resolution = get_lowest_resolution(dev->model->ccd_type, 3);
const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, dev->model->default_method);
/* TODO give a no AGOHOME flag */ /* TODO give a no AGOHOME flag */
settings.scan_method = ScanMethod::TRANSPARENCY; settings.scan_method = dev->model->default_method;
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
settings.xres = resolution; settings.xres = resolution;
settings.yres = resolution; settings.yres = resolution;
@ -3687,7 +3692,7 @@ static void gl646_search_strip(Genesys_Device* dev, const Genesys_Sensor& sensor
const auto& calib_sensor = sanei_genesys_find_sensor(dev, res, 1, ScanMethod::FLATBED); const auto& calib_sensor = sanei_genesys_find_sensor(dev, res, 1, ScanMethod::FLATBED);
/* we set up for a lowest available resolution color grey scan, full width */ /* we set up for a lowest available resolution color grey scan, full width */
settings.scan_method = ScanMethod::FLATBED; settings.scan_method = dev->model->default_method;
settings.scan_mode = ScanColorMode::GRAY; settings.scan_mode = ScanColorMode::GRAY;
settings.xres = res; settings.xres = res;
settings.yres = res; settings.yres = res;

Wyświetl plik

@ -2692,7 +2692,7 @@ static void gl841_search_start_position(Genesys_Device* dev)
// FIXME: the current approach of doing search only for one resolution does not work on scanners // FIXME: the current approach of doing search only for one resolution does not work on scanners
// whith employ different sensors with potentially different settings. // whith employ different sensors with potentially different settings.
const auto& sensor = sanei_genesys_find_sensor(dev, dpi, 1, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, dpi, 1, dev->model->default_method);
ScanSession session; ScanSession session;
session.params.xres = dpi; session.params.xres = dpi;
@ -2741,7 +2741,9 @@ static void gl841_search_start_position(Genesys_Device* dev)
/* update regs to copy ASIC internal state */ /* update regs to copy ASIC internal state */
dev->reg = local_reg; dev->reg = local_reg;
for (auto& sensor_update : sanei_genesys_find_sensors_all_for_write(dev, ScanMethod::FLATBED)) { for (auto& sensor_update :
sanei_genesys_find_sensors_all_for_write(dev, dev->model->default_method))
{
sanei_genesys_search_reference_point(dev, sensor_update, data.data(), 0, dpi, pixels, sanei_genesys_search_reference_point(dev, sensor_update, data.data(), 0, dpi, pixels,
dev->model->search_lines); dev->model->search_lines);
} }

Wyświetl plik

@ -2009,7 +2009,7 @@ static void gl843_slow_back_home(Genesys_Device* dev, SANE_Bool wait_until_home)
local_reg = dev->reg; local_reg = dev->reg;
resolution=sanei_genesys_get_lowest_ydpi(dev); resolution=sanei_genesys_get_lowest_ydpi(dev);
const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 1, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 1, dev->model->default_method);
ScanSession session; ScanSession session;
session.params.xres = resolution; session.params.xres = resolution;
@ -2104,7 +2104,7 @@ static void gl843_search_start_position(Genesys_Device* dev)
// FIXME: the current approach of doing search only for one resolution does not work on scanners // FIXME: the current approach of doing search only for one resolution does not work on scanners
// whith employ different sensors with potentially different settings. // whith employ different sensors with potentially different settings.
const auto& sensor = sanei_genesys_find_sensor(dev, dpi, 1, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, dpi, 1, dev->model->default_method);
ScanSession session; ScanSession session;
session.params.xres = dpi; session.params.xres = dpi;
@ -2155,7 +2155,9 @@ static void gl843_search_start_position(Genesys_Device* dev)
/* update regs to copy ASIC internal state */ /* update regs to copy ASIC internal state */
dev->reg = local_reg; dev->reg = local_reg;
for (auto& sensor_update : sanei_genesys_find_sensors_all_for_write(dev, ScanMethod::FLATBED)) { for (auto& sensor_update :
sanei_genesys_find_sensors_all_for_write(dev, dev->model->default_method))
{
sanei_genesys_search_reference_point(dev, sensor_update, data.data(), 0, dpi, pixels, sanei_genesys_search_reference_point(dev, sensor_update, data.data(), 0, dpi, pixels,
dev->model->search_lines); dev->model->search_lines);
} }
@ -2221,7 +2223,7 @@ static void gl843_feed(Genesys_Device* dev, unsigned int steps)
resolution=sanei_genesys_get_lowest_ydpi(dev); resolution=sanei_genesys_get_lowest_ydpi(dev);
const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, dev->model->default_method);
ScanSession session; ScanSession session;
session.params.xres = resolution; session.params.xres = resolution;

Wyświetl plik

@ -1280,7 +1280,7 @@ static void gl846_search_start_position(Genesys_Device* dev)
// FIXME: the current approach of doing search only for one resolution does not work on scanners // FIXME: the current approach of doing search only for one resolution does not work on scanners
// whith employ different sensors with potentially different settings. // whith employ different sensors with potentially different settings.
const auto& sensor = sanei_genesys_find_sensor(dev, dpi, 1, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, dpi, 1, dev->model->default_method);
ScanSession session; ScanSession session;
session.params.xres = dpi; session.params.xres = dpi;
@ -1330,7 +1330,9 @@ static void gl846_search_start_position(Genesys_Device* dev)
// TODO: find out where sanei_genesys_search_reference_point stores information, // TODO: find out where sanei_genesys_search_reference_point stores information,
// and use that correctly // and use that correctly
for (auto& sensor_update : sanei_genesys_find_sensors_all_for_write(dev, ScanMethod::FLATBED)) { for (auto& sensor_update :
sanei_genesys_find_sensors_all_for_write(dev, dev->model->default_method))
{
sanei_genesys_search_reference_point(dev, sensor_update, data.data(), 0, dpi, pixels, sanei_genesys_search_reference_point(dev, sensor_update, data.data(), 0, dpi, pixels,
dev->model->search_lines); dev->model->search_lines);
} }
@ -1386,7 +1388,7 @@ static void gl846_feed(Genesys_Device* dev, unsigned int steps)
local_reg = dev->reg; local_reg = dev->reg;
resolution=sanei_genesys_get_lowest_ydpi(dev); resolution=sanei_genesys_get_lowest_ydpi(dev);
const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, dev->model->default_method);
ScanSession session; ScanSession session;
session.params.xres = resolution; session.params.xres = resolution;

Wyświetl plik

@ -1331,7 +1331,7 @@ static void gl847_search_start_position(Genesys_Device* dev)
// FIXME: the current approach of doing search only for one resolution does not work on scanners // FIXME: the current approach of doing search only for one resolution does not work on scanners
// whith employ different sensors with potentially different settings. // whith employ different sensors with potentially different settings.
const auto& sensor = sanei_genesys_find_sensor(dev, dpi, 1, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, dpi, 1, dev->model->default_method);
ScanSession session; ScanSession session;
session.params.xres = dpi; session.params.xres = dpi;
@ -1381,7 +1381,9 @@ static void gl847_search_start_position(Genesys_Device* dev)
// TODO: find out where sanei_genesys_search_reference_point stores information, // TODO: find out where sanei_genesys_search_reference_point stores information,
// and use that correctly // and use that correctly
for (auto& sensor_update : sanei_genesys_find_sensors_all_for_write(dev, ScanMethod::FLATBED)) { for (auto& sensor_update :
sanei_genesys_find_sensors_all_for_write(dev, dev->model->default_method))
{
sanei_genesys_search_reference_point(dev, sensor_update, data.data(), 0, dpi, pixels, sanei_genesys_search_reference_point(dev, sensor_update, data.data(), 0, dpi, pixels,
dev->model->search_lines); dev->model->search_lines);
} }
@ -1436,7 +1438,7 @@ static void gl847_feed(Genesys_Device* dev, unsigned int steps)
local_reg = dev->reg; local_reg = dev->reg;
resolution=sanei_genesys_get_lowest_ydpi(dev); resolution=sanei_genesys_get_lowest_ydpi(dev);
const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, ScanMethod::FLATBED); const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, dev->model->default_method);
ScanSession session; ScanSession session;
session.params.xres = resolution; session.params.xres = resolution;

Wyświetl plik

@ -428,6 +428,8 @@ extern void sanei_genesys_init_structs (Genesys_Device * dev);
const Genesys_Sensor& sanei_genesys_find_sensor_any(Genesys_Device* dev); const Genesys_Sensor& sanei_genesys_find_sensor_any(Genesys_Device* dev);
const Genesys_Sensor& sanei_genesys_find_sensor(Genesys_Device* dev, int dpi, unsigned channels, const Genesys_Sensor& sanei_genesys_find_sensor(Genesys_Device* dev, int dpi, unsigned channels,
ScanMethod scan_method); ScanMethod scan_method);
bool sanei_genesys_has_sensor(Genesys_Device* dev, unsigned dpi, unsigned channels,
ScanMethod scan_method);
Genesys_Sensor& sanei_genesys_find_sensor_for_write(Genesys_Device* dev, int dpi, unsigned channels, Genesys_Sensor& sanei_genesys_find_sensor_for_write(Genesys_Device* dev, int dpi, unsigned channels,
ScanMethod scan_method); ScanMethod scan_method);