genesys: Return errors as exceptions from *search_start_position()

merge-requests/104/head
Povilas Kanapickas 2019-07-20 11:02:22 +03:00
rodzic d46d5cd027
commit 1eaa889632
8 zmienionych plików z 18 dodań i 43 usunięć

Wyświetl plik

@ -3551,13 +3551,7 @@ genesys_start_scan (Genesys_Device * dev, SANE_Bool lamp_off)
if ((dev->model->flags & GENESYS_FLAG_SEARCH_START) if ((dev->model->flags & GENESYS_FLAG_SEARCH_START)
&& (dev->model->y_offset_calib == 0)) && (dev->model->y_offset_calib == 0))
{ {
status = dev->model->cmd_set->search_start_position (dev); dev->model->cmd_set->search_start_position (dev);
if (status != SANE_STATUS_GOOD)
{
DBG(DBG_error, "%s: failed to search start position: %s\n", __func__,
sane_strstatus(status));
return status;
}
dev->parking = SANE_FALSE; dev->parking = SANE_FALSE;
dev->model->cmd_set->slow_back_home (dev, SANE_TRUE); dev->model->cmd_set->slow_back_home (dev, SANE_TRUE);

Wyświetl plik

@ -1916,10 +1916,9 @@ static void gl124_feed(Genesys_Device* dev, unsigned int steps, int reverse)
} }
/* Automatically set top-left edge of the scan area by scanning a 200x200 pixels // Automatically set top-left edge of the scan area by scanning a 200x200 pixels area at 600 dpi
area at 600 dpi from very top of scanner */ // from very top of scanner
static SANE_Status static void gl124_search_start_position(Genesys_Device* dev)
gl124_search_start_position (Genesys_Device * dev)
{ {
DBG_HELPER(dbg); DBG_HELPER(dbg);
int size; int size;
@ -1984,8 +1983,6 @@ gl124_search_start_position (Genesys_Device * dev)
sanei_genesys_search_reference_point(dev, sensor, data.data(), 0, dpi, pixels, sanei_genesys_search_reference_point(dev, sensor, data.data(), 0, dpi, pixels,
dev->model->search_lines); dev->model->search_lines);
return SANE_STATUS_GOOD;
} }
// sets up register for coarse gain calibration // sets up register for coarse gain calibration

Wyświetl plik

@ -2147,11 +2147,9 @@ static void gl646_slow_back_home(Genesys_Device* dev, SANE_Bool wait_until_home)
* @param dev device stucture describing the scanner * @param dev device stucture describing the scanner
* @return SANE_STATUS_GOOD in cas of success, else failure code * @return SANE_STATUS_GOOD in cas of success, else failure code
*/ */
static SANE_Status static void gl646_search_start_position(Genesys_Device* dev)
gl646_search_start_position (Genesys_Device * dev)
{ {
DBG_HELPER(dbg); DBG_HELPER(dbg);
SANE_Status status = SANE_STATUS_GOOD;
Genesys_Settings settings; Genesys_Settings settings;
unsigned int resolution, x, y; unsigned int resolution, x, y;
@ -2208,8 +2206,6 @@ gl646_search_start_position (Genesys_Device * dev)
// now search reference points on the data // now search reference points on the data
sanei_genesys_search_reference_point(dev, sensor, data.data(), sensor.CCD_start_xoffset, sanei_genesys_search_reference_point(dev, sensor, data.data(), sensor.CCD_start_xoffset,
resolution, settings.pixels, settings.lines); resolution, settings.pixels, settings.lines);
return status;
} }
/** /**

Wyświetl plik

@ -2975,10 +2975,9 @@ static void gl841_slow_back_home(Genesys_Device* dev, SANE_Bool wait_until_home)
DBG(DBG_info, "%s: scanhead is still moving\n", __func__); DBG(DBG_info, "%s: scanhead is still moving\n", __func__);
} }
/* Automatically set top-left edge of the scan area by scanning a 200x200 pixels // Automatically set top-left edge of the scan area by scanning a 200x200 pixels area at 600 dpi
area at 600 dpi from very top of scanner */ // from very top of scanner
static SANE_Status static void gl841_search_start_position(Genesys_Device* dev)
gl841_search_start_position (Genesys_Device * dev)
{ {
DBG_HELPER(dbg); DBG_HELPER(dbg);
int size; int size;
@ -3047,8 +3046,6 @@ gl841_search_start_position (Genesys_Device * dev)
// and use that correctly // and use that correctly
sanei_genesys_search_reference_point(dev, sensor, data.data(), 0, dpi, pixels, sanei_genesys_search_reference_point(dev, sensor, data.data(), 0, dpi, pixels,
dev->model->search_lines); dev->model->search_lines);
return SANE_STATUS_GOOD;
} }
// sets up register for coarse gain calibration // sets up register for coarse gain calibration

Wyświetl plik

@ -2373,10 +2373,9 @@ static void gl843_slow_back_home(Genesys_Device* dev, SANE_Bool wait_until_home)
DBG(DBG_info, "%s: scanhead is still moving\n", __func__); DBG(DBG_info, "%s: scanhead is still moving\n", __func__);
} }
/* Automatically set top-left edge of the scan area by scanning a 200x200 pixels // Automatically set top-left edge of the scan area by scanning a 200x200 pixels area at 600 dpi
area at 600 dpi from very top of scanner */ // from very top of scanner
static SANE_Status static void gl843_search_start_position(Genesys_Device* dev)
gl843_search_start_position (Genesys_Device * dev)
{ {
DBG_HELPER(dbg); DBG_HELPER(dbg);
int size; int size;
@ -2446,8 +2445,6 @@ gl843_search_start_position (Genesys_Device * dev)
sanei_genesys_search_reference_point(dev, sensor, data.data(), 0, dpi, pixels, sanei_genesys_search_reference_point(dev, sensor, data.data(), 0, dpi, pixels,
dev->model->search_lines); dev->model->search_lines);
return SANE_STATUS_GOOD;
} }
// sets up register for coarse gain calibration // sets up register for coarse gain calibration

Wyświetl plik

@ -1578,10 +1578,9 @@ static void gl846_slow_back_home(Genesys_Device* dev, SANE_Bool wait_until_home
DBG(DBG_info, "%s: scanhead is still moving\n", __func__); DBG(DBG_info, "%s: scanhead is still moving\n", __func__);
} }
/* Automatically set top-left edge of the scan area by scanning a 200x200 pixels // Automatically set top-left edge of the scan area by scanning a 200x200 pixels area at 600 dpi
area at 600 dpi from very top of scanner */ // from very top of scanner
static SANE_Status static void gl846_search_start_position(Genesys_Device* dev)
gl846_search_start_position (Genesys_Device * dev)
{ {
DBG_HELPER(dbg); DBG_HELPER(dbg);
int size; int size;
@ -1649,8 +1648,6 @@ gl846_search_start_position (Genesys_Device * dev)
// and use that correctly // and use that correctly
sanei_genesys_search_reference_point(dev, sensor, data.data(), 0, dpi, pixels, sanei_genesys_search_reference_point(dev, sensor, data.data(), 0, dpi, pixels,
dev->model->search_lines); dev->model->search_lines);
return SANE_STATUS_GOOD;
} }
// sets up register for coarse gain calibration // sets up register for coarse gain calibration

Wyświetl plik

@ -1639,10 +1639,9 @@ static void gl847_slow_back_home(Genesys_Device* dev, SANE_Bool wait_until_home)
DBG(DBG_info, "%s: scanhead is still moving\n", __func__); DBG(DBG_info, "%s: scanhead is still moving\n", __func__);
} }
/* Automatically set top-left edge of the scan area by scanning a 200x200 pixels // Automatically set top-left edge of the scan area by scanning a 200x200 pixels area at 600 dpi
area at 600 dpi from very top of scanner */ // from very top of scanner
static SANE_Status static void gl847_search_start_position(Genesys_Device* dev)
gl847_search_start_position (Genesys_Device * dev)
{ {
DBG_HELPER(dbg); DBG_HELPER(dbg);
int size; int size;
@ -1710,8 +1709,6 @@ gl847_search_start_position (Genesys_Device * dev)
// and use that correctly // and use that correctly
sanei_genesys_search_reference_point(dev, sensor, data.data(), 0, dpi, pixels, sanei_genesys_search_reference_point(dev, sensor, data.data(), 0, dpi, pixels,
dev->model->search_lines); dev->model->search_lines);
return SANE_STATUS_GOOD;
} }
// sets up register for coarse gain calibration // sets up register for coarse gain calibration

Wyświetl plik

@ -1075,7 +1075,7 @@ struct Genesys_Command_Set
*/ */
void (*send_gamma_table) (Genesys_Device* dev, const Genesys_Sensor& sensor); void (*send_gamma_table) (Genesys_Device* dev, const Genesys_Sensor& sensor);
SANE_Status (*search_start_position) (Genesys_Device * dev); void (*search_start_position) (Genesys_Device* dev);
SANE_Status (*offset_calibration) (Genesys_Device * dev, const Genesys_Sensor& sensor, SANE_Status (*offset_calibration) (Genesys_Device * dev, const Genesys_Sensor& sensor,
Genesys_Register_Set& regs); Genesys_Register_Set& regs);
SANE_Status (*coarse_gain_calibration) (Genesys_Device * dev, SANE_Status (*coarse_gain_calibration) (Genesys_Device * dev,