genesys: Return errors as exceptions from *move_to_ta()

merge-requests/104/head
Povilas Kanapickas 2019-07-20 11:02:30 +03:00
rodzic 92d1817c24
commit 579df0d0b7
5 zmienionych plików z 9 dodań i 25 usunięć

Wyświetl plik

@ -3048,7 +3048,7 @@ genesys_flatbed_calibration(Genesys_Device * dev, Genesys_Sensor& sensor)
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
RIE(dev->model->cmd_set->move_to_ta(dev));
dev->model->cmd_set->move_to_ta(dev);
}
/* shading calibration */
@ -3510,13 +3510,7 @@ genesys_start_scan (Genesys_Device * dev, SANE_Bool lamp_off)
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) &&
dev->model->cmd_set->move_to_ta != NULL)
{
status=dev->model->cmd_set->move_to_ta(dev);
if (status != SANE_STATUS_GOOD)
{
DBG(DBG_error, "%s: failed to move to start of transparency adapter: %s\n", __func__,
sane_strstatus(status));
return status;
}
dev->model->cmd_set->move_to_ta(dev);
}
/* load document if needed (for sheetfed scanner for instance) */
@ -3584,7 +3578,7 @@ genesys_start_scan (Genesys_Device * dev, SANE_Bool lamp_off)
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
RIE(dev->model->cmd_set->move_to_ta(dev));
dev->model->cmd_set->move_to_ta(dev);
}
dev->model->cmd_set->init_regs_for_scan(dev, sensor);

Wyświetl plik

@ -3454,19 +3454,15 @@ static void gl646_init(Genesys_Device* dev)
dev->already_initialized = SANE_TRUE;
}
static
SANE_Status
gl646_move_to_ta (Genesys_Device * dev)
static void gl646_move_to_ta(Genesys_Device* dev)
{
DBG_HELPER(dbg);
SANE_Status status = SANE_STATUS_GOOD;
if (simple_move(dev, SANE_UNFIX(dev->model->y_offset_sensor_to_ta)) != SANE_STATUS_GOOD)
{
DBG(DBG_error, "%s: failed to move to calibration area\n", __func__);
return status;
return;
}
return status;
}

Wyświetl plik

@ -173,9 +173,7 @@ static void gl646_save_power(Genesys_Device* dev, SANE_Bool enable);
static void gl646_slow_back_home(Genesys_Device* dev, SANE_Bool wait_until_home);
static
SANE_Status
gl646_move_to_ta (Genesys_Device * dev);
static void gl646_move_to_ta(Genesys_Device* dev);
/**
* sets up the scanner for a scan, registers, gamma tables, shading tables

Wyświetl plik

@ -2564,7 +2564,7 @@ static void gl843_feed(Genesys_Device* dev, unsigned int steps)
sanei_genesys_sleep_ms(100);
}
static SANE_Status gl843_move_to_ta (Genesys_Device * dev);
static void gl843_move_to_ta(Genesys_Device* dev);
// 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,
@ -3640,19 +3640,15 @@ static void gl843_update_hardware_sensors(Genesys_Scanner* s)
* Move sensor to the calibration of the transparency adapator (XPA).
* @param dev device to use
*/
static SANE_Status
gl843_move_to_ta (Genesys_Device * dev)
static void gl843_move_to_ta(Genesys_Device* dev)
{
DBG_HELPER(dbg);
SANE_Status status = SANE_STATUS_GOOD;
float resolution;
unsigned int feed;
resolution=sanei_genesys_get_lowest_ydpi(dev);
feed = 16*(SANE_UNFIX (dev->model->y_offset_sensor_to_ta) * resolution) / MM_PER_INCH;
gl843_feed(dev, feed);
return status;
}

Wyświetl plik

@ -1123,7 +1123,7 @@ struct Genesys_Command_Set
/**
* move scanning head to transparency adapter
*/
SANE_Status (*move_to_ta) (Genesys_Device * dev);
void (*move_to_ta) (Genesys_Device* dev);
/**
* write shading data calibration to ASIC