summaryrefslogtreecommitdiff
path: root/backend/genesys
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-02-12 17:35:53 +0100
committerJörg Frings-Fürst <debian@jff.email>2023-02-12 17:35:53 +0100
commit84357741a6a6e6430f199b2c3f7498e0e97da9ad (patch)
tree23e8d66ede9506b94c76fb36910ca3c7dd15c74e /backend/genesys
parent302276dc1b90cfc972fb726ca94a23b18f4b0088 (diff)
New upstream version 1.2.1upstream/1.2.1
Diffstat (limited to 'backend/genesys')
-rw-r--r--backend/genesys/fwd.h2
-rw-r--r--backend/genesys/genesys.cpp226
-rw-r--r--backend/genesys/genesys.h8
-rw-r--r--backend/genesys/gl124.cpp37
-rw-r--r--backend/genesys/gl124.h4
-rw-r--r--backend/genesys/gl646.cpp68
-rw-r--r--backend/genesys/gl646.h4
-rw-r--r--backend/genesys/gl841.cpp119
-rw-r--r--backend/genesys/gl841.h4
-rw-r--r--backend/genesys/gl842.cpp21
-rw-r--r--backend/genesys/gl842.h4
-rw-r--r--backend/genesys/gl843.cpp51
-rw-r--r--backend/genesys/gl843.h4
-rw-r--r--backend/genesys/gl846.cpp32
-rw-r--r--backend/genesys/gl846.h4
-rw-r--r--backend/genesys/gl847.cpp77
-rw-r--r--backend/genesys/gl847.h4
-rw-r--r--backend/genesys/image.h2
-rw-r--r--backend/genesys/image_pipeline.cpp2
-rw-r--r--backend/genesys/image_pixel.h2
-rw-r--r--backend/genesys/low.cpp110
-rw-r--r--backend/genesys/low.h37
-rw-r--r--backend/genesys/scanner_interface_usb.cpp6
-rw-r--r--backend/genesys/serialize.cpp0
-rw-r--r--backend/genesys/serialize.h2
-rw-r--r--backend/genesys/tables_model.cpp11
-rw-r--r--backend/genesys/test_scanner_interface.cpp4
27 files changed, 492 insertions, 353 deletions
diff --git a/backend/genesys/fwd.h b/backend/genesys/fwd.h
index 9937654..5d341b8 100644
--- a/backend/genesys/fwd.h
+++ b/backend/genesys/fwd.h
@@ -59,7 +59,7 @@ struct Pixel;
struct RawPixel;
// low.h
-struct UsbDeviceEntry;
+class UsbDeviceEntry;
// motor.h
struct Genesys_Motor;
diff --git a/backend/genesys/genesys.cpp b/backend/genesys/genesys.cpp
index 5aba58c..ab1367e 100644
--- a/backend/genesys/genesys.cpp
+++ b/backend/genesys/genesys.cpp
@@ -310,9 +310,8 @@ void sanei_genesys_init_structs (Genesys_Device * dev)
* @param gamma gamma to compute values
* @return a gamma table filled with the computed values
* */
-void
-sanei_genesys_create_gamma_table (std::vector<uint16_t>& gamma_table, int size,
- float maximum, float gamma_max, float gamma)
+void sanei_genesys_create_gamma_table(std::vector<std::uint16_t>& gamma_table, int size,
+ float maximum, float gamma_max, float gamma)
{
gamma_table.clear();
gamma_table.resize(size, 0);
@@ -334,7 +333,7 @@ sanei_genesys_create_gamma_table (std::vector<uint16_t>& gamma_table, int size,
}
void sanei_genesys_create_default_gamma_table(Genesys_Device* dev,
- std::vector<uint16_t>& gamma_table, float gamma)
+ std::vector<std::uint16_t>& gamma_table, float gamma)
{
int size = 0;
int max = 0;
@@ -346,6 +345,7 @@ void sanei_genesys_create_default_gamma_table(Genesys_Device* dev,
}
max = size - 1;
} else if (dev->model->asic_type == AsicType::GL124 ||
+ dev->model->asic_type == AsicType::GL845 ||
dev->model->asic_type == AsicType::GL846 ||
dev->model->asic_type == AsicType::GL847) {
size = 257;
@@ -396,7 +396,7 @@ SANE_Int sanei_genesys_exposure_time2(Genesys_Device * dev, const MotorProfile&
The data needs to be of size "size", and in little endian byte order.
*/
static void genesys_send_offset_and_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
- uint8_t* data, int size)
+ std::uint8_t* data, int size)
{
DBG_HELPER_ARGS(dbg, "(size = %d)", size);
int start_address;
@@ -427,10 +427,10 @@ void sanei_genesys_init_shading_data(Genesys_Device* dev, const Genesys_Sensor&
unsigned channels = dev->settings.get_channels();
- // 16 bit black, 16 bit white
- std::vector<uint8_t> shading_data(pixels_per_line * 4 * channels, 0);
+ // 16 bit black, 16 bit white
+ std::vector<std::uint8_t> shading_data(pixels_per_line * 4 * channels, 0);
- uint8_t* shading_data_ptr = shading_data.data();
+ std::uint8_t* shading_data_ptr = shading_data.data();
for (unsigned i = 0; i < pixels_per_line * channels; i++) {
*shading_data_ptr++ = 0x00; /* dark lo */
@@ -487,7 +487,7 @@ void scanner_clear_scan_and_feed_counts(Genesys_Device& dev)
}
void scanner_send_slope_table(Genesys_Device* dev, const Genesys_Sensor& sensor, unsigned table_nr,
- const std::vector<uint16_t>& slope_table)
+ const std::vector<std::uint16_t>& slope_table)
{
DBG_HELPER_ARGS(dbg, "table_nr = %d, steps = %zu", table_nr, slope_table.size());
@@ -515,7 +515,7 @@ void scanner_send_slope_table(Genesys_Device* dev, const Genesys_Sensor& sensor,
throw SaneException("invalid table number %d", table_nr);
}
- std::vector<uint8_t> table;
+ std::vector<std::uint8_t> table;
table.reserve(slope_table.size() * 2);
for (std::size_t i = 0; i < slope_table.size(); i++) {
table.push_back(slope_table[i] & 0xff);
@@ -1868,7 +1868,7 @@ void scanner_coarse_gain_calibration(Genesys_Device& dev, const Genesys_Sensor&
dev.model->asic_type == AsicType::GL842 ||
dev.model->asic_type == AsicType::GL843)
{
- std::vector<uint16_t> values;
+ std::vector<std::uint16_t> values;
// FIXME: start from the second line because the first line often has artifacts. Probably
// caused by unclean cleanup of previous scan
for (std::size_t x = pixels / 4; x < (pixels * 3 / 4); x++) {
@@ -2178,12 +2178,12 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor
}
void sanei_genesys_calculate_zmod(bool two_table,
- uint32_t exposure_time,
- const std::vector<uint16_t>& slope_table,
+ std::uint32_t exposure_time,
+ const std::vector<std::uint16_t>& slope_table,
unsigned acceleration_steps,
unsigned move_steps,
unsigned buffer_acceleration_steps,
- uint32_t* out_z1, uint32_t* out_z2)
+ std::uint32_t* out_z1, std::uint32_t* out_z2)
{
// acceleration total time
unsigned sum = std::accumulate(slope_table.begin(), slope_table.begin() + acceleration_steps,
@@ -2233,7 +2233,7 @@ static void genesys_shading_calibration_impl(Genesys_Device* dev, const Genesys_
debug_dump(DBG_info, dev->calib_session);
size_t size;
- uint32_t pixels_per_line;
+ std::uint32_t pixels_per_line;
if (dev->model->asic_type == AsicType::GL842 ||
dev->model->asic_type == AsicType::GL843 ||
@@ -2274,7 +2274,7 @@ static void genesys_shading_calibration_impl(Genesys_Device* dev, const Genesys_
size = channels * 2 * pixels_per_line * (dev->calib_session.params.lines + 1);
}
- std::vector<uint16_t> calibration_data(size / 2);
+ std::vector<std::uint16_t> calibration_data(size / 2);
// turn off motor and lamp power for flatbed scanners, but not for sheetfed scanners
// because they have a calibration sheet with a sufficient black strip
@@ -2353,8 +2353,8 @@ static void genesys_shading_calibration_impl(Genesys_Device* dev, const Genesys_
static void genesys_dark_shading_by_dummy_pixel(Genesys_Device* dev, const Genesys_Sensor& sensor)
{
DBG_HELPER(dbg);
- uint32_t pixels_per_line;
- uint32_t skip, xend;
+ std::uint32_t pixels_per_line;
+ std::uint32_t skip, xend;
int dummy1, dummy2, dummy3; /* dummy black average per channel */
if (dev->model->asic_type == AsicType::GL842 ||
@@ -2578,11 +2578,9 @@ static void genesys_dark_white_shading_calibration(Genesys_Device* dev,
dev->interface->write_registers(local_reg);
}
- size_t size;
- uint32_t pixels_per_line;
+ std::size_t size;
+ std::uint32_t pixels_per_line;
unsigned int x;
- uint32_t dark, white, dark_sum, white_sum, dark_count, white_count, col,
- dif;
if (dev->model->asic_type == AsicType::GL842 ||
dev->model->asic_type == AsicType::GL843)
@@ -2618,7 +2616,7 @@ static void genesys_dark_white_shading_calibration(Genesys_Device* dev,
size = channels * 2 * pixels_per_line * dev->calib_session.params.lines;
}
- std::vector<uint8_t> calibration_data(size);
+ std::vector<std::uint8_t> calibration_data(size);
// turn on motor and lamp power
sanei_genesys_set_lamp_power(dev, sensor, local_reg, true);
@@ -2656,19 +2654,17 @@ static void genesys_dark_white_shading_calibration(Genesys_Device* dev,
std::fill(dev->white_average_data.begin(),
dev->white_average_data.begin() + start_offset * channels, 0);
- uint16_t* average_white = dev->white_average_data.data() +
- start_offset * channels;
- uint16_t* average_dark = dev->dark_average_data.data() +
- start_offset * channels;
+ std::uint16_t* average_white = dev->white_average_data.data() + start_offset * channels;
+ std::uint16_t* average_dark = dev->dark_average_data.data() + start_offset * channels;
for (x = 0; x < pixels_per_line * channels; x++)
{
- dark = 0xffff;
- white = 0;
+ std::uint32_t dark = 0xffff;
+ std::uint32_t white = 0;
for (std::size_t y = 0; y < dev->calib_session.params.lines; y++)
{
- col = calibration_data[(x + y * pixels_per_line * channels) * 2];
+ std::uint32_t col = calibration_data[(x + y * pixels_per_line * channels) * 2];
col |=
calibration_data[(x + y * pixels_per_line * channels) * 2 +
1] << 8;
@@ -2679,20 +2675,20 @@ static void genesys_dark_white_shading_calibration(Genesys_Device* dev,
dark = col;
}
- dif = white - dark;
+ std::uint32_t dif = white - dark;
dark = dark + dif / 8;
white = white - dif / 8;
- dark_count = 0;
- dark_sum = 0;
+ std::uint32_t dark_count = 0;
+ std::uint32_t dark_sum = 0;
- white_count = 0;
- white_sum = 0;
+ std::uint32_t white_count = 0;
+ std::uint32_t white_sum = 0;
for (std::size_t y = 0; y < dev->calib_session.params.lines; y++)
{
- col = calibration_data[(x + y * pixels_per_line * channels) * 2];
+ std::uint32_t col = calibration_data[(x + y * pixels_per_line * channels) * 2];
col |=
calibration_data[(x + y * pixels_per_line * channels) * 2 +
1] << 8;
@@ -2780,9 +2776,8 @@ compute_coefficient (unsigned int coeff, unsigned int target, unsigned int value
* @param target_bright value of the white target code
* @param target_dark value of the black target code
*/
-static void
-compute_averaged_planar (Genesys_Device * dev, const Genesys_Sensor& sensor,
- uint8_t * shading_data,
+static void compute_averaged_planar(Genesys_Device * dev, const Genesys_Sensor& sensor,
+ std::uint8_t* shading_data,
unsigned int pixels_per_line,
unsigned int words_per_color,
unsigned int channels,
@@ -2852,7 +2847,8 @@ compute_averaged_planar (Genesys_Device * dev, const Genesys_Sensor& sensor,
avgpixels = 15;
/* LiDE80 packs shading data */
- if (dev->model->sensor_id != SensorId::CIS_CANON_LIDE_80) {
+ if (dev->model->sensor_id != SensorId::CIS_CANON_LIDE_80)
+ {
factor=1;
fill=avgpixels;
}
@@ -2961,7 +2957,7 @@ static std::array<unsigned, 3> color_order_to_cmat(ColorOrder color_order)
* @param target value of the target code
*/
static void compute_coefficients(Genesys_Device * dev,
- uint8_t * shading_data,
+ std::uint8_t* shading_data,
unsigned int pixels_per_line,
unsigned int channels,
ColorOrder color_order,
@@ -2969,7 +2965,6 @@ static void compute_coefficients(Genesys_Device * dev,
unsigned int coeff,
unsigned int target)
{
- uint8_t *ptr; /* contain 16bit words in little endian */
unsigned int x, c;
unsigned int val, br, dk;
unsigned int start, end;
@@ -2995,7 +2990,8 @@ static void compute_coefficients(Genesys_Device * dev,
for (x = start; x < end; x++)
{
/* TODO if channels=1 , use filter to know the base addr */
- ptr = shading_data + 4 * ((x + offset) * channels + cmat[c]);
+ // contain 16bit words in little endian
+ std::uint8_t* ptr = shading_data + 4 * ((x + offset) * channels + cmat[c]);
// dark data
dk = dev->dark_average_data[x * channels + c];
@@ -3033,7 +3029,7 @@ static void compute_coefficients(Genesys_Device * dev,
* @param target white target value
*/
static void compute_planar_coefficients(Genesys_Device * dev,
- uint8_t * shading_data,
+ std::uint8_t* shading_data,
unsigned int factor,
unsigned int pixels_per_line,
unsigned int words_per_color,
@@ -3043,22 +3039,20 @@ static void compute_planar_coefficients(Genesys_Device * dev,
unsigned int coeff,
unsigned int target)
{
- uint8_t *ptr; /* contains 16bit words in little endian */
- uint32_t x, c, i;
- uint32_t val, dk, br;
+ std::uint32_t i;
+ std::uint32_t val, dk, br;
auto cmat = color_order_to_cmat(color_order);
DBG(DBG_io, "%s: factor=%d, pixels_per_line=%d, words=0x%X, coeff=0x%04x\n", __func__, factor,
pixels_per_line, words_per_color, coeff);
- for (c = 0; c < channels; c++)
- {
+ for (unsigned c = 0; c < channels; c++) {
/* shading data is larger than pixels_per_line so offset can be neglected */
- for (x = 0; x < pixels_per_line; x+=factor)
- {
+ for (unsigned x = 0; x < pixels_per_line; x += factor) {
/* x2 because of 16 bit values, and x2 since one coeff for dark
* and another for white */
- ptr = shading_data + words_per_color * cmat[c] * 2 + (x + offset) * 4;
+ // contains 16bit words in little endian
+ std::uint8_t* ptr = shading_data + words_per_color * cmat[c] * 2 + (x + offset) * 4;
dk = 0;
br = 0;
@@ -3074,9 +3068,8 @@ static void compute_planar_coefficients(Genesys_Device * dev,
val = compute_coefficient (coeff, target, br - dk);
- /* we duplicate the information to have calibration data at optical resolution */
- for (i = 0; i < factor; i++)
- {
+ // we duplicate the information to have calibration data at optical resolution
+ for (unsigned i = 0; i < factor; i++) {
ptr[0 + 4 * i] = dk & 255;
ptr[1 + 4 * i] = dk / 256;
ptr[2 + 4 * i] = val & 0xff;
@@ -3097,10 +3090,9 @@ static void compute_planar_coefficients(Genesys_Device * dev,
}
}
-static void
-compute_shifted_coefficients (Genesys_Device * dev,
- const Genesys_Sensor& sensor,
- uint8_t * shading_data,
+static void compute_shifted_coefficients(Genesys_Device * dev,
+ const Genesys_Sensor& sensor,
+ std::uint8_t* shading_data,
unsigned int pixels_per_line,
unsigned int channels,
ColorOrder color_order,
@@ -3112,7 +3104,7 @@ compute_shifted_coefficients (Genesys_Device * dev,
{
unsigned int x, avgpixels, basepixels, i, j, val1, val2;
unsigned int br_tmp [3], dk_tmp [3];
- uint8_t *ptr = shading_data + offset * 3 * 4; /* contain 16bit words in little endian */
+ std::uint8_t* ptr = shading_data + offset * 3 * 4; // contain 16bit words in little endian
unsigned int patch_cnt = offset * 3; /* at start, offset of first patch */
auto cmat = color_order_to_cmat(color_order);
@@ -3198,7 +3190,7 @@ static void genesys_send_shading_coefficient(Genesys_Device* dev, const Genesys_
return;
}
- uint32_t pixels_per_line;
+ std::uint32_t pixels_per_line;
int o;
unsigned int length; /**> number of shading calibration data words */
unsigned int factor;
@@ -3255,8 +3247,8 @@ static void genesys_send_shading_coefficient(Genesys_Device* dev, const Genesys_
length = words_per_color * 3 * 2;
/* allocate computed size */
- // contains 16bit words in little endian
- std::vector<uint8_t> shading_data(length, 0);
+ // contains 16bit words in little endian
+ std::vector<std::uint8_t> shading_data(length, 0);
if (!dev->calib_session.computed) {
genesys_send_offset_and_shading(dev, sensor, shading_data.data(), length);
@@ -3584,7 +3576,7 @@ static void genesys_save_calibration(Genesys_Device* dev, const Genesys_Sensor&
static void genesys_flatbed_calibration(Genesys_Device* dev, Genesys_Sensor& sensor)
{
DBG_HELPER(dbg);
- uint32_t pixels_per_line;
+ std::uint32_t pixels_per_line;
unsigned coarse_res = sensor.full_resolution;
if (dev->settings.yres <= sensor.full_resolution / 2) {
@@ -3857,8 +3849,8 @@ static void genesys_warmup_lamp(Genesys_Device* dev)
auto channels = dev->session.params.channels;
auto lines = dev->session.output_line_count;
- std::vector<uint8_t> first_line(total_size);
- std::vector<uint8_t> second_line(total_size);
+ std::vector<std::uint8_t> first_line(total_size);
+ std::vector<std::uint8_t> second_line(total_size);
do {
first_line = second_line;
@@ -4892,28 +4884,76 @@ static void init_options(Genesys_Scanner* s)
s->opt[OPT_POWER_SW].cap = SANE_CAP_INACTIVE;
/* extra button */
- s->opt[OPT_EXTRA_SW].name = "extra";
- s->opt[OPT_EXTRA_SW].title = SANE_I18N("Extra button");
- s->opt[OPT_EXTRA_SW].desc = SANE_I18N("Extra button");
- s->opt[OPT_EXTRA_SW].type = SANE_TYPE_BOOL;
- s->opt[OPT_EXTRA_SW].unit = SANE_UNIT_NONE;
- if (model->buttons & GENESYS_HAS_EXTRA_SW) {
- s->opt[OPT_EXTRA_SW].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
- } else {
- s->opt[OPT_EXTRA_SW].cap = SANE_CAP_INACTIVE;
- }
-
- // transparency/scan_film button
- s->opt[OPT_TRANSP_SW].name = "transparency";
- s->opt[OPT_TRANSP_SW].title = SANE_I18N ("Transparency button");
- s->opt[OPT_TRANSP_SW].desc = SANE_I18N ("Transparency button");
- s->opt[OPT_TRANSP_SW].type = SANE_TYPE_BOOL;
- s->opt[OPT_TRANSP_SW].unit = SANE_UNIT_NONE;
- if (model->buttons & GENESYS_HAS_TRANSP_SW) {
- s->opt[OPT_TRANSP_SW].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
- } else {
- s->opt[OPT_TRANSP_SW].cap = SANE_CAP_INACTIVE;
- }
+ s->opt[OPT_EXTRA_SW].name = "extra";
+ s->opt[OPT_EXTRA_SW].title = SANE_I18N("Extra button");
+ s->opt[OPT_EXTRA_SW].desc = SANE_I18N("Extra button");
+ s->opt[OPT_EXTRA_SW].type = SANE_TYPE_BOOL;
+ s->opt[OPT_EXTRA_SW].unit = SANE_UNIT_NONE;
+ if (model->buttons & GENESYS_HAS_EXTRA_SW)
+ s->opt[OPT_EXTRA_SW].cap =
+ SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
+ else
+ s->opt[OPT_EXTRA_SW].cap = SANE_CAP_INACTIVE;
+
+ /* transparency/scan_film button */
+ s->opt[OPT_TRANSP_SW].name = "transparency";
+ s->opt[OPT_TRANSP_SW].title = SANE_I18N ("Transparency button");
+ s->opt[OPT_TRANSP_SW].desc = SANE_I18N ("Transparency button");
+ s->opt[OPT_TRANSP_SW].type = SANE_TYPE_BOOL;
+ s->opt[OPT_TRANSP_SW].unit = SANE_UNIT_NONE;
+ if (model->buttons & GENESYS_HAS_TRANSP_SW)
+ s->opt[OPT_TRANSP_SW].cap =
+ SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
+ else
+ s->opt[OPT_TRANSP_SW].cap = SANE_CAP_INACTIVE;
+
+ /* PDF special function button 1 */
+ s->opt[OPT_PDF1_SW].name = "pdf1";
+ s->opt[OPT_PDF1_SW].title = SANE_I18N ("PDF function button 1");
+ s->opt[OPT_PDF1_SW].desc = SANE_I18N ("PDF function button 1");
+ s->opt[OPT_PDF1_SW].type = SANE_TYPE_BOOL;
+ s->opt[OPT_PDF1_SW].unit = SANE_UNIT_NONE;
+ if (model->buttons & GENESYS_HAS_PDF1_SW)
+ s->opt[OPT_PDF1_SW].cap =
+ SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
+ else
+ s->opt[OPT_PDF1_SW].cap = SANE_CAP_INACTIVE;
+
+ /* PDF special function button 2 */
+ s->opt[OPT_PDF2_SW].name = "pdf2";
+ s->opt[OPT_PDF2_SW].title = SANE_I18N ("PDF function button 2");
+ s->opt[OPT_PDF2_SW].desc = SANE_I18N ("PDF function button 2");
+ s->opt[OPT_PDF2_SW].type = SANE_TYPE_BOOL;
+ s->opt[OPT_PDF2_SW].unit = SANE_UNIT_NONE;
+ if (model->buttons & GENESYS_HAS_PDF2_SW)
+ s->opt[OPT_PDF2_SW].cap =
+ SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
+ else
+ s->opt[OPT_PDF2_SW].cap = SANE_CAP_INACTIVE;
+
+ /* PDF special function button 3 */
+ s->opt[OPT_PDF3_SW].name = "pdf3";
+ s->opt[OPT_PDF3_SW].title = SANE_I18N ("PDF function button 3");
+ s->opt[OPT_PDF3_SW].desc = SANE_I18N ("PDF function button 3");
+ s->opt[OPT_PDF3_SW].type = SANE_TYPE_BOOL;
+ s->opt[OPT_PDF3_SW].unit = SANE_UNIT_NONE;
+ if (model->buttons & GENESYS_HAS_PDF3_SW)
+ s->opt[OPT_PDF3_SW].cap =
+ SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
+ else
+ s->opt[OPT_PDF3_SW].cap = SANE_CAP_INACTIVE;
+
+ /* PDF special function button 4 */
+ s->opt[OPT_PDF4_SW].name = "pdf4";
+ s->opt[OPT_PDF4_SW].title = SANE_I18N ("PDF function button 4");
+ s->opt[OPT_PDF4_SW].desc = SANE_I18N ("PDF function button 4");
+ s->opt[OPT_PDF4_SW].type = SANE_TYPE_BOOL;
+ s->opt[OPT_PDF4_SW].unit = SANE_UNIT_NONE;
+ if (model->buttons & GENESYS_HAS_PDF4_SW)
+ s->opt[OPT_PDF4_SW].cap =
+ SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
+ else
+ s->opt[OPT_PDF4_SW].cap = SANE_CAP_INACTIVE;
/* calibration needed */
s->opt[OPT_NEED_CALIBRATION_SW].name = "need-calibration";
@@ -5588,7 +5628,7 @@ static void get_option_value(Genesys_Scanner* s, int option, void* val)
auto* dev = s->dev;
unsigned int i;
SANE_Word* table = nullptr;
- std::vector<uint16_t> gamma_table;
+ std::vector<std::uint16_t> gamma_table;
unsigned option_size = 0;
const Genesys_Sensor* sensor = nullptr;
@@ -5734,6 +5774,10 @@ static void get_option_value(Genesys_Scanner* s, int option, void* val)
case OPT_POWER_SW:
case OPT_EXTRA_SW:
case OPT_TRANSP_SW:
+ case OPT_PDF1_SW:
+ case OPT_PDF2_SW:
+ case OPT_PDF3_SW:
+ case OPT_PDF4_SW:
s->dev->cmd_set->update_hardware_sensors(s);
*reinterpret_cast<SANE_Bool*>(val) = s->buttons[genesys_option_to_button(option)].read();
break;
@@ -6370,6 +6414,10 @@ GenesysButtonName genesys_option_to_button(int option)
case OPT_POWER_SW: return BUTTON_POWER_SW;
case OPT_EXTRA_SW: return BUTTON_EXTRA_SW;
case OPT_TRANSP_SW: return BUTTON_TRANSP_SW;
+ case OPT_PDF1_SW: return BUTTON_PDF1_SW;
+ case OPT_PDF2_SW: return BUTTON_PDF2_SW;
+ case OPT_PDF3_SW: return BUTTON_PDF3_SW;
+ case OPT_PDF4_SW: return BUTTON_PDF4_SW;
default: throw std::runtime_error("Unknown option to convert to button index");
}
}
diff --git a/backend/genesys/genesys.h b/backend/genesys/genesys.h
index 272beaa..65b66e7 100644
--- a/backend/genesys/genesys.h
+++ b/backend/genesys/genesys.h
@@ -104,6 +104,10 @@ enum Genesys_Option
OPT_POWER_SW,
OPT_EXTRA_SW,
OPT_TRANSP_SW,
+ OPT_PDF1_SW,
+ OPT_PDF2_SW,
+ OPT_PDF3_SW,
+ OPT_PDF4_SW,
OPT_NEED_CALIBRATION_SW,
OPT_BUTTON_GROUP,
OPT_CALIBRATE,
@@ -125,6 +129,10 @@ enum GenesysButtonName : unsigned {
BUTTON_POWER_SW,
BUTTON_EXTRA_SW,
BUTTON_TRANSP_SW,
+ BUTTON_PDF1_SW,
+ BUTTON_PDF2_SW,
+ BUTTON_PDF3_SW,
+ BUTTON_PDF4_SW,
NUM_BUTTONS
};
diff --git a/backend/genesys/gl124.cpp b/backend/genesys/gl124.cpp
index 1fa4d99..af193a3 100644
--- a/backend/genesys/gl124.cpp
+++ b/backend/genesys/gl124.cpp
@@ -355,7 +355,7 @@ gl124_init_registers (Genesys_Device * dev)
* @param dev device owning the AFE
* @param set flag AFE_INIT to specify the AFE must be reset before writing data
* */
-static void gl124_set_ti_fe(Genesys_Device* dev, uint8_t set)
+static void gl124_set_ti_fe(Genesys_Device* dev, std::uint8_t set)
{
DBG_HELPER(dbg);
int i;
@@ -367,9 +367,8 @@ static void gl124_set_ti_fe(Genesys_Device* dev, uint8_t set)
// start writing to DAC
dev->interface->write_fe_register(0x00, 0x80);
- /* write values to analog frontend */
- for (uint16_t addr = 0x01; addr < 0x04; addr++)
- {
+ // write values to analog frontend
+ for (std::uint16_t addr = 0x01; addr < 0x04; addr++) {
dev->interface->write_fe_register(addr, dev->frontend.regs.get_value(addr));
}
@@ -392,13 +391,14 @@ static void gl124_set_ti_fe(Genesys_Device* dev, uint8_t set)
// Set values of analog frontend
-void CommandSetGl124::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
+void CommandSetGl124::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
+ std::uint8_t set) const
{
DBG_HELPER_ARGS(dbg, "%s", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
set == AFE_POWER_SAVE ? "powersave" : "huh?");
(void) sensor;
- uint8_t val;
+ std::uint8_t val;
if (set == AFE_INIT) {
dev->frontend = dev->frontend_initial;
@@ -434,7 +434,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
DBG_HELPER(dbg);
unsigned int lincnt, fast_dpi;
unsigned int feedl,dist;
- uint32_t z1, z2;
+ std::uint32_t z1, z2;
unsigned yres;
unsigned min_speed;
unsigned int linesel;
@@ -489,7 +489,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
reg->set24(REG_LINCNT, lincnt);
/* compute register 02 value */
- uint8_t r02 = REG_0x02_NOTHOME;
+ std::uint8_t r02 = REG_0x02_NOTHOME;
if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) {
r02 |= REG_0x02_AGOHOME;
@@ -578,7 +578,6 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
const ScanSession& session)
{
DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time);
- uint32_t expmax;
scanner_setup_sensor(*dev, sensor, *reg);
@@ -659,7 +658,7 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
reg->find_reg(REG_0x60).value &= ~REG_0x60_LEDADD;
if (session.enable_ledadd) {
reg->find_reg(REG_0x60).value |= REG_0x60_LEDADD;
- expmax = reg->get24(REG_EXPR);
+ std::uint32_t expmax = reg->get24(REG_EXPR);
expmax = std::max(expmax, reg->get24(REG_EXPG));
expmax = std::max(expmax, reg->get24(REG_EXPB));
@@ -745,7 +744,7 @@ void CommandSetGl124::init_regs_for_scan_session(Genesys_Device* dev, const Gene
dev->session = session;
dev->total_bytes_read = 0;
- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
+ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines;
DBG(DBG_info, "%s: total bytes to send to frontend = %zu\n", __func__,
dev->total_bytes_to_read);
@@ -826,7 +825,7 @@ void gl124_setup_scan_gpio(Genesys_Device* dev, int resolution)
{
DBG_HELPER(dbg);
- uint8_t val = dev->interface->read_register(REG_0x32);
+ std::uint8_t val = dev->interface->read_register(REG_0x32);
/* LiDE 110, 210 and 220 cases */
if(dev->model->gpio_id != GpioId::CANON_LIDE_120) {
@@ -883,7 +882,7 @@ void CommandSetGl124::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens
scanner_clear_scan_and_feed_counts(*dev);
// enable scan and motor
- uint8_t val = dev->interface->read_register(REG_0x01);
+ std::uint8_t val = dev->interface->read_register(REG_0x01);
val |= REG_0x01_SCAN;
dev->interface->write_register(REG_0x01, val);
@@ -974,7 +973,7 @@ void CommandSetGl124::wait_for_motor_stop(Genesys_Device* dev) const
DBG_HELPER(dbg);
auto status = scanner_read_status(*dev);
- uint8_t val40 = dev->interface->read_register(REG_0x100);
+ std::uint8_t val40 = dev->interface->read_register(REG_0x100);
if (!status.is_motor_enabled && (val40 & REG_0x100_MOTMFLG) == 0) {
return;
@@ -997,7 +996,7 @@ void CommandSetGl124::send_shading_data(Genesys_Device* dev, const Genesys_Senso
{
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
std::uint32_t addr, length, segcnt, pixels, i;
- uint8_t *ptr, *src;
+ std::uint8_t *ptr, *src;
/* logical size of a color as seen by generic code of the frontend */
length = size / 3;
@@ -1020,7 +1019,7 @@ void CommandSetGl124::send_shading_data(Genesys_Device* dev, const Genesys_Senso
std::to_string(dev->session.segment_count));
DBG( DBG_io2, "%s: using chunks of %d bytes (%d shading data pixels)\n",__func__,length, length/4);
- std::vector<uint8_t> buffer(pixels * dev->session.segment_count, 0);
+ std::vector<std::uint8_t> buffer(pixels * dev->session.segment_count, 0);
/* write actual red data */
for(i=0;i<3;i++)
@@ -1047,7 +1046,7 @@ void CommandSetGl124::send_shading_data(Genesys_Device* dev, const Genesys_Senso
/* next shading coefficient */
ptr+=4;
}
- uint8_t val = dev->interface->read_register(0xd0+i);
+ std::uint8_t val = dev->interface->read_register(0xd0+i);
addr = val * 8192 + 0x10000000;
dev->interface->write_ahb(addr, pixels * dev->session.segment_count, buffer.data());
}
@@ -1254,7 +1253,7 @@ void CommandSetGl124::asic_boot(Genesys_Device* dev, bool cold) const
dev->interface->write_register(0x36, 0x01);
// set GPIO 17
- uint8_t val = dev->interface->read_register(0x33);
+ std::uint8_t val = dev->interface->read_register(0x33);
val |= 0x01;
dev->interface->write_register(0x33, val);
@@ -1297,7 +1296,7 @@ void CommandSetGl124::update_hardware_sensors(Genesys_Scanner* s) const
any of them.
*/
DBG_HELPER(dbg);
- uint8_t val = s->dev->interface->read_register(REG_0x31);
+ std::uint8_t val = s->dev->interface->read_register(REG_0x31);
/* TODO : for the next scanner special case,
* add another per scanner button profile struct to avoid growing
diff --git a/backend/genesys/gl124.h b/backend/genesys/gl124.h
index 02b733b..2b98b1b 100644
--- a/backend/genesys/gl124.h
+++ b/backend/genesys/gl124.h
@@ -46,7 +46,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
- void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
+ void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@@ -80,7 +80,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
- void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
+ void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
ScanSession calculate_scan_session(const Genesys_Device* dev,
diff --git a/backend/genesys/gl646.cpp b/backend/genesys/gl646.cpp
index bdde703..ac6c617 100644
--- a/backend/genesys/gl646.cpp
+++ b/backend/genesys/gl646.cpp
@@ -43,11 +43,12 @@ constexpr unsigned CALIBRATION_LINES = 10;
static void write_control(Genesys_Device* dev, const Genesys_Sensor& sensor, int resolution);
-static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set, int dpi);
+static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set,
+ int dpi);
static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
const ScanSession& session, bool move,
- std::vector<uint8_t>& data, const char* test_identifier);
+ std::vector<std::uint8_t>& data, const char* test_identifier);
/**
* Send the stop scan command
* */
@@ -374,7 +375,7 @@ static Motor_Master motor_master[] = {
/**
* reads value from gpio endpoint
*/
-static void gl646_gpio_read(IUsbDevice& usb_dev, uint8_t* value)
+static void gl646_gpio_read(IUsbDevice& usb_dev, std::uint8_t* value)
{
DBG_HELPER(dbg);
usb_dev.control_msg(REQUEST_TYPE_IN, REQUEST_REGISTER, GPIO_READ, INDEX, 1, value);
@@ -383,7 +384,7 @@ static void gl646_gpio_read(IUsbDevice& usb_dev, uint8_t* value)
/**
* writes the given value to gpio endpoint
*/
-static void gl646_gpio_write(IUsbDevice& usb_dev, uint8_t value)
+static void gl646_gpio_write(IUsbDevice& usb_dev, std::uint8_t value)
{
DBG_HELPER_ARGS(dbg, "(0x%02x)", value);
usb_dev.control_msg(REQUEST_TYPE_OUT, REQUEST_REGISTER, GPIO_WRITE, INDEX, 1, &value);
@@ -392,7 +393,7 @@ static void gl646_gpio_write(IUsbDevice& usb_dev, uint8_t value)
/**
* writes the given value to gpio output enable endpoint
*/
-static void gl646_gpio_output_enable(IUsbDevice& usb_dev, uint8_t value)
+static void gl646_gpio_output_enable(IUsbDevice& usb_dev, std::uint8_t value)
{
DBG_HELPER_ARGS(dbg, "(0x%02x)", value);
usb_dev.control_msg(REQUEST_TYPE_OUT, REQUEST_REGISTER, GPIO_OUTPUT_ENABLE, INDEX, 1, &value);
@@ -440,10 +441,10 @@ void CommandSetGl646::init_regs_for_scan_session(Genesys_Device* dev, const Gene
debug_dump(DBG_info, sensor);
- uint32_t move = session.params.starty;
+ std::uint32_t move = session.params.starty;
Motor_Master *motor = nullptr;
- uint32_t z1, z2;
+ std::uint32_t z1, z2;
int feedl;
@@ -817,7 +818,8 @@ void CommandSetGl646::init_regs_for_scan_session(Genesys_Device* dev, const Gene
dev->session = session;
dev->total_bytes_read = 0;
- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
+ dev->total_bytes_to_read = (size_t) session.output_line_bytes_requested
+ * (size_t) session.params.lines;
/* select color filter based on settings */
regs->find_reg(0x04).value &= ~REG_0x04_FILTER;
@@ -1023,7 +1025,7 @@ gl646_init_regs (Genesys_Device * dev)
}
// Set values of Analog Device type frontend
-static void gl646_set_ad_fe(Genesys_Device* dev, uint8_t set)
+static void gl646_set_ad_fe(Genesys_Device* dev, std::uint8_t set)
{
DBG_HELPER(dbg);
int i;
@@ -1058,7 +1060,7 @@ static void gl646_set_ad_fe(Genesys_Device* dev, uint8_t set)
* @param set action from AFE_SET, AFE_INIT and AFE_POWERSAVE
* @param dpi resolution of the scan since it affects settings
*/
-static void gl646_wm_hp3670(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set,
+static void gl646_wm_hp3670(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set,
unsigned dpi)
{
DBG_HELPER(dbg);
@@ -1108,16 +1110,17 @@ static void gl646_wm_hp3670(Genesys_Device* dev, const Genesys_Sensor& sensor, u
* @param set action to execute
* @param dpi dpi to setup the AFE
*/
-static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set, int dpi)
+static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set,
+ int dpi)
{
DBG_HELPER_ARGS(dbg, "%s,%d", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
set == AFE_POWER_SAVE ? "powersave" : "huh?", dpi);
int i;
- uint8_t val;
+ std::uint8_t val;
/* Analog Device type frontend */
- uint8_t frontend_type = dev->reg.find_reg(0x04).value & REG_0x04_FESET;
+ std::uint8_t frontend_type = dev->reg.find_reg(0x04).value & REG_0x04_FESET;
if (frontend_type == 0x02) {
gl646_set_ad_fe(dev, set);
return;
@@ -1203,7 +1206,8 @@ static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint
* @param dev device to set
* @param set action to execute
*/
-void CommandSetGl646::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
+void CommandSetGl646::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
+ std::uint8_t set) const
{
gl646_set_fe(dev, sensor, set, dev->settings.yres);
}
@@ -1854,10 +1858,7 @@ void CommandSetGl646::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor
bits = 12;
}
- /* allocate temporary gamma tables: 16 bits words, 3 channels */
- std::vector<uint8_t> gamma(size * 2 * 3);
-
- sanei_genesys_generate_gamma_buffer(dev, sensor, bits, size-1, size, gamma.data());
+ auto gamma = generate_gamma_buffer(dev, sensor, bits, size-1, size);
/* table address */
switch (dev->reg.find_reg(0x05).value >> 6)
@@ -1892,7 +1893,7 @@ SensorExposure CommandSetGl646::led_calibration(Genesys_Device* dev, const Genes
int val;
int avg[3], avga, avge;
int turn;
- uint16_t expr, expg, expb;
+ std::uint16_t expr, expg, expb;
unsigned channels = dev->settings.get_channels();
@@ -1927,7 +1928,7 @@ SensorExposure CommandSetGl646::led_calibration(Genesys_Device* dev, const Genes
// colors * bytes_per_color * scan lines
unsigned total_size = pixels * channels * 2 * 1;
- std::vector<uint8_t> line(total_size);
+ std::vector<std::uint8_t> line(total_size);
/*
we try to get equal bright leds here:
@@ -2022,13 +2023,12 @@ SensorExposure CommandSetGl646::led_calibration(Genesys_Device* dev, const Genes
/**
* average dark pixels of a scan
*/
-static int
-dark_average (uint8_t * data, unsigned int pixels, unsigned int lines,
- unsigned int channels, unsigned int black)
+static int dark_average(std::uint8_t * data, unsigned int pixels, unsigned int lines,
+ unsigned int channels, unsigned int black)
{
unsigned int i, j, k, average, count;
unsigned int avg[3];
- uint8_t val;
+ std::uint8_t val;
/* computes average value on black margin */
for (k = 0; k < channels; k++)
@@ -2110,7 +2110,7 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
dev->frontend.set_gain(1, 0);
dev->frontend.set_gain(2, 0);
- std::vector<uint8_t> line;
+ std::vector<std::uint8_t> line;
/* scan with no move */
bottom = 1;
@@ -2231,7 +2231,7 @@ void CommandSetGl646::offset_calibration(Genesys_Device* dev, const Genesys_Sens
dev->frontend.set_offset(1, bottom);
dev->frontend.set_offset(2, bottom);
- std::vector<uint8_t> first_line, second_line;
+ std::vector<std::uint8_t> first_line, second_line;
dev->cmd_set->init_regs_for_scan_session(dev, sensor, &dev->reg, session);
simple_scan(dev, calib_sensor, session, false, first_line, "offset_first_line");
@@ -2383,7 +2383,7 @@ void CommandSetGl646::coarse_gain_calibration(Genesys_Device* dev, const Genesys
unsigned pass = 0;
- std::vector<uint8_t> line;
+ std::vector<std::uint8_t> line;
/* loop until each channel raises to acceptable level */
while (((average[0] < calib_sensor.gain_white_ref) ||
@@ -2512,8 +2512,8 @@ void CommandSetGl646::init(Genesys_Device* dev) const
DBG_INIT();
DBG_HELPER(dbg);
- uint8_t val = 0;
- uint32_t addr = 0xdead;
+ std::uint8_t val = 0;
+ std::uint32_t addr = 0xdead;
size_t len;
// to detect real power up condition, we write to REG_0x41 with pwrbit set, then read it back.
@@ -2643,7 +2643,7 @@ void CommandSetGl646::init(Genesys_Device* dev) const
static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
const ScanSession& session, bool move,
- std::vector<uint8_t>& data, const char* scan_identifier)
+ std::vector<std::uint8_t>& data, const char* scan_identifier)
{
unsigned lines = session.output_line_count;
if (!dev->model->is_cis) {
@@ -2695,7 +2695,7 @@ static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
if (dev->model->is_cis && session.params.scan_mode == ScanColorMode::COLOR_SINGLE_PASS) {
auto pixels_count = session.params.pixels;
- std::vector<uint8_t> buffer(pixels_count * 3 * bpp);
+ std::vector<std::uint8_t> buffer(pixels_count * 3 * bpp);
if (bpp == 1) {
for (unsigned y = 0; y < lines; y++) {
@@ -2738,7 +2738,7 @@ void CommandSetGl646::update_hardware_sensors(Genesys_Scanner* session) const
{
DBG_HELPER(dbg);
Genesys_Device *dev = session->dev;
- uint8_t value;
+ std::uint8_t value;
// do what is needed to get a new set of events, but try to not loose any of them.
gl646_gpio_read(dev->interface->get_usb_device(), &value);
@@ -2858,8 +2858,8 @@ void CommandSetGl646::update_home_sensor_gpio(Genesys_Device& dev) const
static void write_control(Genesys_Device* dev, const Genesys_Sensor& sensor, int resolution)
{
DBG_HELPER(dbg);
- uint8_t control[4];
- uint32_t addr = 0xdead;
+ std::uint8_t control[4];
+ std::uint32_t addr = 0xdead;
/* 2300 does not write to 'control' */
if (dev->model->motor_id == MotorId::HP2300) {
diff --git a/backend/genesys/gl646.h b/backend/genesys/gl646.h
index 04e5fb2..5bbcfb2 100644
--- a/backend/genesys/gl646.h
+++ b/backend/genesys/gl646.h
@@ -50,7 +50,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
- void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
+ void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@@ -84,7 +84,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
- void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
+ void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
bool has_send_shading_data() const override
diff --git a/backend/genesys/gl841.cpp b/backend/genesys/gl841.cpp
index 27a6a36..3b068d1 100644
--- a/backend/genesys/gl841.cpp
+++ b/backend/genesys/gl841.cpp
@@ -288,7 +288,7 @@ gl841_init_registers (Genesys_Device * dev)
}
}
-static void gl841_set_lide80_fe(Genesys_Device* dev, uint8_t set)
+static void gl841_set_lide80_fe(Genesys_Device* dev, std::uint8_t set)
{
DBG_HELPER(dbg);
@@ -311,7 +311,7 @@ static void gl841_set_lide80_fe(Genesys_Device* dev, uint8_t set)
}
// Set values of Analog Device type frontend
-static void gl841_set_ad_fe(Genesys_Device* dev, uint8_t set)
+static void gl841_set_ad_fe(Genesys_Device* dev, std::uint8_t set)
{
DBG_HELPER(dbg);
int i;
@@ -361,7 +361,8 @@ static void gl841_set_ad_fe(Genesys_Device* dev, uint8_t set)
}
// Set values of analog frontend
-void CommandSetGl841::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
+void CommandSetGl841::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
+ std::uint8_t set) const
{
DBG_HELPER_ARGS(dbg, "%s", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
@@ -369,7 +370,7 @@ void CommandSetGl841::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
(void) sensor;
/* Analog Device type frontend */
- uint8_t frontend_type = dev->reg.find_reg(0x04).value & REG_0x04_FESET;
+ std::uint8_t frontend_type = dev->reg.find_reg(0x04).value & REG_0x04_FESET;
if (frontend_type == 0x02) {
gl841_set_ad_fe(dev, set);
@@ -453,12 +454,68 @@ static void gl841_write_freq(Genesys_Device* dev, unsigned int ydpi)
{
DBG_HELPER(dbg);
/**< fast table */
-uint8_t tdefault[] = {0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0x36,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xb6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0xf6,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76,0x18,0x76};
-uint8_t t1200[] = {0xc7,0x31,0xc7,0x31,0xc7,0x31,0xc7,0x31,0xc7,0x31,0xc7,0x31,0xc7,0x31,0xc7,0x31,0xc0,0x11,0xc0,0x11,0xc0,0x11,0xc0,0x11,0xc0,0x11,0xc0,0x11,0xc0,0x11,0xc0,0x11,0xc7,0xb1,0xc7,0xb1,0xc7,0xb1,0xc7,0xb1,0xc7,0xb1,0xc7,0xb1,0xc7,0xb1,0xc7,0xb1,0x07,0xe0,0x07,0xe0,0x07,0xe0,0x07,0xe0,0x07,0xe0,0x07,0xe0,0x07,0xe0,0x07,0xe0,0xc7,0xf1,0xc7,0xf1,0xc7,0xf1,0xc7,0xf1,0xc7,0xf1,0xc7,0xf1,0xc7,0xf1,0xc7,0xf1,0xc0,0x51,0xc0,0x51,0xc0,0x51,0xc0,0x51,0xc0,0x51,0xc0,0x51,0xc0,0x51,0xc0,0x51,0xc7,0x71,0xc7,0x71,0xc7,0x71,0xc7,0x71,0xc7,0x71,0xc7,0x71,0xc7,0x71,0xc7,0x71,0x07,0x20,0x07,0x20,0x07,0x20,0x07,0x20,0x07,0x20,0x07,0x20,0x07,0x20,0x07,0x20};
-uint8_t t300[] = {0x08,0x32,0x08,0x32,0x08,0x32,0x08,0x32,0x08,0x32,0x08,0x32,0x08,0x32,0x08,0x32,0x00,0x13,0x00,0x13,0x00,0x13,0x00,0x13,0x00,0x13,0x00,0x13,0x00,0x13,0x00,0x13,0x08,0xb2,0x08,0xb2,0x08,0xb2,0x08,0xb2,0x08,0xb2,0x08,0xb2,0x08,0xb2,0x08,0xb2,0x0c,0xa0,0x0c,0xa0,0x0c,0xa0,0x0c,0xa0,0x0c,0xa0,0x0c,0xa0,0x0c,0xa0,0x0c,0xa0,0x08,0xf2,0x08,0xf2,0x08,0xf2,0x08,0xf2,0x08,0xf2,0x08,0xf2,0x08,0xf2,0x08,0xf2,0x00,0xd3,0x00,0xd3,0x00,0xd3,0x00,0xd3,0x00,0xd3,0x00,0xd3,0x00,0xd3,0x00,0xd3,0x08,0x72,0x08,0x72,0x08,0x72,0x08,0x72,0x08,0x72,0x08,0x72,0x08,0x72,0x08,0x72,0x0c,0x60,0x0c,0x60,0x0c,0x60,0x0c,0x60,0x0c,0x60,0x0c,0x60,0x0c,0x60,0x0c,0x60};
-uint8_t t150[] = {0x0c,0x33,0xcf,0x33,0xcf,0x33,0xcf,0x33,0xcf,0x33,0xcf,0x33,0xcf,0x33,0xcf,0x33,0x40,0x14,0x80,0x15,0x80,0x15,0x80,0x15,0x80,0x15,0x80,0x15,0x80,0x15,0x80,0x15,0x0c,0xb3,0xcf,0xb3,0xcf,0xb3,0xcf,0xb3,0xcf,0xb3,0xcf,0xb3,0xcf,0xb3,0xcf,0xb3,0x11,0xa0,0x16,0xa0,0x16,0xa0,0x16,0xa0,0x16,0xa0,0x16,0xa0,0x16,0xa0,0x16,0xa0,0x0c,0xf3,0xcf,0xf3,0xcf,0xf3,0xcf,0xf3,0xcf,0xf3,0xcf,0xf3,0xcf,0xf3,0xcf,0xf3,0x40,0xd4,0x80,0xd5,0x80,0xd5,0x80,0xd5,0x80,0xd5,0x80,0xd5,0x80,0xd5,0x80,0xd5,0x0c,0x73,0xcf,0x73,0xcf,0x73,0xcf,0x73,0xcf,0x73,0xcf,0x73,0xcf,0x73,0xcf,0x73,0x11,0x60,0x16,0x60,0x16,0x60,0x16,0x60,0x16,0x60,0x16,0x60,0x16,0x60,0x16,0x60};
-
-uint8_t *table;
+ std::uint8_t tdefault[] = {
+ 0x18, 0x36, 0x18, 0x36, 0x18, 0x36, 0x18, 0x36, 0x18, 0x36,
+ 0x18, 0x36, 0x18, 0x36, 0x18, 0x36, 0x18, 0x36, 0x18, 0x36,
+ 0x18, 0x36, 0x18, 0x36, 0x18, 0x36, 0x18, 0x36, 0x18, 0x36,
+ 0x18, 0x36, 0x18, 0xb6, 0x18, 0xb6, 0x18, 0xb6, 0x18, 0xb6,
+ 0x18, 0xb6, 0x18, 0xb6, 0x18, 0xb6, 0x18, 0xb6, 0x18, 0xb6,
+ 0x18, 0xb6, 0x18, 0xb6, 0x18, 0xb6, 0x18, 0xb6, 0x18, 0xb6,
+ 0x18, 0xb6, 0x18, 0xb6, 0x18, 0xf6, 0x18, 0xf6, 0x18, 0xf6,
+ 0x18, 0xf6, 0x18, 0xf6, 0x18, 0xf6, 0x18, 0xf6, 0x18, 0xf6,
+ 0x18, 0xf6, 0x18, 0xf6, 0x18, 0xf6, 0x18, 0xf6, 0x18, 0xf6,
+ 0x18, 0xf6, 0x18, 0xf6, 0x18, 0xf6, 0x18, 0x76, 0x18, 0x76,
+ 0x18, 0x76, 0x18, 0x76, 0x18, 0x76, 0x18, 0x76, 0x18, 0x76,
+ 0x18, 0x76, 0x18, 0x76, 0x18, 0x76, 0x18, 0x76, 0x18, 0x76,
+ 0x18, 0x76, 0x18, 0x76, 0x18, 0x76, 0x18, 0x76
+ };
+ std::uint8_t t1200[] = {
+ 0xc7, 0x31, 0xc7, 0x31, 0xc7, 0x31, 0xc7, 0x31, 0xc7, 0x31,
+ 0xc7, 0x31, 0xc7, 0x31, 0xc7, 0x31, 0xc0, 0x11, 0xc0, 0x11,
+ 0xc0, 0x11, 0xc0, 0x11, 0xc0, 0x11, 0xc0, 0x11, 0xc0, 0x11,
+ 0xc0, 0x11, 0xc7, 0xb1, 0xc7, 0xb1, 0xc7, 0xb1, 0xc7, 0xb1,
+ 0xc7, 0xb1, 0xc7, 0xb1, 0xc7, 0xb1, 0xc7, 0xb1, 0x07, 0xe0,
+ 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0,
+ 0x07, 0xe0, 0x07, 0xe0, 0xc7, 0xf1, 0xc7, 0xf1, 0xc7, 0xf1,
+ 0xc7, 0xf1, 0xc7, 0xf1, 0xc7, 0xf1, 0xc7, 0xf1, 0xc7, 0xf1,
+ 0xc0, 0x51, 0xc0, 0x51, 0xc0, 0x51, 0xc0, 0x51, 0xc0, 0x51,
+ 0xc0, 0x51, 0xc0, 0x51, 0xc0, 0x51, 0xc7, 0x71, 0xc7, 0x71,
+ 0xc7, 0x71, 0xc7, 0x71, 0xc7, 0x71, 0xc7, 0x71, 0xc7, 0x71,
+ 0xc7, 0x71, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20,
+ 0x07, 0x20, 0x07, 0x20, 0x07, 0x20, 0x07, 0x20
+ };
+ std::uint8_t t300[] = {
+ 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x08, 0x32,
+ 0x08, 0x32, 0x08, 0x32, 0x08, 0x32, 0x00, 0x13, 0x00, 0x13,
+ 0x00, 0x13, 0x00, 0x13, 0x00, 0x13, 0x00, 0x13, 0x00, 0x13,
+ 0x00, 0x13, 0x08, 0xb2, 0x08, 0xb2, 0x08, 0xb2, 0x08, 0xb2,
+ 0x08, 0xb2, 0x08, 0xb2, 0x08, 0xb2, 0x08, 0xb2, 0x0c, 0xa0,
+ 0x0c, 0xa0, 0x0c, 0xa0, 0x0c, 0xa0, 0x0c, 0xa0, 0x0c, 0xa0,
+ 0x0c, 0xa0, 0x0c, 0xa0, 0x08, 0xf2, 0x08, 0xf2, 0x08, 0xf2,
+ 0x08, 0xf2, 0x08, 0xf2, 0x08, 0xf2, 0x08, 0xf2, 0x08, 0xf2,
+ 0x00, 0xd3, 0x00, 0xd3, 0x00, 0xd3, 0x00, 0xd3, 0x00, 0xd3,
+ 0x00, 0xd3, 0x00, 0xd3, 0x00, 0xd3, 0x08, 0x72, 0x08, 0x72,
+ 0x08, 0x72, 0x08, 0x72, 0x08, 0x72, 0x08, 0x72, 0x08, 0x72,
+ 0x08, 0x72, 0x0c, 0x60, 0x0c, 0x60, 0x0c, 0x60, 0x0c, 0x60,
+ 0x0c, 0x60, 0x0c, 0x60, 0x0c, 0x60, 0x0c, 0x60
+ };
+ std::uint8_t t150[] = {
+ 0x0c, 0x33, 0xcf, 0x33, 0xcf, 0x33, 0xcf, 0x33, 0xcf, 0x33,
+ 0xcf, 0x33, 0xcf, 0x33, 0xcf, 0x33, 0x40, 0x14, 0x80, 0x15,
+ 0x80, 0x15, 0x80, 0x15, 0x80, 0x15, 0x80, 0x15, 0x80, 0x15,
+ 0x80, 0x15, 0x0c, 0xb3, 0xcf, 0xb3, 0xcf, 0xb3, 0xcf, 0xb3,
+ 0xcf, 0xb3, 0xcf, 0xb3, 0xcf, 0xb3, 0xcf, 0xb3, 0x11, 0xa0,
+ 0x16, 0xa0, 0x16, 0xa0, 0x16, 0xa0, 0x16, 0xa0, 0x16, 0xa0,
+ 0x16, 0xa0, 0x16, 0xa0, 0x0c, 0xf3, 0xcf, 0xf3, 0xcf, 0xf3,
+ 0xcf, 0xf3, 0xcf, 0xf3, 0xcf, 0xf3, 0xcf, 0xf3, 0xcf, 0xf3,
+ 0x40, 0xd4, 0x80, 0xd5, 0x80, 0xd5, 0x80, 0xd5, 0x80, 0xd5,
+ 0x80, 0xd5, 0x80, 0xd5, 0x80, 0xd5, 0x0c, 0x73, 0xcf, 0x73,
+ 0xcf, 0x73, 0xcf, 0x73, 0xcf, 0x73, 0xcf, 0x73, 0xcf, 0x73,
+ 0xcf, 0x73, 0x11, 0x60, 0x16, 0x60, 0x16, 0x60, 0x16, 0x60,
+ 0x16, 0x60, 0x16, 0x60, 0x16, 0x60, 0x16, 0x60
+ };
+
+ std::uint8_t *table;
if(dev->model->motor_id == MotorId::CANON_LIDE_80) {
switch(ydpi)
@@ -495,7 +552,7 @@ static void gl841_init_motor_regs_feed(Genesys_Device* dev, const Genesys_Sensor
/*number of scan lines to add in a scan_lines line*/
{
- std::vector<uint16_t> table;
+ std::vector<std::uint16_t> table;
table.resize(256, 0xffff);
scanner_send_slope_table(dev, sensor, 0, table);
@@ -711,6 +768,7 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
const ScanSession& session)
{
DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time);
+
dev->cmd_set->set_fe(dev, sensor, AFE_SET);
/* gpio part.*/
@@ -920,7 +978,7 @@ dummy \ scanned lines
dev->session = session;
dev->total_bytes_read = 0;
- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
+ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines;
if (session.use_host_side_gray) {
dev->total_bytes_to_read /= 3;
}
@@ -998,7 +1056,7 @@ void CommandSetGl841::save_power(Genesys_Device* dev, bool enable) const
/* final state: GPIO8 disabled, GPIO9 enabled, GPIO17 disabled,
GPIO18 disabled*/
- uint8_t val = dev->interface->read_register(REG_0x6D);
+ std::uint8_t val = dev->interface->read_register(REG_0x6D);
dev->interface->write_register(REG_0x6D, val | 0x80);
dev->interface->sleep_ms(1);
@@ -1023,7 +1081,7 @@ void CommandSetGl841::save_power(Genesys_Device* dev, bool enable) const
}
if (dev->model->gpio_id == GpioId::DP685)
{
- uint8_t val = dev->interface->read_register(REG_0x6B);
+ std::uint8_t val = dev->interface->read_register(REG_0x6B);
dev->interface->write_register(REG_0x6B, val & ~REG_0x6B_GPO17);
dev->reg.find_reg(0x6b).value &= ~REG_0x6B_GPO17;
dev->initial_regs.find_reg(0x6b).value &= ~REG_0x6B_GPO17;
@@ -1041,7 +1099,7 @@ void CommandSetGl841::save_power(Genesys_Device* dev, bool enable) const
/* final state: GPIO8 enabled, GPIO9 disabled, GPIO17 enabled,
GPIO18 enabled*/
- uint8_t val = dev->interface->read_register(REG_0x6D);
+ std::uint8_t val = dev->interface->read_register(REG_0x6D);
dev->interface->write_register(REG_0x6D, val | 0x80);
dev->interface->sleep_ms(10);
@@ -1070,7 +1128,7 @@ void CommandSetGl841::save_power(Genesys_Device* dev, bool enable) const
if (dev->model->gpio_id == GpioId::DP665
|| dev->model->gpio_id == GpioId::DP685)
{
- uint8_t val = dev->interface->read_register(REG_0x6B);
+ std::uint8_t val = dev->interface->read_register(REG_0x6B);
dev->interface->write_register(REG_0x6B, val | REG_0x6B_GPO17);
dev->reg.find_reg(0x6b).value |= REG_0x6B_GPO17;
dev->initial_regs.find_reg(0x6b).value |= REG_0x6B_GPO17;
@@ -1147,7 +1205,7 @@ static bool gl841_get_paper_sensor(Genesys_Device* dev)
{
DBG_HELPER(dbg);
- uint8_t val = dev->interface->read_register(REG_0x6D);
+ std::uint8_t val = dev->interface->read_register(REG_0x6D);
return (val & 0x1) == 0;
}
@@ -1365,7 +1423,7 @@ void CommandSetGl841::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens
(void) sensor;
// FIXME: SEQUENTIAL not really needed in this case
Genesys_Register_Set local_reg(Genesys_Register_Set::SEQUENTIAL);
- uint8_t val;
+ std::uint8_t val;
if (dev->model->gpio_id == GpioId::CANON_LIDE_80) {
val = dev->interface->read_register(REG_0x6B);
@@ -1476,10 +1534,7 @@ void CommandSetGl841::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor
size = 256;
- /* allocate temporary gamma tables: 16 bits words, 3 channels */
- std::vector<uint8_t> gamma(size * 2 * 3);
-
- sanei_genesys_generate_gamma_buffer(dev, sensor, 16, 65535, size, gamma.data());
+ auto gamma = generate_gamma_buffer(dev, sensor, 16, 65535, size);
dev->interface->write_gamma(0x28, 0x0000, gamma.data(), size * 2 * 3);
}
@@ -1549,7 +1604,7 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
// FIXME: we're reading twice as much data for no reason
std::size_t total_size = session.output_line_bytes * 2;
- std::vector<uint8_t> line(total_size);
+ std::vector<std::uint8_t> line(total_size);
dev->frontend.set_gain(0, 0);
dev->frontend.set_gain(1, 0);
@@ -2029,10 +2084,9 @@ void CommandSetGl841::init(Genesys_Device* dev) const
void CommandSetGl841::update_hardware_sensors(Genesys_Scanner* s) const
{
DBG_HELPER(dbg);
- /* do what is needed to get a new set of events, but try to not lose
- any of them.
- */
- uint8_t val;
+
+ // do what is needed to get a new set of events, but try to not lose any of them.
+ std::uint8_t val;
if (s->dev->model->gpio_id == GpioId::CANON_LIDE_35
|| s->dev->model->gpio_id == GpioId::CANON_LIDE_80)
@@ -2060,11 +2114,10 @@ void CommandSetGl841::update_hardware_sensors(Genesys_Scanner* s) const
* for all the channels.
*/
void CommandSetGl841::send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
- uint8_t* data, int size) const
+ std::uint8_t* data, int size) const
{
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
- uint32_t length, x, pixels, i;
- uint8_t *ptr,*src;
+ std::uint32_t length, x, pixels, i;
/* old method if no SHDAREA */
if ((dev->reg.find_reg(0x01).value & REG_0x01_SHDAREA) == 0) {
@@ -2094,7 +2147,7 @@ void CommandSetGl841::send_shading_data(Genesys_Device* dev, const Genesys_Senso
DBG(DBG_io2, "%s: using chunks of %d bytes (%d shading data pixels)\n", __func__, length,
length/4);
- std::vector<uint8_t> buffer(pixels, 0);
+ std::vector<std::uint8_t> buffer(pixels, 0);
/* write actual shading data contigously
* channel by channel, starting at addr 0x0000
@@ -2103,14 +2156,14 @@ void CommandSetGl841::send_shading_data(Genesys_Device* dev, const Genesys_Senso
{
/* copy data to work buffer and process it */
/* coefficient destination */
- ptr=buffer.data();
+ std::uint8_t* ptr = buffer.data();
/* iterate on both sensor segment, data has been averaged,
* so is in the right order and we only have to copy it */
for(x=0;x<pixels;x+=4)
{
/* coefficient source */
- src = data + x + beginpixel + i * length;
+ std::uint8_t* src = data + x + beginpixel + i * length;
ptr[0]=src[0];
ptr[1]=src[1];
ptr[2]=src[2];
diff --git a/backend/genesys/gl841.h b/backend/genesys/gl841.h
index 64b23c8..2bdc3cc 100644
--- a/backend/genesys/gl841.h
+++ b/backend/genesys/gl841.h
@@ -46,7 +46,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
- void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
+ void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@@ -80,7 +80,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
- void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
+ void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
ScanSession calculate_scan_session(const Genesys_Device* dev,
diff --git a/backend/genesys/gl842.cpp b/backend/genesys/gl842.cpp
index a593040..9663799 100644
--- a/backend/genesys/gl842.cpp
+++ b/backend/genesys/gl842.cpp
@@ -223,7 +223,8 @@ static void gl842_init_registers(Genesys_Device& dev)
}
// Set values of analog frontend
-void CommandSetGl842::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
+void CommandSetGl842::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
+ std::uint8_t set) const
{
DBG_HELPER_ARGS(dbg, "%s", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
@@ -236,7 +237,7 @@ void CommandSetGl842::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
// check analog frontend type
// FIXME: looks like we write to that register with initial data
- uint8_t fe_type = dev->interface->read_register(REG_0x04) & REG_0x04_FESET;
+ std::uint8_t fe_type = dev->interface->read_register(REG_0x04) & REG_0x04_FESET;
if (fe_type == 2 || dev->model->model_id == ModelId::CANON_LIDE_90) {
for (const auto& reg : dev->frontend.regs) {
dev->interface->write_fe_register(reg.address, reg.value);
@@ -568,7 +569,7 @@ void CommandSetGl842::init_regs_for_scan_session(Genesys_Device* dev, const Gene
dev->session = session;
dev->total_bytes_read = 0;
- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
+ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines;
}
ScanSession CommandSetGl842::calculate_scan_session(const Genesys_Device* dev,
@@ -841,11 +842,11 @@ void CommandSetGl842::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor
unsigned size = 256;
- std::vector<uint8_t> gamma(size * 2 * 3);
+ std::vector<std::uint8_t> gamma(size * 2 * 3);
- std::vector<uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
- std::vector<uint16_t> ggamma = get_gamma_table(dev, sensor, GENESYS_GREEN);
- std::vector<uint16_t> bgamma = get_gamma_table(dev, sensor, GENESYS_BLUE);
+ std::vector<std::uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
+ std::vector<std::uint16_t> ggamma = get_gamma_table(dev, sensor, GENESYS_GREEN);
+ std::vector<std::uint16_t> bgamma = get_gamma_table(dev, sensor, GENESYS_BLUE);
// copy sensor specific's gamma tables
for (unsigned i = 0; i < size; i++) {
@@ -951,7 +952,7 @@ void CommandSetGl842::asic_boot(Genesys_Device* dev, bool cold) const
dev->interface->write_registers(dev->reg);
if (dev->model->model_id == ModelId::PLUSTEK_OPTICFILM_7200) {
- uint8_t data[32] = {
+ std::uint8_t data[32] = {
0xd0, 0x38, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1006,7 +1007,7 @@ void CommandSetGl842::update_home_sensor_gpio(Genesys_Device& dev) const
* for all the channels.
*/
void CommandSetGl842::send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
- uint8_t* data, int size) const
+ std::uint8_t* data, int size) const
{
DBG_HELPER(dbg);
@@ -1032,7 +1033,7 @@ void CommandSetGl842::send_shading_data(Genesys_Device* dev, const Genesys_Senso
dev->interface->record_key_value("shading_offset", std::to_string(offset));
dev->interface->record_key_value("shading_length", std::to_string(length));
- std::vector<uint8_t> final_data(length, 0);
+ std::vector<std::uint8_t> final_data(length, 0);
unsigned count = 0;
if (offset < 0) {
diff --git a/backend/genesys/gl842.h b/backend/genesys/gl842.h
index 3636bac..7a60819 100644
--- a/backend/genesys/gl842.h
+++ b/backend/genesys/gl842.h
@@ -46,7 +46,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
- void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
+ void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@@ -80,7 +80,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
- void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
+ void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
ScanSession calculate_scan_session(const Genesys_Device* dev,
diff --git a/backend/genesys/gl843.cpp b/backend/genesys/gl843.cpp
index 6180bf9..c2f4b52 100644
--- a/backend/genesys/gl843.cpp
+++ b/backend/genesys/gl843.cpp
@@ -597,7 +597,7 @@ gl843_init_registers (Genesys_Device * dev)
}
if (dev->model->model_id == ModelId::PLUSTEK_OPTICFILM_7200I) {
- uint8_t data[32] = {
+ std::uint8_t data[32] = {
0x8c, 0x8f, 0xc9, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -616,7 +616,8 @@ static void gl843_set_ad_fe(Genesys_Device* dev)
}
// Set values of analog frontend
-void CommandSetGl843::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
+void CommandSetGl843::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
+ std::uint8_t set) const
{
DBG_HELPER_ARGS(dbg, "%s", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
@@ -629,7 +630,7 @@ void CommandSetGl843::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
// check analog frontend type
// FIXME: looks like we write to that register with initial data
- uint8_t fe_type = dev->interface->read_register(REG_0x04) & REG_0x04_FESET;
+ std::uint8_t fe_type = dev->interface->read_register(REG_0x04) & REG_0x04_FESET;
if (fe_type == 2) {
gl843_set_ad_fe(dev);
return;
@@ -1041,7 +1042,7 @@ void CommandSetGl843::init_regs_for_scan_session(Genesys_Device* dev, const Gene
dev->session = session;
dev->total_bytes_read = 0;
- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
+ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines;
DBG(DBG_info, "%s: total bytes to send = %zu\n", __func__, dev->total_bytes_to_read);
}
@@ -1120,7 +1121,7 @@ void CommandSetGl843::save_power(Genesys_Device* dev, bool enable) const
// switch KV-SS080 lamp off
if (dev->model->gpio_id == GpioId::KVSS080) {
- uint8_t val = dev->interface->read_register(REG_0x6C);
+ std::uint8_t val = dev->interface->read_register(REG_0x6C);
if (enable) {
val &= 0xef;
} else {
@@ -1140,7 +1141,7 @@ static bool gl843_get_paper_sensor(Genesys_Device* dev)
{
DBG_HELPER(dbg);
- uint8_t val = dev->interface->read_register(REG_0x6D);
+ std::uint8_t val = dev->interface->read_register(REG_0x6D);
return (val & 0x1) == 0;
}
@@ -1283,7 +1284,7 @@ void CommandSetGl843::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens
scanner_clear_scan_and_feed_counts(*dev);
// enable scan and motor
- uint8_t val = dev->interface->read_register(REG_0x01);
+ std::uint8_t val = dev->interface->read_register(REG_0x01);
val |= REG_0x01_SCAN;
dev->interface->write_register(REG_0x01, val);
@@ -1436,11 +1437,11 @@ void CommandSetGl843::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor
size = 256;
/* allocate temporary gamma tables: 16 bits words, 3 channels */
- std::vector<uint8_t> gamma(size * 2 * 3);
+ std::vector<std::uint8_t> gamma(size * 2 * 3);
- std::vector<uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
- std::vector<uint16_t> ggamma = get_gamma_table(dev, sensor, GENESYS_GREEN);
- std::vector<uint16_t> bgamma = get_gamma_table(dev, sensor, GENESYS_BLUE);
+ std::vector<std::uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
+ std::vector<std::uint16_t> ggamma = get_gamma_table(dev, sensor, GENESYS_GREEN);
+ std::vector<std::uint16_t> bgamma = get_gamma_table(dev, sensor, GENESYS_BLUE);
// copy sensor specific's gamma tables
for (i = 0; i < size; i++) {
@@ -1553,7 +1554,7 @@ static void gl843_init_gpio(Genesys_Device* dev)
void CommandSetGl843::asic_boot(Genesys_Device* dev, bool cold) const
{
DBG_HELPER(dbg);
- uint8_t val;
+ std::uint8_t val;
if (cold) {
dev->interface->write_register(0x0e, 0x01);
@@ -1665,7 +1666,7 @@ void CommandSetGl843::update_hardware_sensors(Genesys_Scanner* s) const
any of them.
*/
- uint8_t val = s->dev->interface->read_register(REG_0x6D);
+ std::uint8_t val = s->dev->interface->read_register(REG_0x6D);
DBG(DBG_io, "%s: read buttons_gpio value=0x%x\n", __func__, (int)val);
switch (s->dev->model->gpio_id)
@@ -1685,8 +1686,21 @@ void CommandSetGl843::update_hardware_sensors(Genesys_Scanner* s) const
s->buttons[BUTTON_TRANSP_SW].write((val & 0x40) == 0);
s->buttons[BUTTON_SCAN_SW].write((val & 0x08) == 0);
break;
- case GpioId::CANON_4400F:
case GpioId::CANON_8400F:
+ s->buttons[BUTTON_COPY_SW].write((val & 0x01) == 0);
+ s->buttons[BUTTON_SCAN_SW].write((val & 0x02) == 0);
+ s->buttons[BUTTON_FILE_SW].write((val & 0x04) == 0);
+ s->buttons[BUTTON_EMAIL_SW].write((val & 0x08) == 0);
+ break;
+ case GpioId::CANON_4400F:
+ s->buttons[BUTTON_COPY_SW].write((val & 0x68) == 0x28);
+ s->buttons[BUTTON_TRANSP_SW].write((val & 0x68) == 0x20);
+ s->buttons[BUTTON_EMAIL_SW].write((val & 0x68) == 0x08);
+ s->buttons[BUTTON_PDF1_SW].write((val & 0x68) == 0x00);
+ s->buttons[BUTTON_PDF2_SW].write((val & 0x68) == 0x60);
+ s->buttons[BUTTON_PDF3_SW].write((val & 0x68) == 0x48);
+ s->buttons[BUTTON_PDF4_SW].write((val & 0x68) == 0x40);
+ break;
default:
break;
}
@@ -1703,11 +1717,10 @@ void CommandSetGl843::update_home_sensor_gpio(Genesys_Device& dev) const
* for all the channels.
*/
void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
- uint8_t* data, int size) const
+ std::uint8_t* data, int size) const
{
DBG_HELPER(dbg);
- uint32_t final_size, i;
- uint8_t *buffer;
+ std::uint32_t final_size, i;
int count;
int offset = 0;
@@ -1735,10 +1748,10 @@ void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Senso
/* compute and allocate size for final data */
final_size = ((length+251) / 252) * 256;
DBG(DBG_io, "%s: final shading size=%04x (length=%d)\n", __func__, final_size, length);
- std::vector<uint8_t> final_data(final_size, 0);
+ std::vector<std::uint8_t> final_data(final_size, 0);
/* copy regular shading data to the expected layout */
- buffer = final_data.data();
+ std::uint8_t* buffer = final_data.data();
count = 0;
if (offset < 0) {
count += (-offset);
diff --git a/backend/genesys/gl843.h b/backend/genesys/gl843.h
index ac845bd..6012c36 100644
--- a/backend/genesys/gl843.h
+++ b/backend/genesys/gl843.h
@@ -46,7 +46,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
- void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
+ void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@@ -80,7 +80,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
- void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
+ void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
ScanSession calculate_scan_session(const Genesys_Device* dev,
diff --git a/backend/genesys/gl846.cpp b/backend/genesys/gl846.cpp
index b427376..6db312a 100644
--- a/backend/genesys/gl846.cpp
+++ b/backend/genesys/gl846.cpp
@@ -284,7 +284,7 @@ gl846_init_registers (Genesys_Device * dev)
/**
* Set register values of Analog Device type frontend
* */
-static void gl846_set_adi_fe(Genesys_Device* dev, uint8_t set)
+static void gl846_set_adi_fe(Genesys_Device* dev, std::uint8_t set)
{
DBG_HELPER(dbg);
int i;
@@ -314,15 +314,16 @@ static void gl846_set_adi_fe(Genesys_Device* dev, uint8_t set)
}
// Set values of analog frontend
-void CommandSetGl846::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
+void CommandSetGl846::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
+ std::uint8_t set) const
{
DBG_HELPER_ARGS(dbg, "%s", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
set == AFE_POWER_SAVE ? "powersave" : "huh?");
(void) sensor;
- /* route to specific analog frontend setup */
- uint8_t frontend_type = dev->reg.find_reg(0x04).value & REG_0x04_FESET;
+ // route to specific analog frontend setup
+ std::uint8_t frontend_type = dev->reg.find_reg(0x04).value & REG_0x04_FESET;
switch (frontend_type) {
case 0x02: /* ADI FE */
gl846_set_adi_fe(dev, set);
@@ -658,7 +659,7 @@ void CommandSetGl846::init_regs_for_scan_session(Genesys_Device* dev, const Gene
dev->session = session;
dev->total_bytes_read = 0;
- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
+ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines;
DBG(DBG_info, "%s: total bytes to send = %zu\n", __func__, dev->total_bytes_to_read);
}
@@ -748,7 +749,6 @@ void CommandSetGl846::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens
{
DBG_HELPER(dbg);
(void) sensor;
- uint8_t val;
if (reg->state.is_xpa_on && reg->state.is_lamp_on) {
dev->cmd_set->set_xpa_lamp_power(*dev, true);
@@ -756,7 +756,7 @@ void CommandSetGl846::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens
scanner_clear_scan_and_feed_counts(*dev);
- val = dev->interface->read_register(REG_0x01);
+ std::uint8_t val = dev->interface->read_register(REG_0x01);
val |= REG_0x01_SCAN;
dev->interface->write_register(REG_0x01, val);
reg->set8(REG_0x01, val);
@@ -862,11 +862,10 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
* for all the channels.
*/
void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
- uint8_t* data, int size) const
+ std::uint8_t* data, int size) const
{
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
std::uint32_t addr, i;
- uint8_t val,*ptr,*src;
unsigned length = static_cast<unsigned>(size / 3);
@@ -884,7 +883,7 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso
dev->interface->record_key_value("shading_length", std::to_string(length));
dev->interface->record_key_value("shading_factor", std::to_string(sensor.shading_factor));
- std::vector<uint8_t> buffer(pixels, 0);
+ std::vector<std::uint8_t> buffer(pixels, 0);
DBG(DBG_io2, "%s: using chunks of %d (0x%04x) bytes\n", __func__, pixels, pixels);
@@ -896,12 +895,12 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso
{
/* build up actual shading data by copying the part from the full width one
* to the one corresponding to SHDAREA */
- ptr = buffer.data();
+ std::uint8_t* ptr = buffer.data();
/* iterate on both sensor segment */
for (unsigned x = 0; x < pixels; x += 4 * sensor.shading_factor) {
// coefficient source
- src = (data + offset + i * length) + x;
+ std::uint8_t* src = (data + offset + i * length) + x;
/* coefficient copy */
ptr[0]=src[0];
@@ -913,7 +912,7 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso
ptr+=4;
}
- val = dev->interface->read_register(0xd0+i);
+ std::uint8_t val = dev->interface->read_register(0xd0+i);
addr = val * 8192 + 0x10000000;
dev->interface->write_ahb(addr, pixels, buffer.data());
}
@@ -961,7 +960,7 @@ static void gl846_init_memory_layout(Genesys_Device* dev)
void CommandSetGl846::asic_boot(Genesys_Device* dev, bool cold) const
{
DBG_HELPER(dbg);
- uint8_t val;
+ std::uint8_t val;
// reset ASIC if cold boot
if (cold) {
@@ -1036,8 +1035,7 @@ void CommandSetGl846::update_hardware_sensors(Genesys_Scanner* s) const
/* do what is needed to get a new set of events, but try to not lose
any of them.
*/
- uint8_t val;
- uint8_t scan, file, email, copy;
+ std::uint8_t scan, file, email, copy;
switch(s->dev->model->gpio_id)
{
default:
@@ -1046,7 +1044,7 @@ void CommandSetGl846::update_hardware_sensors(Genesys_Scanner* s) const
email=0x04;
copy=0x08;
}
- val = s->dev->interface->read_register(REG_0x6D);
+ std::uint8_t val = s->dev->interface->read_register(REG_0x6D);
s->buttons[BUTTON_SCAN_SW].write((val & scan) == 0);
s->buttons[BUTTON_FILE_SW].write((val & file) == 0);
diff --git a/backend/genesys/gl846.h b/backend/genesys/gl846.h
index f1d396d..c0acec4 100644
--- a/backend/genesys/gl846.h
+++ b/backend/genesys/gl846.h
@@ -46,7 +46,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
- void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
+ void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@@ -80,7 +80,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
- void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
+ void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
ScanSession calculate_scan_session(const Genesys_Device* dev,
diff --git a/backend/genesys/gl847.cpp b/backend/genesys/gl847.cpp
index 13f9dd9..14d1fd0 100644
--- a/backend/genesys/gl847.cpp
+++ b/backend/genesys/gl847.cpp
@@ -51,7 +51,7 @@ gl847_init_registers (Genesys_Device * dev)
{
DBG_HELPER(dbg);
int lide700=0;
- uint8_t val;
+ std::uint8_t val;
/* 700F class needs some different initial settings */
if (dev->model->model_id == ModelId::CANON_LIDE_700F) {
@@ -233,7 +233,8 @@ gl847_init_registers (Genesys_Device * dev)
}
// Set values of analog frontend
-void CommandSetGl847::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const
+void CommandSetGl847::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
+ std::uint8_t set) const
{
DBG_HELPER_ARGS(dbg, "%s", set == AFE_INIT ? "init" :
set == AFE_SET ? "set" :
@@ -389,7 +390,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
unsigned tgtime = 1 << (reg->get8(REG_0x1C) & REG_0x1C_TGTIME);
// hi res motor speed GPIO
- uint8_t effective = dev->interface->read_register(REG_0x6C);
+ std::uint8_t effective = dev->interface->read_register(REG_0x6C);
// if quarter step, bipolar Vref2
@@ -624,7 +625,7 @@ void CommandSetGl847::init_regs_for_scan_session(Genesys_Device* dev, const Gene
dev->session = session;
dev->total_bytes_read = 0;
- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
+ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines;
DBG(DBG_info, "%s: total bytes to send = %zu\n", __func__, dev->total_bytes_to_read);
}
@@ -722,7 +723,7 @@ void CommandSetGl847::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens
{
DBG_HELPER(dbg);
(void) sensor;
- uint8_t val;
+ std::uint8_t val;
if (reg->state.is_xpa_on && reg->state.is_lamp_on) {
dev->cmd_set->set_xpa_lamp_power(*dev, true);
@@ -879,11 +880,10 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
* for all the channels.
*/
void CommandSetGl847::send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
- uint8_t* data, int size) const
+ std::uint8_t* data, int size) const
{
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
std::uint32_t addr, i;
- uint8_t val,*ptr,*src;
unsigned length = static_cast<unsigned>(size / 3);
@@ -901,7 +901,7 @@ void CommandSetGl847::send_shading_data(Genesys_Device* dev, const Genesys_Senso
dev->interface->record_key_value("shading_length", std::to_string(length));
dev->interface->record_key_value("shading_factor", std::to_string(sensor.shading_factor));
- std::vector<uint8_t> buffer(pixels, 0);
+ std::vector<std::uint8_t> buffer(pixels, 0);
DBG(DBG_io2, "%s: using chunks of %d (0x%04x) bytes\n", __func__, pixels, pixels);
@@ -917,12 +917,12 @@ void CommandSetGl847::send_shading_data(Genesys_Device* dev, const Genesys_Senso
{
/* build up actual shading data by copying the part from the full width one
* to the one corresponding to SHDAREA */
- ptr = buffer.data();
+ std::uint8_t* ptr = buffer.data();
// iterate on both sensor segment
for (unsigned x = 0; x < pixels; x += 4 * sensor.shading_factor) {
- /* coefficient source */
- src = (data + offset + i * length) + x;
+ // coefficient source
+ std::uint8_t* src = (data + offset + i * length) + x;
/* coefficient copy */
ptr[0]=src[0];
@@ -934,7 +934,7 @@ void CommandSetGl847::send_shading_data(Genesys_Device* dev, const Genesys_Senso
ptr+=4;
}
- val = dev->interface->read_register(0xd0+i);
+ std::uint8_t val = dev->interface->read_register(0xd0+i);
addr = val * 8192 + 0x10000000;
dev->interface->write_ahb(addr, pixels, buffer.data());
}
@@ -1030,7 +1030,7 @@ void CommandSetGl847::asic_boot(Genesys_Device* dev, bool cold) const
}
// test CHKVER
- uint8_t val = dev->interface->read_register(REG_0x40);
+ std::uint8_t val = dev->interface->read_register(REG_0x40);
if (val & REG_0x40_CHKVER) {
val = dev->interface->read_register(0x00);
DBG(DBG_info, "%s: reported version for genesys chip is 0x%02x\n", __func__, val);
@@ -1089,27 +1089,46 @@ void CommandSetGl847::update_hardware_sensors(Genesys_Scanner* s) const
/* do what is needed to get a new set of events, but try to not lose
any of them.
*/
- uint8_t val;
- uint8_t scan, file, email, copy;
+ std::uint8_t val;
switch(s->dev->model->gpio_id) {
case GpioId::CANON_LIDE_700F:
- scan=0x04;
- file=0x02;
- email=0x01;
- copy=0x08;
+ val = s->dev->interface->read_register(REG_0x6D);
+ DBG(DBG_io, "%s: read buttons_gpio value=0x%x\n", __func__, (int)val);
+
+ s->buttons[BUTTON_SCAN_SW].write((val & 0x04) == 0);
+ s->buttons[BUTTON_FILE_SW].write((val & 0x02) == 0);
+ s->buttons[BUTTON_EMAIL_SW].write((val & 0x01) == 0);
+ s->buttons[BUTTON_COPY_SW].write((val & 0x08) == 0);
+ break;
+
+ case GpioId::CANON_5600F:
+ val = s->dev->interface->read_register(REG_0x6D);
+ DBG(DBG_io, "%s: read buttons_gpio 0x6d value=0x%x\n", __func__, (int)val);
+ s->buttons[BUTTON_SCAN_SW].write((val & 0x02) == 0);
+ s->buttons[BUTTON_EMAIL_SW].write((val & 0x01) == 0);
+ s->buttons[BUTTON_COPY_SW].write((val & 0x08) == 0);
+ s->buttons[BUTTON_PDF4_SW].write((val & 0x04) == 0);
+
+ val = s->dev->interface->read_register(REG_0xA6);
+ DBG(DBG_io, "%s: read buttons_gpio 0xa6 value=0x%x\n", __func__, (int)val);
+ s->buttons[BUTTON_PDF1_SW].write((val & 0x03) == 0x01);
+ s->buttons[BUTTON_PDF2_SW].write((val & 0x03) == 0x02);
+
+ val = s->dev->interface->read_register(REG_0x6C);
+ DBG(DBG_io, "%s: read buttons_gpio 0x6c value=0x%x\n", __func__, (int)val);
+ s->buttons[BUTTON_PDF3_SW].write((val & 0x80) == 0x00);
break;
+
default:
- scan=0x01;
- file=0x02;
- email=0x04;
- copy=0x08;
- }
- val = s->dev->interface->read_register(REG_0x6D);
+ val = s->dev->interface->read_register(REG_0x6D);
+ DBG(DBG_io, "%s: read buttons_gpio value=0x%x\n", __func__, (int)val);
- s->buttons[BUTTON_SCAN_SW].write((val & scan) == 0);
- s->buttons[BUTTON_FILE_SW].write((val & file) == 0);
- s->buttons[BUTTON_EMAIL_SW].write((val & email) == 0);
- s->buttons[BUTTON_COPY_SW].write((val & copy) == 0);
+ s->buttons[BUTTON_SCAN_SW].write((val & 0x01) == 0);
+ s->buttons[BUTTON_FILE_SW].write((val & 0x02) == 0);
+ s->buttons[BUTTON_EMAIL_SW].write((val & 0x04) == 0);
+ s->buttons[BUTTON_COPY_SW].write((val & 0x08) == 0);
+ break;
+ }
}
void CommandSetGl847::update_home_sensor_gpio(Genesys_Device& dev) const
diff --git a/backend/genesys/gl847.h b/backend/genesys/gl847.h
index 4b98b7a..68bf553 100644
--- a/backend/genesys/gl847.h
+++ b/backend/genesys/gl847.h
@@ -46,7 +46,7 @@ public:
Genesys_Register_Set* reg,
const ScanSession& session) const override;
- void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
+ void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const override;
void set_powersaving(Genesys_Device* dev, int delay) const override;
void save_power(Genesys_Device* dev, bool enable) const override;
@@ -80,7 +80,7 @@ public:
void eject_document(Genesys_Device* dev) const override;
- void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
+ void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t* data,
int size) const override;
ScanSession calculate_scan_session(const Genesys_Device* dev,
diff --git a/backend/genesys/image.h b/backend/genesys/image.h
index 07d3be3..80797ed 100644
--- a/backend/genesys/image.h
+++ b/backend/genesys/image.h
@@ -15,7 +15,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.s
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef BACKEND_GENESYS_IMAGE_H
diff --git a/backend/genesys/image_pipeline.cpp b/backend/genesys/image_pipeline.cpp
index f53680f..8dae0c5 100644
--- a/backend/genesys/image_pipeline.cpp
+++ b/backend/genesys/image_pipeline.cpp
@@ -173,7 +173,7 @@ ImagePipelineNodeDesegment::ImagePipelineNodeDesegment(ImagePipelineNode& source
std::iota(segment_order_.begin(), segment_order_.end(), 0);
}
-bool ImagePipelineNodeDesegment::get_next_row_data(uint8_t* out_data)
+bool ImagePipelineNodeDesegment::get_next_row_data(std::uint8_t* out_data)
{
bool got_data = true;
diff --git a/backend/genesys/image_pixel.h b/backend/genesys/image_pixel.h
index e414cfb..4f487ea 100644
--- a/backend/genesys/image_pixel.h
+++ b/backend/genesys/image_pixel.h
@@ -15,7 +15,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.s
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef BACKEND_GENESYS_IMAGE_PIXEL_H
diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp
index a6da2c1..3ffc24a 100644
--- a/backend/genesys/low.cpp
+++ b/backend/genesys/low.cpp
@@ -106,7 +106,7 @@ unsigned sanei_genesys_get_bulk_max_size(AsicType asic_type)
}
// Set address for writing data
-void sanei_genesys_set_buffer_address(Genesys_Device* dev, uint32_t addr)
+void sanei_genesys_set_buffer_address(Genesys_Device* dev, std::uint32_t addr)
{
DBG_HELPER(dbg);
@@ -356,12 +356,12 @@ void wait_until_has_valid_words(Genesys_Device* dev)
}
// Read data (e.g scanned image) from scan buffer
-void sanei_genesys_read_data_from_scanner(Genesys_Device* dev, uint8_t* data, size_t size)
+void sanei_genesys_read_data_from_scanner(Genesys_Device* dev, std::uint8_t* data, size_t size)
{
DBG_HELPER_ARGS(dbg, "size = %zu bytes", size);
- if (size & 1)
- DBG(DBG_info, "WARNING %s: odd number of bytes\n", __func__);
+ if (size & 1)
+ DBG(DBG_info, "WARNING %s: odd number of bytes\n", __func__);
wait_until_has_valid_words(dev);
@@ -565,7 +565,7 @@ void sanei_genesys_read_feed_steps(Genesys_Device* dev, unsigned int* steps)
void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs, bool set)
{
- static const uint8_t REG_0x03_LAMPPWR = 0x10;
+ static const std::uint8_t REG_0x03_LAMPPWR = 0x10;
if (set) {
regs.find_reg(0x03).value |= REG_0x03_LAMPPWR;
@@ -606,7 +606,7 @@ void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sen
void sanei_genesys_set_motor_power(Genesys_Register_Set& regs, bool set)
{
- static const uint8_t REG_0x02_MTRPWR = 0x10;
+ static const std::uint8_t REG_0x02_MTRPWR = 0x10;
if (set) {
regs.find_reg(0x02).value |= REG_0x02_MTRPWR;
@@ -635,13 +635,13 @@ bool should_enable_gamma(const ScanSession& session, const Genesys_Sensor& senso
return true;
}
-std::vector<uint16_t> get_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor,
- int color)
+std::vector<std::uint16_t> get_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor,
+ int color)
{
if (!dev->gamma_override_tables[color].empty()) {
return dev->gamma_override_tables[color];
} else {
- std::vector<uint16_t> ret;
+ std::vector<std::uint16_t> ret;
sanei_genesys_create_default_gamma_table(dev, ret, sensor.gamma[color]);
return ret;
}
@@ -654,23 +654,38 @@ std::vector<uint16_t> get_gamma_table(Genesys_Device* dev, const Genesys_Sensor&
* @param bits number of bits used by gamma
* @param max value for gamma
* @param size of the gamma table
- * @param gamma allocated gamma buffer to fill
*/
-void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
+std::vector<std::uint8_t> generate_gamma_buffer(Genesys_Device* dev,
const Genesys_Sensor& sensor,
- int bits,
- int max,
- int size,
- uint8_t* gamma)
+ int bits, int max, int size)
{
DBG_HELPER(dbg);
- std::vector<uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
- std::vector<uint16_t> ggamma = get_gamma_table(dev, sensor, GENESYS_GREEN);
- std::vector<uint16_t> bgamma = get_gamma_table(dev, sensor, GENESYS_BLUE);
+
+ // the gamma tables are 16 bits words and contain 3 channels
+ std::vector<std::uint8_t> gamma_buf(size * 2 * 3);
+
+ std::vector<std::uint16_t> rgamma = get_gamma_table(dev, sensor, GENESYS_RED);
+ std::vector<std::uint16_t> ggamma = get_gamma_table(dev, sensor, GENESYS_GREEN);
+ std::vector<std::uint16_t> bgamma = get_gamma_table(dev, sensor, GENESYS_BLUE);
+
+ auto get_gamma_value = [](const std::vector<std::uint16_t>& array,
+ std::size_t index) -> std::uint16_t
+ {
+ if (index < array.size())
+ return array[index];
+ return 0xffff;
+ };
+
+ auto set_gamma_buf_value = [](std::vector<std::uint8_t>& array, std::size_t pos,
+ std::uint16_t value)
+ {
+ array[pos * 2 + 0] = value & 0xff;
+ array[pos * 2 + 1] = (value >> 8) & 0xff;
+ };
if(dev->settings.contrast!=0 || dev->settings.brightness!=0)
{
- std::vector<uint16_t> lut(65536);
+ std::vector<std::uint16_t> lut(65536);
sanei_genesys_load_lut(reinterpret_cast<unsigned char *>(lut.data()),
bits,
bits,
@@ -680,39 +695,21 @@ void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
dev->settings.brightness);
for (int i = 0; i < size; i++)
{
- uint16_t value=rgamma[i];
- value=lut[value];
- gamma[i * 2 + size * 0 + 0] = value & 0xff;
- gamma[i * 2 + size * 0 + 1] = (value >> 8) & 0xff;
-
- value=ggamma[i];
- value=lut[value];
- gamma[i * 2 + size * 2 + 0] = value & 0xff;
- gamma[i * 2 + size * 2 + 1] = (value >> 8) & 0xff;
-
- value=bgamma[i];
- value=lut[value];
- gamma[i * 2 + size * 4 + 0] = value & 0xff;
- gamma[i * 2 + size * 4 + 1] = (value >> 8) & 0xff;
+ set_gamma_buf_value(gamma_buf, i + size * 0, lut[get_gamma_value(rgamma, i)]);
+ set_gamma_buf_value(gamma_buf, i + size * 1, lut[get_gamma_value(ggamma, i)]);
+ set_gamma_buf_value(gamma_buf, i + size * 2, lut[get_gamma_value(bgamma, i)]);
}
}
else
{
for (int i = 0; i < size; i++)
{
- uint16_t value=rgamma[i];
- gamma[i * 2 + size * 0 + 0] = value & 0xff;
- gamma[i * 2 + size * 0 + 1] = (value >> 8) & 0xff;
-
- value=ggamma[i];
- gamma[i * 2 + size * 2 + 0] = value & 0xff;
- gamma[i * 2 + size * 2 + 1] = (value >> 8) & 0xff;
-
- value=bgamma[i];
- gamma[i * 2 + size * 4 + 0] = value & 0xff;
- gamma[i * 2 + size * 4 + 1] = (value >> 8) & 0xff;
+ set_gamma_buf_value(gamma_buf, i + size * 0, get_gamma_value(rgamma, i));
+ set_gamma_buf_value(gamma_buf, i + size * 1, get_gamma_value(ggamma, i));
+ set_gamma_buf_value(gamma_buf, i + size * 2, get_gamma_value(bgamma, i));
}
}
+ return gamma_buf;
}
@@ -730,15 +727,12 @@ void sanei_genesys_send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& s
size = 256 + 1;
- /* allocate temporary gamma tables: 16 bits words, 3 channels */
- std::vector<uint8_t> gamma(size * 2 * 3, 255);
-
- sanei_genesys_generate_gamma_buffer(dev, sensor, 16, 65535, size, gamma.data());
+ auto gamma = generate_gamma_buffer(dev, sensor, 16, 65535, size);
// loop sending gamma tables NOTE: 0x01000000 not 0x10000000
for (i = 0; i < 3; i++) {
// clear corresponding GMM_N bit
- uint8_t val = dev->interface->read_register(0xbd);
+ std::uint8_t val = dev->interface->read_register(0xbd);
val &= ~(0x01 << i);
dev->interface->write_register(0xbd, val);
@@ -1410,7 +1404,7 @@ void sanei_genesys_asic_init(Genesys_Device* dev)
{
DBG_HELPER(dbg);
- uint8_t val;
+ std::uint8_t val;
bool cold = true;
// URB 16 control 0xc0 0x0c 0x8e 0x0b len 1 read 0x00 */
@@ -1507,13 +1501,13 @@ void scanner_start_action(Genesys_Device& dev, bool start_motor)
void sanei_genesys_set_dpihw(Genesys_Register_Set& regs, unsigned dpihw)
{
// same across GL646, GL841, GL843, GL846, GL847, GL124
- const uint8_t REG_0x05_DPIHW_MASK = 0xc0;
- const uint8_t REG_0x05_DPIHW_600 = 0x00;
- const uint8_t REG_0x05_DPIHW_1200 = 0x40;
- const uint8_t REG_0x05_DPIHW_2400 = 0x80;
- const uint8_t REG_0x05_DPIHW_4800 = 0xc0;
+ const std::uint8_t REG_0x05_DPIHW_MASK = 0xc0;
+ const std::uint8_t REG_0x05_DPIHW_600 = 0x00;
+ const std::uint8_t REG_0x05_DPIHW_1200 = 0x40;
+ const std::uint8_t REG_0x05_DPIHW_2400 = 0x80;
+ const std::uint8_t REG_0x05_DPIHW_4800 = 0xc0;
- uint8_t dpihw_setting;
+ std::uint8_t dpihw_setting;
switch (dpihw) {
case 600:
dpihw_setting = REG_0x05_DPIHW_600;
@@ -1925,8 +1919,8 @@ void sanei_genesys_load_lut(unsigned char* lut,
double shift, rise;
int max_in_val = (1 << in_bits) - 1;
int max_out_val = (1 << out_bits) - 1;
- uint8_t *lut_p8 = lut;
- uint16_t* lut_p16 = reinterpret_cast<std::uint16_t*>(lut);
+ std::uint8_t* lut_p8 = lut;
+ std::uint16_t* lut_p16 = reinterpret_cast<std::uint16_t*>(lut);
/* slope is converted to rise per unit run:
* first [-127,127] to [-.999,.999]
diff --git a/backend/genesys/low.h b/backend/genesys/low.h
index b0d23fe..1b96cc5 100644
--- a/backend/genesys/low.h
+++ b/backend/genesys/low.h
@@ -95,7 +95,11 @@
#define GENESYS_HAS_POWER_SW (1 << 6) /**< scanner has power button */
#define GENESYS_HAS_CALIBRATE (1 << 7) /**< scanner has 'calibrate' software button to start calibration */
#define GENESYS_HAS_EXTRA_SW (1 << 8) /**< scanner has extra function button */
-#define GENESYS_HAS_TRANSP_SW (1 << 9) /**< scanner has TRANSPARCY/SCAN_FILM button */
+#define GENESYS_HAS_TRANSP_SW (1 << 9) /**< scanner has TRANSPARENCY/SCAN_FILM button */
+#define GENESYS_HAS_PDF1_SW (1 << 10) /**< scanner has special PDF button 1 */
+#define GENESYS_HAS_PDF2_SW (1 << 11) /**< scanner has special PDF button 2 */
+#define GENESYS_HAS_PDF3_SW (1 << 12) /**< scanner has special PDF button 3 */
+#define GENESYS_HAS_PDF4_SW (1 << 13) /**< scanner has special PDF button 4 */
/* USB control message values */
#define REQUEST_TYPE_IN (USB_TYPE_VENDOR | USB_DIR_IN)
@@ -203,8 +207,8 @@ void scanner_register_rw_set_bits(Genesys_Device& dev, std::uint16_t address, st
void scanner_register_rw_bits(Genesys_Device& dev, std::uint16_t address,
std::uint8_t value, std::uint8_t mask);
-extern void sanei_genesys_write_ahb(Genesys_Device* dev, uint32_t addr, uint32_t size,
- uint8_t* data);
+void sanei_genesys_write_ahb(Genesys_Device* dev, std::uint32_t addr, std::uint32_t size,
+ std::uint8_t* data);
extern void sanei_genesys_init_structs (Genesys_Device * dev);
@@ -251,14 +255,14 @@ bool should_enable_gamma(const ScanSession& session, const Genesys_Sensor& senso
i.e. the number written to REG_FWDSTEP.
*/
void sanei_genesys_calculate_zmod(bool two_table,
- uint32_t exposure_time,
- const std::vector<uint16_t>& slope_table,
+ std::uint32_t exposure_time,
+ const std::vector<std::uint16_t>& slope_table,
unsigned acceleration_steps,
unsigned move_steps,
unsigned buffer_acceleration_steps,
- uint32_t* out_z1, uint32_t* out_z2);
+ std::uint32_t* out_z1, std::uint32_t* out_z2);
-extern void sanei_genesys_set_buffer_address(Genesys_Device* dev, uint32_t addr);
+extern void sanei_genesys_set_buffer_address(Genesys_Device* dev, std::uint32_t addr);
unsigned sanei_genesys_get_bulk_max_size(AsicType asic_type);
@@ -266,10 +270,10 @@ SANE_Int sanei_genesys_exposure_time2(Genesys_Device* dev, const MotorProfile& p
int endpixel, int led_exposure);
void sanei_genesys_create_default_gamma_table(Genesys_Device* dev,
- std::vector<uint16_t>& gamma_table, float gamma);
+ std::vector<std::uint16_t>& gamma_table, float gamma);
-std::vector<uint16_t> get_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor,
- int color);
+std::vector<std::uint16_t> get_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor,
+ int color);
void sanei_genesys_send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor);
@@ -307,14 +311,14 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor
void scanner_clear_scan_and_feed_counts(Genesys_Device& dev);
void scanner_send_slope_table(Genesys_Device* dev, const Genesys_Sensor& sensor, unsigned table_nr,
- const std::vector<uint16_t>& slope_table);
+ const std::vector<std::uint16_t>& slope_table);
extern void sanei_genesys_write_file(const char* filename, const std::uint8_t* data,
std::size_t length);
void wait_until_buffer_non_empty(Genesys_Device* dev, bool check_status_twice = false);
-extern void sanei_genesys_read_data_from_scanner(Genesys_Device* dev, uint8_t* data, size_t size);
+void sanei_genesys_read_data_from_scanner(Genesys_Device* dev, std::uint8_t* data, size_t size);
Image read_unshuffled_image_from_scanner(Genesys_Device* dev, const ScanSession& session,
std::size_t total_bytes);
@@ -392,12 +396,9 @@ extern void sanei_genesys_load_lut(unsigned char* lut,
int out_min, int out_max,
int slope, int offset);
-extern void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
- const Genesys_Sensor& sensor,
- int bits,
- int max,
- int size,
- uint8_t* gamma);
+std::vector<std::uint8_t> generate_gamma_buffer(Genesys_Device* dev,
+ const Genesys_Sensor& sensor,
+ int bits, int max, int size);
unsigned session_adjust_output_pixels(unsigned output_pixels,
const Genesys_Device& dev, const Genesys_Sensor& sensor,
diff --git a/backend/genesys/scanner_interface_usb.cpp b/backend/genesys/scanner_interface_usb.cpp
index da8823b..542d4ff 100644
--- a/backend/genesys/scanner_interface_usb.cpp
+++ b/backend/genesys/scanner_interface_usb.cpp
@@ -126,8 +126,8 @@ void ScannerInterfaceUsb::write_registers(const Genesys_Register_Set& regs)
if (dev_->model->asic_type == AsicType::GL646 ||
dev_->model->asic_type == AsicType::GL841)
{
- uint8_t outdata[8];
- std::vector<uint8_t> buffer;
+ std::uint8_t outdata[8];
+ std::vector<std::uint8_t> buffer;
buffer.reserve(regs.size() * 2);
/* copy registers and values in data buffer */
@@ -185,7 +185,7 @@ static void bulk_read_data_send_header(UsbDevice& usb_dev, AsicType asic_type, s
{
DBG_HELPER(dbg);
- uint8_t outdata[8];
+ std::uint8_t outdata[8];
if (asic_type == AsicType::GL124 ||
asic_type == AsicType::GL845 ||
asic_type == AsicType::GL846 ||
diff --git a/backend/genesys/serialize.cpp b/backend/genesys/serialize.cpp
deleted file mode 100644
index e69de29..0000000
--- a/backend/genesys/serialize.cpp
+++ /dev/null
diff --git a/backend/genesys/serialize.h b/backend/genesys/serialize.h
index ed67ea3..5040ed0 100644
--- a/backend/genesys/serialize.h
+++ b/backend/genesys/serialize.h
@@ -15,7 +15,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.s
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef BACKEND_GENESYS_SERIALIZE_H
diff --git a/backend/genesys/tables_model.cpp b/backend/genesys/tables_model.cpp
index d139334..6d02db8 100644
--- a/backend/genesys/tables_model.cpp
+++ b/backend/genesys/tables_model.cpp
@@ -447,7 +447,9 @@ void genesys_init_usb_device_tables()
ModelFlag::SHADING_REPARK |
ModelFlag::UTA_NO_SECONDARY_MOTOR;
- model.buttons = GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | GENESYS_HAS_COPY_SW;
+ model.buttons = GENESYS_HAS_TRANSP_SW | GENESYS_HAS_EMAIL_SW
+ | GENESYS_HAS_COPY_SW | GENESYS_HAS_PDF1_SW | GENESYS_HAS_PDF2_SW
+ | GENESYS_HAS_PDF3_SW | GENESYS_HAS_PDF4_SW;
model.search_lines = 100;
s_usb_devices->emplace_back(0x04a9, 0x2228, model);
@@ -517,7 +519,7 @@ void genesys_init_usb_device_tables()
ModelFlag::DARK_CALIBRATION |
ModelFlag::CUSTOM_GAMMA |
ModelFlag::SHADING_REPARK;
- model.buttons = GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | GENESYS_HAS_COPY_SW;
+ model.buttons = GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | GENESYS_HAS_COPY_SW | GENESYS_HAS_EMAIL_SW;
model.search_lines = 100;
s_usb_devices->emplace_back(0x04a9, 0x221e, model);
@@ -927,7 +929,10 @@ void genesys_init_usb_device_tables()
model.buttons = GENESYS_HAS_SCAN_SW |
GENESYS_HAS_COPY_SW |
GENESYS_HAS_EMAIL_SW |
- GENESYS_HAS_FILE_SW;
+ GENESYS_HAS_PDF1_SW |
+ GENESYS_HAS_PDF2_SW |
+ GENESYS_HAS_PDF3_SW |
+ GENESYS_HAS_PDF4_SW;
model.search_lines = 400;
s_usb_devices->emplace_back(0x04a9, 0x1906, model);
diff --git a/backend/genesys/test_scanner_interface.cpp b/backend/genesys/test_scanner_interface.cpp
index 412176e..ef7cdbb 100644
--- a/backend/genesys/test_scanner_interface.cpp
+++ b/backend/genesys/test_scanner_interface.cpp
@@ -26,8 +26,8 @@
namespace genesys {
-TestScannerInterface::TestScannerInterface(Genesys_Device* dev, uint16_t vendor_id,
- uint16_t product_id, uint16_t bcd_device) :
+TestScannerInterface::TestScannerInterface(Genesys_Device* dev, std::uint16_t vendor_id,
+ std::uint16_t product_id, std::uint16_t bcd_device) :
dev_{dev},
usb_dev_{vendor_id, product_id, bcd_device}
{