diff --git a/backend/genesys/device.cpp b/backend/genesys/device.cpp index 88dd5dd08..6eee06ef7 100644 --- a/backend/genesys/device.cpp +++ b/backend/genesys/device.cpp @@ -239,7 +239,6 @@ std::ostream& operator<<(std::ostream& out, const Genesys_Device& dev) << static_cast(dev.control[4]) << ' ' << static_cast(dev.control[5]) << '\n' << std::dec << " average_size: " << dev.average_size << '\n' - << " calib_total_bytes_to_read: " << dev.calib_total_bytes_to_read << '\n' << " calib_session: " << format_indent_braced_list(4, dev.calib_session) << '\n' << " gamma_override_tables[0].size(): " << dev.gamma_override_tables[0].size() << '\n' << " gamma_override_tables[1].size(): " << dev.gamma_override_tables[1].size() << '\n' diff --git a/backend/genesys/device.h b/backend/genesys/device.h index 53fbd0476..04b53727f 100644 --- a/backend/genesys/device.h +++ b/backend/genesys/device.h @@ -269,8 +269,6 @@ struct Genesys_Device std::uint8_t control[6] = {}; size_t average_size = 0; - // bytes to read from USB when calibrating. If 0, this is not set - size_t calib_total_bytes_to_read = 0; // the session that was configured for calibration ScanSession calib_session; diff --git a/backend/genesys/genesys.cpp b/backend/genesys/genesys.cpp index 6574f72b1..632412e58 100644 --- a/backend/genesys/genesys.cpp +++ b/backend/genesys/genesys.cpp @@ -1690,11 +1690,9 @@ static void genesys_shading_calibration_impl(Genesys_Device* dev, const Genesys_ } // FIXME: the current calculation is likely incorrect on non-GL843 implementations, - // but this needs checking - if (dev->calib_total_bytes_to_read > 0) { - size = dev->calib_total_bytes_to_read; - } else if (dev->model->asic_type == AsicType::GL843) { - size = channels * 2 * pixels_per_line * dev->calib_session.params.lines; + // but this needs checking. Note the extra line when computing size. + if (dev->model->asic_type == AsicType::GL843) { + size = dev->calib_session.output_total_bytes_raw; } else { size = channels * 2 * pixels_per_line * (dev->calib_session.params.lines + 1); } @@ -1941,8 +1939,8 @@ static void genesys_dark_white_shading_calibration(Genesys_Device* dev, dev->dark_average_data.clear(); dev->dark_average_data.resize(dev->average_size); - if (dev->calib_total_bytes_to_read > 0) { - size = dev->calib_total_bytes_to_read; + if (dev->model->asic_type == AsicType::GL843) { + size = dev->calib_session.output_total_bytes_raw; } else { size = channels * 2 * pixels_per_line * dev->calib_session.params.lines; } diff --git a/backend/genesys/gl124.cpp b/backend/genesys/gl124.cpp index 5b8d79ff6..994fe952c 100644 --- a/backend/genesys/gl124.cpp +++ b/backend/genesys/gl124.cpp @@ -1194,7 +1194,6 @@ void CommandSetGl124::init_regs_for_shading(Genesys_Device* dev, const Genesys_S const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, channels, dev->settings.scan_method); - dev->calib_total_bytes_to_read = 0; factor = calib_sensor.optical_res / resolution; /* distance to move to reach white target at high resolution */ diff --git a/backend/genesys/gl843.cpp b/backend/genesys/gl843.cpp index 3e5cbcd11..0b546af6f 100644 --- a/backend/genesys/gl843.cpp +++ b/backend/genesys/gl843.cpp @@ -1770,7 +1770,6 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S init_regs_for_scan_session(dev, calib_sensor, ®s, session); dev->calib_session = session; - dev->calib_total_bytes_to_read = session.output_total_bytes_raw; } /** @brief set up registers for the actual scan diff --git a/backend/genesys/gl846.cpp b/backend/genesys/gl846.cpp index 49a10ae5e..7d10fe35f 100644 --- a/backend/genesys/gl846.cpp +++ b/backend/genesys/gl846.cpp @@ -963,7 +963,6 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, channels, dev->settings.scan_method); - dev->calib_total_bytes_to_read = 0; unsigned calib_lines = dev->model->shading_lines; if (resolution == 4800) { calib_lines *= 2; diff --git a/backend/genesys/gl847.cpp b/backend/genesys/gl847.cpp index 21e7ea4f7..c972a7ac9 100644 --- a/backend/genesys/gl847.cpp +++ b/backend/genesys/gl847.cpp @@ -972,7 +972,6 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, channels, dev->settings.scan_method); - dev->calib_total_bytes_to_read = 0; unsigned calib_lines = dev->model->shading_lines; if (resolution == 4800) { calib_lines *= 2;