genesys: Return errors as exceptions from *init_optical_regs_scan()

merge-requests/101/head
Povilas Kanapickas 2019-07-14 23:41:03 +03:00
rodzic 876b7bba4e
commit 7d9f4d2c58
5 zmienionych plików z 44 dodań i 144 usunięć

Wyświetl plik

@ -921,19 +921,11 @@ static void gl124_setup_sensor(Genesys_Device * dev,
* @param flags optical flags (@see ) * @param flags optical flags (@see )
* @return SANE_STATUS_GOOD if OK * @return SANE_STATUS_GOOD if OK
*/ */
static SANE_Status static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
gl124_init_optical_regs_scan (Genesys_Device * dev, Genesys_Register_Set* reg, unsigned int exposure_time,
const Genesys_Sensor& sensor, int used_res, unsigned int start, unsigned int pixels,
Genesys_Register_Set * reg, int channels, int depth, SANE_Bool half_ccd,
unsigned int exposure_time, ColorFilter color_filter, int flags)
int used_res,
unsigned int start,
unsigned int pixels,
int channels,
int depth,
SANE_Bool half_ccd,
ColorFilter color_filter,
int flags)
{ {
DBG_HELPER_ARGS(dbg, "exposure_time=%d, used_res=%d, start=%d, pixels=%d, channels=%d, depth=%d, " DBG_HELPER_ARGS(dbg, "exposure_time=%d, used_res=%d, start=%d, pixels=%d, channels=%d, depth=%d, "
"half_ccd=%d, flags=%x\n", "half_ccd=%d, flags=%x\n",
@ -1174,8 +1166,6 @@ gl124_init_optical_regs_scan (Genesys_Device * dev,
DBG (DBG_io2, "%s: exposure_time used=%d\n", __func__, exposure_time); DBG (DBG_io2, "%s: exposure_time used=%d\n", __func__, exposure_time);
sanei_genesys_set_double(reg,REG_DUMMY,sensor.dummy_pixel); sanei_genesys_set_double(reg,REG_DUMMY,sensor.dummy_pixel);
return SANE_STATUS_GOOD;
} }
/** set up registers for an actual scan /** set up registers for an actual scan
@ -1309,21 +1299,10 @@ gl124_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys
oflags |= OPTICAL_FLAG_ENABLE_LEDADD; oflags |= OPTICAL_FLAG_ENABLE_LEDADD;
} }
/* now _LOGICAL_ optical values used are known, setup registers */ // now _LOGICAL_ optical values used are known, setup registers
status = gl124_init_optical_regs_scan (dev, gl124_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
sensor, params.channels, params.depth, half_ccd, params.color_filter,
reg, oflags);
exposure_time,
used_res,
start,
used_pixels,
params.channels,
params.depth,
half_ccd,
params.color_filter,
oflags);
if (status != SANE_STATUS_GOOD)
return status;
/*** motor parameters ***/ /*** motor parameters ***/

Wyświetl plik

@ -1520,20 +1520,12 @@ gl841_init_optical_regs_off(Genesys_Register_Set * reg)
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
static SANE_Status static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
gl841_init_optical_regs_scan(Genesys_Device * dev, Genesys_Register_Set* reg, unsigned int exposure_time,
const Genesys_Sensor& sensor, unsigned int used_res, unsigned int start,
Genesys_Register_Set * reg, unsigned int pixels, int channels,
unsigned int exposure_time, int depth, SANE_Bool half_ccd, ColorFilter color_filter,
unsigned int used_res, int flags)
unsigned int start,
unsigned int pixels,
int channels,
int depth,
SANE_Bool half_ccd,
ColorFilter color_filter,
int flags
)
{ {
DBG_HELPER_ARGS(dbg, "exposure_time=%d, used_res=%d, start=%d, pixels=%d, channels=%d, " DBG_HELPER_ARGS(dbg, "exposure_time=%d, used_res=%d, start=%d, pixels=%d, channels=%d, "
"depth=%d, half_ccd=%d, flags=%x", "depth=%d, half_ccd=%d, flags=%x",
@ -1727,8 +1719,6 @@ gl841_init_optical_regs_scan(Genesys_Device * dev,
r = sanei_genesys_get_address (reg, 0x34); r = sanei_genesys_get_address (reg, 0x34);
r->value = sensor.dummy_pixel; r->value = sensor.dummy_pixel;
return SANE_STATUS_GOOD;
} }
static int static int
@ -2049,21 +2039,9 @@ dummy \ scanned lines
oflags |= OPTICAL_FLAG_ENABLE_LEDADD; oflags |= OPTICAL_FLAG_ENABLE_LEDADD;
} }
status = gl841_init_optical_regs_scan(dev, sensor, gl841_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
reg, params.channels, params.depth, half_ccd, params.color_filter,
exposure_time, oflags);
used_res,
start,
used_pixels,
params.channels,
params.depth,
half_ccd,
params.color_filter,
oflags);
if (status != SANE_STATUS_GOOD)
{
return status;
}
/*** motor parameters ***/ /*** motor parameters ***/

Wyświetl plik

@ -1059,19 +1059,11 @@ gl843_init_motor_regs_scan (Genesys_Device * dev,
* @param flags to drive specific settings such no calibration, XPA use ... * @param flags to drive specific settings such no calibration, XPA use ...
* @return SANE_STATUS_GOOD if OK * @return SANE_STATUS_GOOD if OK
*/ */
static SANE_Status static void gl843_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
gl843_init_optical_regs_scan (Genesys_Device * dev, Genesys_Register_Set* reg, unsigned int exposure,
const Genesys_Sensor& sensor, int used_res, unsigned int start, unsigned int pixels,
Genesys_Register_Set * reg, int channels, int depth, unsigned ccd_size_divisor,
unsigned int exposure, ColorFilter color_filter, int flags)
int used_res,
unsigned int start,
unsigned int pixels,
int channels,
int depth,
unsigned ccd_size_divisor,
ColorFilter color_filter,
int flags)
{ {
DBG_HELPER_ARGS(dbg, "exposure=%d, used_res=%d, start=%d, pixels=%d, channels=%d, depth=%d, " DBG_HELPER_ARGS(dbg, "exposure=%d, used_res=%d, start=%d, pixels=%d, channels=%d, depth=%d, "
"ccd_size_divisor=%d, flags=%x", "ccd_size_divisor=%d, flags=%x",
@ -1270,8 +1262,6 @@ gl843_init_optical_regs_scan (Genesys_Device * dev,
r = sanei_genesys_get_address (reg, REG_DUMMY); r = sanei_genesys_get_address (reg, REG_DUMMY);
r->value = sensor.dummy_pixel; r->value = sensor.dummy_pixel;
return SANE_STATUS_GOOD;
} }
struct ScanSession { struct ScanSession {
@ -1467,20 +1457,11 @@ static SANE_Status gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Senso
oflags |= OPTICAL_FLAG_DISABLE_GAMMA; oflags |= OPTICAL_FLAG_DISABLE_GAMMA;
} }
/* now _LOGICAL_ optical values used are known, setup registers */ // now _LOGICAL_ optical values used are known, setup registers
status = gl843_init_optical_regs_scan (dev, sensor, gl843_init_optical_regs_scan(dev, sensor, reg, exposure, session.output_resolution, start,
reg, session.optical_pixels, session.params.channels,
exposure, session.params.depth, session.ccd_size_divisor,
session.output_resolution, session.params.color_filter, oflags);
start,
session.optical_pixels,
session.params.channels,
session.params.depth,
session.ccd_size_divisor,
session.params.color_filter,
oflags);
if (status != SANE_STATUS_GOOD)
return status;
/*** motor parameters ***/ /*** motor parameters ***/

Wyświetl plik

@ -788,17 +788,11 @@ gl846_init_motor_regs_scan (Genesys_Device * dev,
0x38,0x39 LPERIOD 0x38,0x39 LPERIOD
0x34 DUMMY 0x34 DUMMY
*/ */
static SANE_Status static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
gl846_init_optical_regs_scan (Genesys_Device * dev, Genesys_Register_Set* reg, unsigned int exposure_time,
const Genesys_Sensor& sensor, int used_res, unsigned int start, unsigned int pixels,
Genesys_Register_Set * reg, int channels, int depth, SANE_Bool half_ccd,
unsigned int exposure_time, ColorFilter color_filter, int flags)
int used_res,
unsigned int start,
unsigned int pixels,
int channels,
int depth,
SANE_Bool half_ccd, ColorFilter color_filter, int flags)
{ {
DBG_HELPER_ARGS(dbg, "exposure_time=%d, used_res=%d, start=%d, pixels=%d, channels=%d, depth=%d, " DBG_HELPER_ARGS(dbg, "exposure_time=%d, used_res=%d, start=%d, pixels=%d, channels=%d, depth=%d, "
"half_ccd=%d, flags=%x", "half_ccd=%d, flags=%x",
@ -1019,8 +1013,6 @@ gl846_init_optical_regs_scan (Genesys_Device * dev,
r = sanei_genesys_get_address (reg, 0x34); r = sanei_genesys_get_address (reg, 0x34);
r->value = sensor.dummy_pixel; r->value = sensor.dummy_pixel;
return SANE_STATUS_GOOD;
} }
/* set up registers for an actual scan /* set up registers for an actual scan
@ -1149,20 +1141,9 @@ gl846_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys
oflags |= OPTICAL_FLAG_ENABLE_LEDADD; oflags |= OPTICAL_FLAG_ENABLE_LEDADD;
} }
status = gl846_init_optical_regs_scan (dev, sensor, gl846_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
reg, params.channels, params.depth, half_ccd, params.color_filter,
exposure_time, oflags);
used_res,
start,
used_pixels,
params.channels,
params.depth,
half_ccd,
params.color_filter,
oflags);
if (status != SANE_STATUS_GOOD)
return status;
/*** motor parameters ***/ /*** motor parameters ***/

Wyświetl plik

@ -801,17 +801,11 @@ gl847_init_motor_regs_scan (Genesys_Device * dev,
0x38,0x39 LPERIOD 0x38,0x39 LPERIOD
0x34 DUMMY 0x34 DUMMY
*/ */
static SANE_Status static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
gl847_init_optical_regs_scan (Genesys_Device * dev, Genesys_Register_Set* reg, unsigned int exposure_time,
const Genesys_Sensor& sensor, int used_res, unsigned int start, unsigned int pixels,
Genesys_Register_Set * reg, int channels, int depth, SANE_Bool half_ccd,
unsigned int exposure_time, ColorFilter color_filter, int flags)
int used_res,
unsigned int start,
unsigned int pixels,
int channels,
int depth,
SANE_Bool half_ccd, ColorFilter color_filter, int flags)
{ {
DBG_HELPER_ARGS(dbg, "exposure_time=%d, used_res=%d, start=%d, pixels=%d, channels=%d, " DBG_HELPER_ARGS(dbg, "exposure_time=%d, used_res=%d, start=%d, pixels=%d, channels=%d, "
"depth=%d, half_ccd=%d, flags=%x", "depth=%d, half_ccd=%d, flags=%x",
@ -1033,8 +1027,6 @@ gl847_init_optical_regs_scan (Genesys_Device * dev,
r = sanei_genesys_get_address (reg, 0x34); r = sanei_genesys_get_address (reg, 0x34);
r->value = sensor.dummy_pixel; r->value = sensor.dummy_pixel;
return SANE_STATUS_GOOD;
} }
/* set up registers for an actual scan /* set up registers for an actual scan
@ -1164,20 +1156,9 @@ gl847_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys
oflags |= OPTICAL_FLAG_ENABLE_LEDADD; oflags |= OPTICAL_FLAG_ENABLE_LEDADD;
} }
status = gl847_init_optical_regs_scan (dev, sensor, gl847_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
reg, params.channels, params.depth, half_ccd, params.color_filter,
exposure_time, oflags);
used_res,
start,
used_pixels,
params.channels,
params.depth,
half_ccd,
params.color_filter,
oflags);
if (status != SANE_STATUS_GOOD)
return status;
/*** motor parameters ***/ /*** motor parameters ***/