kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Return errors as exceptions from *read_data_from_scanner()
rodzic
867d907bb9
commit
94abc7f964
|
@ -1541,13 +1541,7 @@ static SANE_Status genesys_coarse_calibration(Genesys_Device * dev, Genesys_Sens
|
|||
|
||||
dev->model->cmd_set->begin_scan(dev, sensor, &dev->calib_reg, SANE_FALSE);
|
||||
|
||||
status =
|
||||
sanei_genesys_read_data_from_scanner (dev, calibration_data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: Failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
sanei_genesys_read_data_from_scanner(dev, calibration_data.data(), size);
|
||||
|
||||
std::memcpy(all_data.data() + i * size, calibration_data.data(), size);
|
||||
if (i == 3) /* last line */
|
||||
|
@ -1677,7 +1671,6 @@ static SANE_Status
|
|||
genesys_dark_shading_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
size_t size;
|
||||
uint32_t pixels_per_line;
|
||||
uint8_t channels;
|
||||
|
@ -1736,12 +1729,7 @@ genesys_dark_shading_calibration(Genesys_Device * dev, const Genesys_Sensor& sen
|
|||
|
||||
dev->model->cmd_set->begin_scan(dev, sensor, &dev->calib_reg, SANE_FALSE);
|
||||
|
||||
status = sanei_genesys_read_data_from_scanner (dev, calibration_data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
sanei_genesys_read_data_from_scanner(dev, calibration_data.data(), size);
|
||||
|
||||
dev->model->cmd_set->end_scan(dev, &dev->calib_reg, SANE_TRUE);
|
||||
|
||||
|
@ -1924,12 +1912,7 @@ genesys_white_shading_calibration (Genesys_Device * dev, const Genesys_Sensor& s
|
|||
|
||||
dev->model->cmd_set->begin_scan(dev, sensor, &dev->calib_reg, SANE_TRUE);
|
||||
|
||||
status = sanei_genesys_read_data_from_scanner (dev, calibration_data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
sanei_genesys_read_data_from_scanner(dev, calibration_data.data(), size);
|
||||
|
||||
dev->model->cmd_set->end_scan(dev, &dev->calib_reg, SANE_TRUE);
|
||||
|
||||
|
@ -1976,7 +1959,6 @@ static SANE_Status
|
|||
genesys_dark_white_shading_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "lines = %d", (unsigned int)dev->calib_lines);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
size_t size;
|
||||
uint32_t pixels_per_line;
|
||||
uint8_t *average_white, *average_dark;
|
||||
|
@ -2021,12 +2003,7 @@ genesys_dark_white_shading_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
|
||||
dev->model->cmd_set->begin_scan(dev, sensor, &dev->calib_reg, SANE_FALSE);
|
||||
|
||||
status = sanei_genesys_read_data_from_scanner (dev, calibration_data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
sanei_genesys_read_data_from_scanner(dev, calibration_data.data(), size);
|
||||
|
||||
dev->model->cmd_set->end_scan(dev, &dev->calib_reg, SANE_TRUE);
|
||||
|
||||
|
@ -3510,12 +3487,10 @@ genesys_warmup_lamp (Genesys_Device * dev)
|
|||
while (empty);
|
||||
|
||||
try {
|
||||
status = sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size);
|
||||
if (status != SANE_STATUS_GOOD) {
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size));
|
||||
}
|
||||
sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size);
|
||||
} catch (...) {
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size));
|
||||
// FIXME: document why this retry is here
|
||||
sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size);
|
||||
}
|
||||
|
||||
dev->model->cmd_set->end_scan(dev, &dev->reg, SANE_TRUE);
|
||||
|
@ -3530,7 +3505,7 @@ genesys_warmup_lamp (Genesys_Device * dev)
|
|||
sanei_genesys_sleep_ms(100);
|
||||
}
|
||||
while (empty);
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, second_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size);
|
||||
dev->model->cmd_set->end_scan(dev, &dev->reg, SANE_TRUE);
|
||||
|
||||
/* compute difference between the two scans */
|
||||
|
|
|
@ -1923,7 +1923,6 @@ gl124_search_start_position (Genesys_Device * dev)
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
int size;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
Genesys_Register_Set local_reg = dev->reg;
|
||||
int steps;
|
||||
|
||||
|
@ -1970,13 +1969,8 @@ gl124_search_start_position (Genesys_Device * dev)
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner (dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data) {
|
||||
sanei_genesys_write_pnm_file("gl124_search_position.pnm", data.data(), 8, 1, pixels,
|
||||
|
@ -2371,7 +2365,7 @@ move_to_calibration_area (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
|
||||
DBG (DBG_info, "%s: starting line reading\n", __func__);
|
||||
gl124_begin_scan (dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, line.data(), size));
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), size);
|
||||
|
||||
// stop scanning
|
||||
gl124_stop_action(dev);
|
||||
|
@ -2473,7 +2467,7 @@ gl124_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
|
||||
DBG(DBG_info, "%s: starting line reading\n", __func__);
|
||||
gl124_begin_scan (dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), total_size);
|
||||
|
||||
// stop scanning
|
||||
gl124_stop_action(dev);
|
||||
|
@ -2647,7 +2641,7 @@ gl124_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
DBG(DBG_info, "%s: starting first line reading\n", __func__);
|
||||
gl124_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size);
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
char title[30];
|
||||
|
@ -2667,7 +2661,7 @@ gl124_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
DBG(DBG_info, "%s: starting second line reading\n", __func__);
|
||||
gl124_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, second_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size);
|
||||
|
||||
topavg = dark_average(second_line.data(), pixels, lines, channels, black_pixels);
|
||||
DBG(DBG_io2, "%s: top avg=%d\n", __func__, topavg);
|
||||
|
@ -2687,7 +2681,7 @@ gl124_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
DBG(DBG_info, "%s: starting second line reading\n", __func__);
|
||||
gl124_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
@ -2804,7 +2798,7 @@ gl124_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
|
||||
gl124_set_fe(dev, sensor, AFE_SET);
|
||||
gl124_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), total_size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
sanei_genesys_write_pnm_file("gl124_gain.pnm", line.data(), bpp, channels, pixels, lines);
|
||||
|
|
|
@ -3587,7 +3587,6 @@ simple_scan (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
SANE_Bool forward, SANE_Bool shading, std::vector<uint8_t>& data)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "move=%d, forward=%d, shading=%d", move, forward, shading);
|
||||
SANE_Status status = SANE_STATUS_INVAL;
|
||||
unsigned int size, lines, x, y, bpp;
|
||||
SANE_Bool empty, split;
|
||||
int count;
|
||||
|
@ -3703,13 +3702,8 @@ simple_scan (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner (dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
/* in case of CIS scanner, we must reorder data */
|
||||
if (dev->model->is_cis == SANE_TRUE
|
||||
|
@ -3759,7 +3753,7 @@ simple_scan (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
// end scan , waiting the motor to stop if needed (if moving), but without ejecting doc
|
||||
end_scan(dev, &dev->reg, SANE_TRUE, SANE_FALSE);
|
||||
|
||||
return status;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2982,7 +2982,6 @@ gl841_search_start_position (Genesys_Device * dev)
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
int size;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
Genesys_Register_Set local_reg;
|
||||
int steps;
|
||||
|
||||
|
@ -3031,13 +3030,8 @@ gl841_search_start_position (Genesys_Device * dev)
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data) {
|
||||
sanei_genesys_write_pnm_file("gl841_search_position.pnm", data.data(), 8, 1, pixels,
|
||||
|
@ -3406,7 +3400,7 @@ gl841_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
|
||||
DBG(DBG_info, "%s: starting line reading\n", __func__);
|
||||
gl841_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), total_size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data) {
|
||||
char fn[30];
|
||||
|
@ -3732,7 +3726,7 @@ gl841_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
DBG(DBG_info, "%s: starting first line reading\n", __func__);
|
||||
gl841_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, first_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data) {
|
||||
char fn[30];
|
||||
|
@ -3839,7 +3833,7 @@ gl841_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
DBG(DBG_info, "%s: starting second line reading\n", __func__);
|
||||
sanei_genesys_bulk_write_register(dev, regs);
|
||||
gl841_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, second_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data) {
|
||||
char fn[30];
|
||||
|
@ -4053,7 +4047,7 @@ gl841_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
std::vector<uint8_t> line(total_size);
|
||||
|
||||
gl841_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), total_size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
sanei_genesys_write_pnm_file("gl841_gain.pnm", line.data(), 16, channels, num_pixels, lines);
|
||||
|
@ -4368,8 +4362,8 @@ static void gl841_init(Genesys_Device* dev)
|
|||
|
||||
sanei_usb_set_timeout(1000);/* 1 second*/
|
||||
|
||||
/*ignore errors. next read will succeed*/
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), size);
|
||||
// ignore errors. next read will succeed
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), size);
|
||||
|
||||
sanei_usb_set_timeout(30 * 1000);/* 30 seconds*/
|
||||
|
||||
|
@ -4506,13 +4500,8 @@ gl841_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
gl841_stop_action(dev);
|
||||
|
||||
|
@ -4538,13 +4527,8 @@ gl841_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner (dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "g%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
gl841_stop_action (dev);
|
||||
|
||||
|
|
|
@ -2380,7 +2380,6 @@ gl843_search_start_position (Genesys_Device * dev)
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
int size;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
Genesys_Register_Set local_reg;
|
||||
int steps;
|
||||
|
||||
|
@ -2430,13 +2429,9 @@ gl843_search_start_position (Genesys_Device * dev)
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
gl843_stop_action_no_move(dev, &local_reg);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data) {
|
||||
|
@ -2910,7 +2905,7 @@ gl843_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
|
||||
DBG(DBG_info, "%s: starting first line reading\n", __func__);
|
||||
gl843_begin_scan(dev, calib_sensor, ®s, SANE_TRUE);
|
||||
RIE (sanei_genesys_read_data_from_scanner(dev, line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), total_size);
|
||||
gl843_stop_action_no_move(dev, ®s);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
|
@ -3044,7 +3039,6 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
Genesys_Register_Set& regs)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
unsigned int channels, bpp;
|
||||
int pass, total_size, i, resolution, lines;
|
||||
int topavg[3], bottomavg[3], avg[3];
|
||||
|
@ -3136,7 +3130,7 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
DBG(DBG_info, "%s: starting first line reading\n", __func__);
|
||||
gl843_begin_scan(dev, calib_sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size);
|
||||
gl843_stop_action_no_move(dev, ®s);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
|
@ -3165,7 +3159,7 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
DBG(DBG_info, "%s: starting second line reading\n", __func__);
|
||||
gl843_begin_scan(dev, calib_sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size);
|
||||
gl843_stop_action_no_move(dev, ®s);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
|
@ -3201,7 +3195,7 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
DBG(DBG_info, "%s: starting second line reading\n", __func__);
|
||||
gl843_begin_scan(dev, calib_sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size);
|
||||
gl843_stop_action_no_move(dev, ®s);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
|
@ -3354,7 +3348,7 @@ gl843_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
|
||||
gl843_set_fe(dev, calib_sensor, AFE_SET);
|
||||
gl843_begin_scan(dev, calib_sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), total_size);
|
||||
gl843_stop_action_no_move(dev, ®s);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
|
@ -3783,13 +3777,8 @@ gl843_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
gl843_stop_action(dev);
|
||||
|
||||
|
@ -3816,13 +3805,8 @@ gl843_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
gl843_stop_action(dev);
|
||||
|
||||
|
|
|
@ -1585,7 +1585,6 @@ gl846_search_start_position (Genesys_Device * dev)
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
int size;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
Genesys_Register_Set local_reg;
|
||||
int steps;
|
||||
|
||||
|
@ -1633,13 +1632,8 @@ gl846_search_start_position (Genesys_Device * dev)
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data) {
|
||||
sanei_genesys_write_pnm_file("gl846_search_position.pnm", data.data(), 8, 1, pixels,
|
||||
|
@ -2124,7 +2118,7 @@ gl846_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
|
||||
DBG(DBG_info, "%s: starting line reading\n", __func__);
|
||||
gl846_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), total_size);
|
||||
|
||||
// stop scanning
|
||||
gl846_stop_action(dev);
|
||||
|
@ -2447,13 +2441,8 @@ gl846_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
gl846_stop_action(dev);
|
||||
|
||||
|
@ -2479,13 +2468,8 @@ gl846_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
gl846_stop_action(dev);
|
||||
|
||||
|
@ -2696,7 +2680,7 @@ gl846_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
DBG(DBG_info, "%s: starting first line reading\n", __func__);
|
||||
gl846_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, first_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size);
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
char fn[30];
|
||||
|
@ -2716,7 +2700,7 @@ gl846_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
DBG(DBG_info, "%s: starting second line reading\n", __func__);
|
||||
gl846_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, second_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size);
|
||||
|
||||
topavg = dark_average(second_line.data(), pixels, lines, channels, black_pixels);
|
||||
DBG(DBG_io2, "%s: top avg=%d\n", __func__, topavg);
|
||||
|
@ -2736,7 +2720,7 @@ gl846_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
DBG(DBG_info, "%s: starting second line reading\n", __func__);
|
||||
gl846_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, second_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
@ -2846,7 +2830,7 @@ gl846_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
|
||||
gl846_set_fe(dev, sensor, AFE_SET);
|
||||
gl846_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), total_size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
sanei_genesys_write_pnm_file("gl846_gain.pnm", line.data(), bpp, channels, pixels, lines);
|
||||
|
|
|
@ -1646,7 +1646,6 @@ gl847_search_start_position (Genesys_Device * dev)
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
int size;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
Genesys_Register_Set local_reg;
|
||||
int steps;
|
||||
|
||||
|
@ -1694,13 +1693,8 @@ gl847_search_start_position (Genesys_Device * dev)
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data) {
|
||||
sanei_genesys_write_pnm_file("gl847_search_position.pnm", data.data(), 8, 1, pixels,
|
||||
|
@ -2184,7 +2178,7 @@ gl847_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
|
||||
DBG(DBG_info, "%s: starting line reading\n", __func__);
|
||||
gl847_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), total_size);
|
||||
|
||||
// stop scanning
|
||||
gl847_stop_action(dev);
|
||||
|
@ -2552,13 +2546,8 @@ gl847_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
gl847_stop_action(dev);
|
||||
|
||||
|
@ -2584,13 +2573,8 @@ gl847_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
sanei_genesys_test_buffer_empty(dev, &steps);
|
||||
} while (steps);
|
||||
|
||||
/* now we're on target, we can read data */
|
||||
status = sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// now we're on target, we can read data
|
||||
sanei_genesys_read_data_from_scanner(dev, data.data(), size);
|
||||
|
||||
gl847_stop_action(dev);
|
||||
|
||||
|
@ -2801,7 +2785,7 @@ gl847_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
DBG(DBG_info, "%s: starting first line reading\n", __func__);
|
||||
gl847_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size);
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
char fn[30];
|
||||
|
@ -2821,7 +2805,7 @@ gl847_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
DBG(DBG_info, "%s: starting second line reading\n", __func__);
|
||||
gl847_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, second_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size);
|
||||
|
||||
topavg = dark_average(second_line.data(), pixels, lines, channels, black_pixels);
|
||||
DBG(DBG_io2, "%s: top avg=%d\n", __func__, topavg);
|
||||
|
@ -2841,7 +2825,7 @@ gl847_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
dev->model->cmd_set->bulk_write_register(dev, regs);
|
||||
DBG(DBG_info, "%s: starting second line reading\n", __func__);
|
||||
gl847_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, second_line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
@ -2949,7 +2933,7 @@ gl847_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
|
||||
gl847_set_fe(dev, sensor, AFE_SET);
|
||||
gl847_begin_scan(dev, sensor, ®s, SANE_TRUE);
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, line.data(), total_size));
|
||||
sanei_genesys_read_data_from_scanner(dev, line.data(), total_size);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
sanei_genesys_write_pnm_file("gl847_gain.pnm", line.data(), bpp, channels, pixels, lines);
|
||||
|
|
|
@ -809,10 +809,8 @@ void sanei_genesys_test_buffer_empty(Genesys_Device* dev, SANE_Bool* empty)
|
|||
}
|
||||
|
||||
|
||||
/* Read data (e.g scanned image) from scan buffer */
|
||||
SANE_Status
|
||||
sanei_genesys_read_data_from_scanner (Genesys_Device * dev, uint8_t * data,
|
||||
size_t size)
|
||||
// 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)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "size = %lu bytes", (u_long) size);
|
||||
int time_count = 0;
|
||||
|
@ -834,13 +832,10 @@ sanei_genesys_read_data_from_scanner (Genesys_Device * dev, uint8_t * data,
|
|||
|
||||
if (words == 0) /* timeout, buffer does not get filled */
|
||||
{
|
||||
DBG(DBG_error, "%s: timeout, buffer does not get filled\n", __func__);
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
throw SaneException(SANE_STATUS_IO_ERROR, "timeout, buffer does not get filled");
|
||||
}
|
||||
|
||||
dev->model->cmd_set->bulk_read_data(dev, 0x45, data, size);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
void sanei_genesys_read_feed_steps(Genesys_Device* dev, unsigned int* steps)
|
||||
{
|
||||
|
|
|
@ -1896,9 +1896,7 @@ extern void sanei_genesys_write_pnm_file(const char* filename, uint8_t* data, in
|
|||
|
||||
extern void sanei_genesys_test_buffer_empty(Genesys_Device* dev, SANE_Bool* empty);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_read_data_from_scanner (Genesys_Device * dev, uint8_t * data,
|
||||
size_t size);
|
||||
extern void sanei_genesys_read_data_from_scanner(Genesys_Device* dev, uint8_t* data, size_t size);
|
||||
|
||||
inline void sanei_genesys_set_double(Genesys_Register_Set* regs, uint16_t addr, uint16_t value)
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue