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 )
* @return SANE_STATUS_GOOD if OK
*/
static SANE_Status
gl124_init_optical_regs_scan (Genesys_Device * dev,
const Genesys_Sensor& sensor,
Genesys_Register_Set * reg,
unsigned int exposure_time,
int used_res,
unsigned int start,
unsigned int pixels,
int channels,
int depth,
SANE_Bool half_ccd,
ColorFilter color_filter,
int flags)
static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set* reg, unsigned int exposure_time,
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, "
"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);
sanei_genesys_set_double(reg,REG_DUMMY,sensor.dummy_pixel);
return SANE_STATUS_GOOD;
}
/** 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;
}
/* now _LOGICAL_ optical values used are known, setup registers */
status = gl124_init_optical_regs_scan (dev,
sensor,
reg,
exposure_time,
used_res,
start,
used_pixels,
params.channels,
params.depth,
half_ccd,
params.color_filter,
oflags);
if (status != SANE_STATUS_GOOD)
return status;
// now _LOGICAL_ optical values used are known, setup registers
gl124_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
params.channels, params.depth, half_ccd, params.color_filter,
oflags);
/*** motor parameters ***/

Wyświetl plik

@ -1520,20 +1520,12 @@ gl841_init_optical_regs_off(Genesys_Register_Set * reg)
return SANE_STATUS_GOOD;
}
static SANE_Status
gl841_init_optical_regs_scan(Genesys_Device * dev,
const Genesys_Sensor& sensor,
Genesys_Register_Set * reg,
unsigned int exposure_time,
unsigned int used_res,
unsigned int start,
unsigned int pixels,
int channels,
int depth,
SANE_Bool half_ccd,
ColorFilter color_filter,
int flags
)
static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set* reg, unsigned int exposure_time,
unsigned 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, 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->value = sensor.dummy_pixel;
return SANE_STATUS_GOOD;
}
static int
@ -2049,21 +2039,9 @@ dummy \ scanned lines
oflags |= OPTICAL_FLAG_ENABLE_LEDADD;
}
status = gl841_init_optical_regs_scan(dev, sensor,
reg,
exposure_time,
used_res,
start,
used_pixels,
params.channels,
params.depth,
half_ccd,
params.color_filter,
oflags);
if (status != SANE_STATUS_GOOD)
{
return status;
}
gl841_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
params.channels, params.depth, half_ccd, params.color_filter,
oflags);
/*** 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 ...
* @return SANE_STATUS_GOOD if OK
*/
static SANE_Status
gl843_init_optical_regs_scan (Genesys_Device * dev,
const Genesys_Sensor& sensor,
Genesys_Register_Set * reg,
unsigned int exposure,
int used_res,
unsigned int start,
unsigned int pixels,
int channels,
int depth,
unsigned ccd_size_divisor,
ColorFilter color_filter,
int flags)
static void gl843_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set* reg, unsigned int exposure,
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, "
"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->value = sensor.dummy_pixel;
return SANE_STATUS_GOOD;
}
struct ScanSession {
@ -1467,20 +1457,11 @@ static SANE_Status gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Senso
oflags |= OPTICAL_FLAG_DISABLE_GAMMA;
}
/* now _LOGICAL_ optical values used are known, setup registers */
status = gl843_init_optical_regs_scan (dev, sensor,
reg,
exposure,
session.output_resolution,
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;
// now _LOGICAL_ optical values used are known, setup registers
gl843_init_optical_regs_scan(dev, sensor, reg, exposure, session.output_resolution, start,
session.optical_pixels, session.params.channels,
session.params.depth, session.ccd_size_divisor,
session.params.color_filter, oflags);
/*** motor parameters ***/

Wyświetl plik

@ -788,17 +788,11 @@ gl846_init_motor_regs_scan (Genesys_Device * dev,
0x38,0x39 LPERIOD
0x34 DUMMY
*/
static SANE_Status
gl846_init_optical_regs_scan (Genesys_Device * dev,
const Genesys_Sensor& sensor,
Genesys_Register_Set * reg,
unsigned int exposure_time,
int used_res,
unsigned int start,
unsigned int pixels,
int channels,
int depth,
SANE_Bool half_ccd, ColorFilter color_filter, int flags)
static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set* reg, unsigned int exposure_time,
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, "
"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->value = sensor.dummy_pixel;
return SANE_STATUS_GOOD;
}
/* 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;
}
status = gl846_init_optical_regs_scan (dev, sensor,
reg,
exposure_time,
used_res,
start,
used_pixels,
params.channels,
params.depth,
half_ccd,
params.color_filter,
oflags);
if (status != SANE_STATUS_GOOD)
return status;
gl846_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
params.channels, params.depth, half_ccd, params.color_filter,
oflags);
/*** motor parameters ***/

Wyświetl plik

@ -801,17 +801,11 @@ gl847_init_motor_regs_scan (Genesys_Device * dev,
0x38,0x39 LPERIOD
0x34 DUMMY
*/
static SANE_Status
gl847_init_optical_regs_scan (Genesys_Device * dev,
const Genesys_Sensor& sensor,
Genesys_Register_Set * reg,
unsigned int exposure_time,
int used_res,
unsigned int start,
unsigned int pixels,
int channels,
int depth,
SANE_Bool half_ccd, ColorFilter color_filter, int flags)
static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
Genesys_Register_Set* reg, unsigned int exposure_time,
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, 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->value = sensor.dummy_pixel;
return SANE_STATUS_GOOD;
}
/* 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;
}
status = gl847_init_optical_regs_scan (dev, sensor,
reg,
exposure_time,
used_res,
start,
used_pixels,
params.channels,
params.depth,
half_ccd,
params.color_filter,
oflags);
if (status != SANE_STATUS_GOOD)
return status;
gl847_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
params.channels, params.depth, half_ccd, params.color_filter,
oflags);
/*** motor parameters ***/