genesys: Return errors as exceptions from *init_regs_for_shading()

merge-requests/104/head
Povilas Kanapickas 2019-07-20 11:02:20 +03:00
rodzic 61f74af249
commit 8837f8adcc
8 zmienionych plików z 24 dodań i 62 usunięć

Wyświetl plik

@ -3079,13 +3079,7 @@ genesys_flatbed_calibration(Genesys_Device * dev, Genesys_Sensor& sensor)
/* shading calibration */
sanei_usb_testing_record_message("init_regs_for_shading");
status = dev->model->cmd_set->init_regs_for_shading(dev, sensor, dev->calib_reg);
if (status != SANE_STATUS_GOOD)
{
DBG(DBG_error, "%s: failed to send shading registers: %s\n", __func__,
sane_strstatus(status));
return status;
}
dev->model->cmd_set->init_regs_for_shading(dev, sensor, dev->calib_reg);
if (dev->model->flags & GENESYS_FLAG_DARK_WHITE_CALIBRATION)
{
@ -3118,7 +3112,7 @@ genesys_flatbed_calibration(Genesys_Device * dev, Genesys_Sensor& sensor)
genesys_repark_sensor_before_shading(dev);
sanei_usb_testing_record_message("init_regs_for_shading2");
RIE(dev->model->cmd_set->init_regs_for_shading(dev, sensor, dev->calib_reg));
dev->model->cmd_set->init_regs_for_shading(dev, sensor, dev->calib_reg);
sanei_usb_testing_record_message("genesys_white_shading_calibration");
status = genesys_white_shading_calibration (dev, sensor);
@ -3257,13 +3251,8 @@ static SANE_Status genesys_sheetfed_calibration(Genesys_Device * dev, Genesys_Se
throw;
}
status = dev->model->cmd_set->init_regs_for_shading(dev, sensor, dev->calib_reg);
if (status != SANE_STATUS_GOOD)
{
DBG(DBG_error, "%s: failed to do set up registers for shading calibration: %s\n",
__func__, sane_strstatus(status));
return status;
}
dev->model->cmd_set->init_regs_for_shading(dev, sensor, dev->calib_reg);
try {
status = genesys_dark_shading_calibration(dev, sensor);
if (status != SANE_STATUS_GOOD) {
@ -3296,13 +3285,7 @@ static SANE_Status genesys_sheetfed_calibration(Genesys_Device * dev, Genesys_Se
genesys_repark_sensor_before_shading(dev);
status = dev->model->cmd_set->init_regs_for_shading(dev, sensor, dev->calib_reg);
if (status != SANE_STATUS_GOOD)
{
DBG(DBG_error, "%s: failed to do set up registers for shading calibration: %s\n", __func__,
sane_strstatus(status));
return status;
}
dev->model->cmd_set->init_regs_for_shading(dev, sensor, dev->calib_reg);
try {
status = genesys_white_shading_calibration(dev, sensor);

Wyświetl plik

@ -2033,11 +2033,9 @@ static void gl124_init_regs_for_coarse_calibration(Genesys_Device* dev,
}
/* init registers for shading calibration */
/* shading calibration is done at dpihw */
static SANE_Status
gl124_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
// init registers for shading calibration shading calibration is done at dpihw
static void gl124_init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
{
DBG_HELPER(dbg);
int move, resolution, dpihw, factor;
@ -2102,8 +2100,6 @@ gl124_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
dev->scanhead_position_in_steps += dev->calib_lines + move;
dev->model->cmd_set->bulk_write_register(dev, regs);
return SANE_STATUS_GOOD;
}
static void gl124_wait_for_motor_stop(Genesys_Device* dev)

Wyświetl plik

@ -2235,13 +2235,11 @@ static void gl646_init_regs_for_coarse_calibration(Genesys_Device* dev,
* @param dev scanner's device
* @return SANE_STATUS_GOOD if success, else error code
*/
static SANE_Status
gl646_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
static void gl646_init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
{
DBG_HELPER(dbg);
(void) regs;
SANE_Status status = SANE_STATUS_GOOD;
Genesys_Settings settings;
/* 1: no half_ccd, 2: use half number of pixels */
int half_ccd = 1;
@ -2325,8 +2323,6 @@ gl646_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
dev->current_setup.xres = dev->settings.xres;
DBG(DBG_info, "%s:\n\tdev->settings.xres=%d\n\tdev->settings.yres=%d\n", __func__,
dev->settings.xres, dev->settings.yres);
return status;
}
static bool gl646_needs_home_before_init_regs_for_scan(Genesys_Device* dev)

Wyświetl plik

@ -3096,10 +3096,9 @@ static void gl841_init_regs_for_coarse_calibration(Genesys_Device* dev,
}
/* init registers for shading calibration */
static SANE_Status
gl841_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
// init registers for shading calibration
static void gl841_init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
{
DBG_HELPER_ARGS(dbg, "lines = %d", (int)(dev->calib_lines));
SANE_Int ydpi;
@ -3156,8 +3155,6 @@ gl841_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
dev->scanhead_position_in_steps += dev->calib_lines + starty;
sanei_genesys_bulk_write_register(dev, regs);
return SANE_STATUS_GOOD;
}
/* set up registers for the actual scan

Wyświetl plik

@ -2575,11 +2575,9 @@ static void gl843_feed(Genesys_Device* dev, unsigned int steps)
static SANE_Status gl843_move_to_ta (Genesys_Device * dev);
/* init registers for shading calibration */
/* shading calibration is done at dpihw */
static SANE_Status
gl843_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
// init registers for shading calibration shading calibration is done at dpihw
static void gl843_init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
{
DBG_HELPER(dbg);
int move, resolution, dpihw, factor;
@ -2675,8 +2673,6 @@ gl843_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
DBG(DBG_info, "%s: STRPIXEL=%d\n", __func__, strpixel);
dev->model->cmd_set->bulk_write_register(dev, regs);
return SANE_STATUS_GOOD;
}
/** @brief set up registers for the actual scan

Wyświetl plik

@ -1771,10 +1771,9 @@ static void gl846_feed(Genesys_Device* dev, unsigned int steps)
}
/* init registers for shading calibration */
static SANE_Status
gl846_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
// init registers for shading calibration
static void gl846_init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
{
DBG_HELPER(dbg);
float move;
@ -1824,8 +1823,6 @@ gl846_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
/* we use GENESYS_FLAG_SHADING_REPARK */
dev->scanhead_position_in_steps = 0;
return SANE_STATUS_GOOD;
}
/** @brief set up registers for the actual scan

Wyświetl plik

@ -1831,10 +1831,9 @@ static void gl847_feed(Genesys_Device* dev, unsigned int steps)
}
/* init registers for shading calibration */
static SANE_Status
gl847_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
// init registers for shading calibration
static void gl847_init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs)
{
DBG_HELPER(dbg);
float move;
@ -1884,8 +1883,6 @@ gl847_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
/* we use GENESYS_FLAG_SHADING_REPARK */
dev->scanhead_position_in_steps = 0;
return SANE_STATUS_GOOD;
}
/** @brief set up registers for the actual scan

Wyświetl plik

@ -1049,8 +1049,8 @@ struct Genesys_Command_Set
Genesys_Register_Set* regs, int*channels, int* total_size);
void (*init_regs_for_coarse_calibration) (Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs);
SANE_Status (*init_regs_for_shading) (Genesys_Device * dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs);
void (*init_regs_for_shading) (Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs);
SANE_Status (*init_regs_for_scan) (Genesys_Device * dev, const Genesys_Sensor& sensor);
SANE_Bool (*get_filter_bit) (Genesys_Register_Set * reg);