kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Return errors as exceptions from *feed()
rodzic
104ad9b448
commit
075d733613
|
@ -1738,7 +1738,6 @@ gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
{
|
||||
DBG_HELPER_ARGS(dbg, "wait_until_home = %d", wait_until_home);
|
||||
Genesys_Register_Set local_reg;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
GenesysRegister *r;
|
||||
uint8_t val;
|
||||
float resolution;
|
||||
|
@ -1775,12 +1774,7 @@ gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
/* feed a little first */
|
||||
if (dev->model->model_id == MODEL_CANON_LIDE_210)
|
||||
{
|
||||
status = gl124_feed (dev, 20, SANE_TRUE);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to do initial feed: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl124_feed(dev, 20, SANE_TRUE);
|
||||
}
|
||||
|
||||
local_reg = dev->reg;
|
||||
|
@ -1866,8 +1860,7 @@ gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
* @param steps number of steps to move
|
||||
* @param reverse true is moving backward
|
||||
* */
|
||||
static SANE_Status
|
||||
gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse)
|
||||
static void gl124_feed(Genesys_Device* dev, unsigned int steps, int reverse)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "steps=%d", steps);
|
||||
Genesys_Register_Set local_reg;
|
||||
|
@ -1944,8 +1937,6 @@ gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse)
|
|||
|
||||
// then stop scanning
|
||||
gl124_stop_action(dev);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2191,8 +2182,6 @@ gl124_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
int move_dpi;
|
||||
float start;
|
||||
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
|
||||
debug_dump(DBG_info, dev->settings);
|
||||
|
||||
/* channels */
|
||||
|
@ -2215,12 +2204,7 @@ gl124_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
|
||||
if(channels*dev->settings.yres>=600 && move>700)
|
||||
{
|
||||
status = gl124_feed (dev, move-500, SANE_FALSE);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error, "%s: failed to move to scan area\n",__func__);
|
||||
return status;
|
||||
}
|
||||
gl124_feed(dev, move-500, SANE_FALSE);
|
||||
move=500;
|
||||
}
|
||||
DBG(DBG_info, "%s: move=%f steps\n", __func__, move);
|
||||
|
|
|
@ -477,7 +477,7 @@ static SANE_Status gl124_init(Genesys_Device * dev);
|
|||
static void gl124_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
uint8_t* data, int size);
|
||||
|
||||
static SANE_Status gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse);
|
||||
static void gl124_feed(Genesys_Device* dev, unsigned int steps, int reverse);
|
||||
|
||||
static void gl124_stop_action(Genesys_Device* dev);
|
||||
|
||||
|
|
|
@ -2830,13 +2830,11 @@ gl841_end_scan (Genesys_Device * dev, Genesys_Register_Set __sane_unused__ * reg
|
|||
return status;
|
||||
}
|
||||
|
||||
/* Moves the slider to steps */
|
||||
static SANE_Status
|
||||
gl841_feed (Genesys_Device * dev, int steps)
|
||||
// Moves the slider to steps
|
||||
static void gl841_feed(Genesys_Device* dev, int steps)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "steps = %d", steps);
|
||||
Genesys_Register_Set local_reg;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
uint8_t val;
|
||||
int loop;
|
||||
|
||||
|
@ -2876,7 +2874,7 @@ gl841_feed (Genesys_Device * dev, int steps)
|
|||
{
|
||||
DBG(DBG_proc, "%s: finished\n", __func__);
|
||||
dev->scanhead_position_in_steps += steps;
|
||||
return SANE_STATUS_GOOD;
|
||||
return;
|
||||
}
|
||||
sanei_genesys_sleep_ms(100);
|
||||
++loop;
|
||||
|
@ -2885,8 +2883,7 @@ gl841_feed (Genesys_Device * dev, int steps)
|
|||
/* when we come here then the scanner needed too much time for this, so we better stop the motor */
|
||||
gl841_stop_action (dev);
|
||||
|
||||
DBG(DBG_error, "%s: timeout while waiting for scanhead to go home\n", __func__);
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
throw SaneException(SANE_STATUS_IO_ERROR, "timeout while waiting for scanhead to go home");
|
||||
}
|
||||
|
||||
/* Moves the slider to the home (top) position slowly */
|
||||
|
@ -2895,7 +2892,6 @@ gl841_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
{
|
||||
DBG_HELPER_ARGS(dbg, "wait_until_home = %d", wait_until_home);
|
||||
Genesys_Register_Set local_reg;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
GenesysRegister *r;
|
||||
uint8_t val;
|
||||
int loop = 0;
|
||||
|
@ -3400,12 +3396,7 @@ gl841_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
move = SANE_UNFIX (dev->model->y_offset_calib);
|
||||
move = (move * (dev->motor.base_ydpi)) / MM_PER_INCH;
|
||||
DBG(DBG_io, "%s: move=%d lines\n", __func__, move);
|
||||
status = gl841_feed(dev, move);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to feed: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_feed(dev, move);
|
||||
}
|
||||
|
||||
/* offset calibration is always done in color mode */
|
||||
|
@ -4086,12 +4077,7 @@ gl841_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
move = SANE_UNFIX (dev->model->y_offset_calib);
|
||||
move = (move * (dev->motor.base_ydpi)) / MM_PER_INCH;
|
||||
DBG(DBG_io, "%s: move=%d lines\n", __func__, move);
|
||||
status = gl841_feed(dev, move);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to feed: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_feed(dev, move);
|
||||
}
|
||||
|
||||
/* coarse gain calibration is allways done in color mode */
|
||||
|
@ -4295,13 +4281,7 @@ sanei_gl841_repark_head (Genesys_Device * dev)
|
|||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
|
||||
status = gl841_feed(dev,232);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to feed: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_feed(dev,232);
|
||||
|
||||
/* toggle motor flag, put an huge step number and redo move backward */
|
||||
status = gl841_slow_back_home (dev, SANE_TRUE);
|
||||
|
|
|
@ -2226,7 +2226,6 @@ static SANE_Status gl843_park_xpa_lamp (Genesys_Device * dev)
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
Genesys_Register_Set local_reg;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
GenesysRegister *r;
|
||||
uint8_t val;
|
||||
int loop = 0;
|
||||
|
@ -2560,12 +2559,10 @@ gl843_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
* @param dev device to work on
|
||||
* @param steps number of steps to move
|
||||
* */
|
||||
static SANE_Status
|
||||
gl843_feed (Genesys_Device * dev, unsigned int steps)
|
||||
static void gl843_feed(Genesys_Device* dev, unsigned int steps)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
Genesys_Register_Set local_reg;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
GenesysRegister *r;
|
||||
float resolution;
|
||||
uint8_t val;
|
||||
|
@ -2629,8 +2626,6 @@ gl843_feed (Genesys_Device * dev, unsigned int steps)
|
|||
|
||||
// looks like the scanner locks up if we scan immediately after feeding
|
||||
sanei_genesys_sleep_ms(100);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static SANE_Status gl843_move_to_ta (Genesys_Device * dev);
|
||||
|
@ -3758,12 +3753,7 @@ gl843_move_to_ta (Genesys_Device * dev)
|
|||
|
||||
resolution=sanei_genesys_get_lowest_ydpi(dev);
|
||||
feed = 16*(SANE_UNFIX (dev->model->y_offset_sensor_to_ta) * resolution) / MM_PER_INCH;
|
||||
status = gl843_feed (dev, feed);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to move to XPA calibration area\n", __func__);
|
||||
return status;
|
||||
}
|
||||
gl843_feed(dev, feed);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -1483,7 +1483,6 @@ gl846_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
{
|
||||
DBG_HELPER_ARGS(dbg, "wait_until_home = %d", wait_until_home);
|
||||
Genesys_Register_Set local_reg;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
GenesysRegister *r;
|
||||
float resolution;
|
||||
uint8_t val;
|
||||
|
@ -1741,12 +1740,10 @@ gl846_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
* @param dev device to work on
|
||||
* @param steps number of steps to move in base_dpi line count
|
||||
* */
|
||||
static SANE_Status
|
||||
gl846_feed (Genesys_Device * dev, unsigned int steps)
|
||||
static void gl846_feed(Genesys_Device* dev, unsigned int steps)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "steps=%d\n", steps);
|
||||
Genesys_Register_Set local_reg;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
GenesysRegister *r;
|
||||
float resolution;
|
||||
uint8_t val;
|
||||
|
@ -1813,8 +1810,6 @@ gl846_feed (Genesys_Device * dev, unsigned int steps)
|
|||
|
||||
// then stop scanning
|
||||
gl846_stop_action(dev);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1888,8 +1883,6 @@ gl846_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
int move_dpi;
|
||||
float start;
|
||||
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
|
||||
debug_dump(DBG_info, dev->settings);
|
||||
|
||||
/* channels */
|
||||
|
@ -1938,12 +1931,7 @@ gl846_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
* move tuning */
|
||||
if(channels*dev->settings.yres>=600 && move>700)
|
||||
{
|
||||
status = gl846_feed (dev, move-500);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to move to scan area\n", __func__);
|
||||
return status;
|
||||
}
|
||||
gl846_feed(dev, move-500);
|
||||
move=500;
|
||||
}
|
||||
|
||||
|
@ -2104,7 +2092,7 @@ gl846_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
move = (move * (dev->motor.base_ydpi/4)) / MM_PER_INCH;
|
||||
if(move>20)
|
||||
{
|
||||
RIE(gl846_feed (dev, move));
|
||||
gl846_feed(dev, move);
|
||||
}
|
||||
DBG(DBG_io, "%s: move=%f steps\n", __func__, move);
|
||||
|
||||
|
|
|
@ -358,8 +358,7 @@ static SANE_Status gl846_init (Genesys_Device * dev);
|
|||
* @param dev device to work on
|
||||
* @param steps number of steps to move
|
||||
* */
|
||||
static SANE_Status
|
||||
gl846_feed (Genesys_Device * dev, unsigned int steps);
|
||||
static void gl846_feed(Genesys_Device* dev, unsigned int steps);
|
||||
|
||||
static void gl846_stop_action(Genesys_Device* dev);
|
||||
|
||||
|
|
|
@ -1545,7 +1545,6 @@ gl847_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
{
|
||||
DBG_HELPER_ARGS(dbg, "wait_until_home = %d", wait_until_home);
|
||||
Genesys_Register_Set local_reg;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
GenesysRegister *r;
|
||||
float resolution;
|
||||
uint8_t val;
|
||||
|
@ -1803,12 +1802,10 @@ gl847_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
* @param dev device to work on
|
||||
* @param steps number of steps to move in base_dpi line count
|
||||
* */
|
||||
static SANE_Status
|
||||
gl847_feed (Genesys_Device * dev, unsigned int steps)
|
||||
static void gl847_feed(Genesys_Device* dev, unsigned int steps)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "steps=%d", steps);
|
||||
Genesys_Register_Set local_reg;
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
GenesysRegister *r;
|
||||
float resolution;
|
||||
uint8_t val;
|
||||
|
@ -1874,8 +1871,6 @@ gl847_feed (Genesys_Device * dev, unsigned int steps)
|
|||
|
||||
// then stop scanning
|
||||
gl847_stop_action(dev);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1949,8 +1944,6 @@ gl847_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
int move_dpi;
|
||||
float start;
|
||||
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
|
||||
debug_dump(DBG_info, dev->settings);
|
||||
|
||||
/* channels */
|
||||
|
@ -1999,12 +1992,7 @@ gl847_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
* move tuning */
|
||||
if(channels*dev->settings.yres>=600 && move>700)
|
||||
{
|
||||
status = gl847_feed (dev, move-500);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to move to scan area\n", __func__);
|
||||
return status;
|
||||
}
|
||||
gl847_feed(dev, move-500);
|
||||
move=500;
|
||||
}
|
||||
|
||||
|
@ -2165,7 +2153,7 @@ gl847_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
move = (move * (dev->motor.base_ydpi/4)) / MM_PER_INCH;
|
||||
if(move>20)
|
||||
{
|
||||
RIE(gl847_feed (dev, move));
|
||||
gl847_feed(dev, move);
|
||||
}
|
||||
DBG(DBG_io, "%s: move=%f steps\n", __func__, move);
|
||||
|
||||
|
|
|
@ -342,8 +342,7 @@ static SANE_Status gl847_init (Genesys_Device * dev);
|
|||
* @param dev device to work on
|
||||
* @param steps number of steps to move
|
||||
* */
|
||||
static SANE_Status
|
||||
gl847_feed (Genesys_Device * dev, unsigned int steps);
|
||||
static void gl847_feed(Genesys_Device* dev, unsigned int steps);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue