kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Return errors as exceptions from *stop_action()
rodzic
fa6e4ab4c3
commit
8a3b5a88a5
|
@ -1523,8 +1523,7 @@ static void gl124_start_action(Genesys_Device* dev)
|
|||
sanei_genesys_write_register(dev, 0x0f, 0x01);
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
gl124_stop_action (Genesys_Device * dev)
|
||||
static void gl124_stop_action(Genesys_Device* dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t val40, val;
|
||||
|
@ -1545,7 +1544,7 @@ gl124_stop_action (Genesys_Device * dev)
|
|||
if (!(val40 & REG100_DATAENB) && !(val40 & REG100_MOTMFLG))
|
||||
{
|
||||
DBG (DBG_info, "%s: already stopped\n", __func__);
|
||||
return SANE_STATUS_GOOD;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ends scan */
|
||||
|
@ -1570,14 +1569,14 @@ gl124_stop_action (Genesys_Device * dev)
|
|||
if (!(val40 & REG100_DATAENB) && !(val40 & REG100_MOTMFLG)
|
||||
&& !(val & MOTORENB))
|
||||
{
|
||||
return SANE_STATUS_GOOD;
|
||||
return;
|
||||
}
|
||||
|
||||
sanei_genesys_sleep_ms(100);
|
||||
loop--;
|
||||
}
|
||||
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
throw SaneException(SANE_STATUS_IO_ERROR, "could not stop motor");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1689,12 +1688,7 @@ gl124_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg,
|
|||
}
|
||||
else /* flat bed scanners */
|
||||
{
|
||||
status = gl124_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl124_stop_action(dev);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -1883,7 +1877,6 @@ gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse)
|
|||
{
|
||||
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;
|
||||
|
@ -1955,8 +1948,8 @@ gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse)
|
|||
sanei_genesys_get_status(dev, &val);
|
||||
} while (!(val & FEEDFSH));
|
||||
|
||||
/* then stop scanning */
|
||||
RIE(gl124_stop_action (dev));
|
||||
// then stop scanning
|
||||
gl124_stop_action(dev);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
@ -2442,8 +2435,8 @@ move_to_calibration_area (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
RIE(gl124_begin_scan (dev, sensor, ®s, SANE_TRUE));
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, line.data(), size));
|
||||
|
||||
/* stop scanning */
|
||||
RIE(gl124_stop_action (dev));
|
||||
// stop scanning
|
||||
gl124_stop_action(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
@ -2544,8 +2537,8 @@ gl124_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
RIE(gl124_begin_scan (dev, sensor, ®s, SANE_TRUE));
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, line.data(), total_size));
|
||||
|
||||
/* stop scanning */
|
||||
RIE(gl124_stop_action (dev));
|
||||
// stop scanning
|
||||
gl124_stop_action(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
@ -2939,7 +2932,7 @@ gl124_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
dev->frontend.set_gain(2, dev->frontend.get_gain(1));
|
||||
}
|
||||
|
||||
RIE (gl124_stop_action (dev));
|
||||
gl124_stop_action(dev);
|
||||
|
||||
status = gl124_slow_back_home (dev, SANE_TRUE);
|
||||
|
||||
|
|
|
@ -480,8 +480,7 @@ static void gl124_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
|
|||
|
||||
static SANE_Status gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse);
|
||||
|
||||
static SANE_Status
|
||||
gl124_stop_action (Genesys_Device * dev);
|
||||
static void gl124_stop_action(Genesys_Device* dev);
|
||||
|
||||
static void gl124_send_slope_table(Genesys_Device* dev, int table_nr, uint16_t* slope_table,
|
||||
int steps);
|
||||
|
|
|
@ -2481,8 +2481,7 @@ static void gl841_start_action(Genesys_Device* dev)
|
|||
sanei_genesys_write_register(dev, 0x0f, 0x01);
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
gl841_stop_action (Genesys_Device * dev)
|
||||
static void gl841_stop_action(Genesys_Device* dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
Genesys_Register_Set local_reg;
|
||||
|
@ -2501,7 +2500,7 @@ gl841_stop_action (Genesys_Device * dev)
|
|||
if (!(val40 & REG40_DATAENB) && !(val40 & REG40_MOTMFLG))
|
||||
{
|
||||
DBG(DBG_info, "%s: already stopped\n", __func__);
|
||||
return SANE_STATUS_GOOD;
|
||||
return;
|
||||
}
|
||||
|
||||
local_reg = dev->reg;
|
||||
|
@ -2525,14 +2524,14 @@ gl841_stop_action (Genesys_Device * dev)
|
|||
/* if scanner is in command mode, we are done */
|
||||
if (!(val40 & REG40_DATAENB) && !(val40 & REG40_MOTMFLG))
|
||||
{
|
||||
return SANE_STATUS_GOOD;
|
||||
return;
|
||||
}
|
||||
|
||||
sanei_genesys_sleep_ms(100);
|
||||
loop--;
|
||||
}
|
||||
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
throw SaneException(SANE_STATUS_IO_ERROR, "could not stop motor");
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
|
@ -2572,12 +2571,7 @@ gl841_eject_document (Genesys_Device * dev)
|
|||
|
||||
sanei_genesys_get_status(dev, &val);
|
||||
|
||||
status = gl841_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop motor: %s\n", __func__, sane_strstatus(status));
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
gl841_stop_action(dev);
|
||||
|
||||
local_reg = dev->reg;
|
||||
|
||||
|
@ -2663,12 +2657,7 @@ gl841_eject_document (Genesys_Device * dev)
|
|||
++loop;
|
||||
}
|
||||
|
||||
status = gl841_stop_action(dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop motor: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_stop_action(dev);
|
||||
|
||||
dev->document = SANE_FALSE;
|
||||
|
||||
|
@ -2839,12 +2828,7 @@ gl841_end_scan (Genesys_Device * dev, Genesys_Register_Set __sane_unused__ * reg
|
|||
}
|
||||
else /* flat bed scanners */
|
||||
{
|
||||
status = gl841_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_stop_action(dev);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -2860,12 +2844,7 @@ gl841_feed (Genesys_Device * dev, int steps)
|
|||
uint8_t val;
|
||||
int loop;
|
||||
|
||||
status = gl841_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop action: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_stop_action(dev);
|
||||
|
||||
// FIXME: we should pick sensor according to the resolution scanner is currently operating on
|
||||
const auto& sensor = sanei_genesys_find_sensor_any(dev);
|
||||
|
@ -2979,12 +2958,7 @@ gl841_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
/* if motor is on, stop current action */
|
||||
if (val & REG41_MOTORENB)
|
||||
{
|
||||
status = gl841_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop motor: %s\n", __func__, sane_strstatus(status));
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
gl841_stop_action(dev);
|
||||
}
|
||||
|
||||
local_reg = dev->reg;
|
||||
|
@ -3602,7 +3576,7 @@ gl841_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
}
|
||||
}
|
||||
|
||||
RIE (gl841_stop_action (dev));
|
||||
gl841_stop_action(dev);
|
||||
|
||||
turn++;
|
||||
|
||||
|
@ -3895,7 +3869,7 @@ gl841_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
offl[2] = offl[1] = offl[0];
|
||||
}
|
||||
|
||||
RIE(gl841_stop_action(dev));
|
||||
gl841_stop_action(dev);
|
||||
|
||||
turn++;
|
||||
} while (!acceptable && turn < 100);
|
||||
|
@ -3997,7 +3971,7 @@ gl841_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
offl[2] = offl[1] = offl[0];
|
||||
}
|
||||
|
||||
RIE(gl841_stop_action (dev));
|
||||
gl841_stop_action(dev);
|
||||
|
||||
turn++;
|
||||
|
||||
|
@ -4254,7 +4228,7 @@ gl841_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
dev->frontend.get_gain(1),
|
||||
dev->frontend.get_gain(2));
|
||||
|
||||
RIE (gl841_stop_action (dev));
|
||||
gl841_stop_action(dev);
|
||||
|
||||
gl841_slow_back_home(dev, SANE_TRUE);
|
||||
|
||||
|
@ -4585,12 +4559,7 @@ gl841_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
}
|
||||
|
||||
gl841_set_fe(dev, sensor, AFE_SET);
|
||||
status = gl841_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl841_stop_action(dev);
|
||||
|
||||
// set up for a gray scan at lowest dpi
|
||||
unsigned dpi = *std::min_element(dev->model->xdpi_values.begin(),
|
||||
|
@ -4659,12 +4628,7 @@ gl841_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
return status;
|
||||
}
|
||||
|
||||
status = gl841_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: gl841_stop_action failed\n", __func__);
|
||||
return status;
|
||||
}
|
||||
gl841_stop_action(dev);
|
||||
|
||||
pass = 0;
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
|
@ -4701,12 +4665,7 @@ gl841_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
return status;
|
||||
}
|
||||
|
||||
status = gl841_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: gl841_stop_action failed\n", __func__);
|
||||
return status;
|
||||
}
|
||||
gl841_stop_action (dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
|
|
@ -1713,8 +1713,7 @@ static void gl843_start_action(Genesys_Device* dev)
|
|||
sanei_genesys_write_register(dev, 0x0f, 0x01);
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
gl843_stop_action_no_move(Genesys_Device* dev, Genesys_Register_Set* reg)
|
||||
static void gl843_stop_action_no_move(Genesys_Device* dev, Genesys_Register_Set* reg)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t val = sanei_genesys_read_reg_from_set(reg, REG01);
|
||||
|
@ -1722,11 +1721,9 @@ gl843_stop_action_no_move(Genesys_Device* dev, Genesys_Register_Set* reg)
|
|||
sanei_genesys_set_reg_from_set(reg, REG01, val);
|
||||
sanei_genesys_write_register(dev, REG01, val);
|
||||
sanei_genesys_sleep_ms(100);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
gl843_stop_action (Genesys_Device * dev)
|
||||
static void gl843_stop_action(Genesys_Device* dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t val40, val;
|
||||
|
@ -1745,7 +1742,7 @@ gl843_stop_action (Genesys_Device * dev)
|
|||
if (!(val40 & REG40_DATAENB) && !(val40 & REG40_MOTMFLG))
|
||||
{
|
||||
DBG(DBG_info, "%s: already stopped\n", __func__);
|
||||
return SANE_STATUS_GOOD;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ends scan 646 */
|
||||
|
@ -1771,14 +1768,14 @@ gl843_stop_action (Genesys_Device * dev)
|
|||
if (!(val40 & REG40_DATAENB) && !(val40 & REG40_MOTMFLG)
|
||||
&& !(val & REG41_MOTORENB))
|
||||
{
|
||||
return SANE_STATUS_GOOD;
|
||||
return;
|
||||
}
|
||||
|
||||
sanei_genesys_sleep_ms(100);
|
||||
loop--;
|
||||
}
|
||||
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
throw SaneException(SANE_STATUS_IO_ERROR, "could not stop motor");
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
|
@ -2222,12 +2219,7 @@ gl843_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg,
|
|||
}
|
||||
else /* flat bed scanners */
|
||||
{
|
||||
status = gl843_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl843_stop_action(dev);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -2493,7 +2485,7 @@ gl843_search_start_position (Genesys_Device * dev)
|
|||
DBG(DBG_error, "%s: failed to read data: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
RIE(gl843_stop_action_no_move(dev, &local_reg));
|
||||
gl843_stop_action_no_move(dev, &local_reg);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
sanei_genesys_write_pnm_file("gl843_search_position.pnm", data.data(), 8, 1, pixels,
|
||||
|
@ -2985,7 +2977,7 @@ gl843_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
DBG(DBG_info, "%s: starting first line reading\n", __func__);
|
||||
RIE (gl843_begin_scan(dev, calib_sensor, ®s, SANE_TRUE));
|
||||
RIE (sanei_genesys_read_data_from_scanner(dev, line.data(), total_size));
|
||||
RIE(gl843_stop_action_no_move(dev, ®s));
|
||||
gl843_stop_action_no_move(dev, ®s);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
@ -3055,7 +3047,7 @@ gl843_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
|
||||
}
|
||||
|
||||
RIE (gl843_stop_action (dev));
|
||||
gl843_stop_action (dev);
|
||||
|
||||
turn++;
|
||||
|
||||
|
@ -3211,7 +3203,7 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
DBG(DBG_info, "%s: starting first line reading\n", __func__);
|
||||
RIE(gl843_begin_scan(dev, calib_sensor, ®s, SANE_TRUE));
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, first_line.data(), total_size));
|
||||
RIE(gl843_stop_action_no_move(dev, ®s));
|
||||
gl843_stop_action_no_move(dev, ®s);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
@ -3240,7 +3232,7 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
DBG(DBG_info, "%s: starting second line reading\n", __func__);
|
||||
RIE(gl843_begin_scan(dev, calib_sensor, ®s, SANE_TRUE));
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size));
|
||||
RIE(gl843_stop_action_no_move(dev, ®s));
|
||||
gl843_stop_action_no_move(dev, ®s);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
|
@ -3276,7 +3268,7 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
DBG(DBG_info, "%s: starting second line reading\n", __func__);
|
||||
RIE(gl843_begin_scan(dev, calib_sensor, ®s, SANE_TRUE));
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, second_line.data(), total_size));
|
||||
RIE(gl843_stop_action_no_move(dev, ®s));
|
||||
gl843_stop_action_no_move(dev, ®s);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
@ -3429,7 +3421,7 @@ gl843_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
gl843_set_fe(dev, calib_sensor, AFE_SET);
|
||||
RIE(gl843_begin_scan(dev, calib_sensor, ®s, SANE_TRUE));
|
||||
RIE(sanei_genesys_read_data_from_scanner (dev, line.data(), total_size));
|
||||
RIE(gl843_stop_action_no_move(dev, ®s));
|
||||
gl843_stop_action_no_move(dev, ®s);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
sanei_genesys_write_pnm_file("gl843_gain.pnm", line.data(), bpp, channels, pixels, lines);
|
||||
|
@ -3521,7 +3513,7 @@ gl843_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
dev->frontend.set_gain(2, dev->frontend.get_gain(1));
|
||||
}
|
||||
|
||||
RIE (gl843_stop_action (dev));
|
||||
gl843_stop_action(dev);
|
||||
|
||||
status=gl843_slow_back_home (dev, SANE_TRUE);
|
||||
|
||||
|
@ -3811,12 +3803,7 @@ gl843_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
GenesysRegister *r;
|
||||
|
||||
gl843_set_fe(dev, sensor, AFE_SET);
|
||||
status = gl843_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl843_stop_action(dev);
|
||||
|
||||
/* set up for a gray scan at lowest dpi */
|
||||
dpi = sanei_genesys_get_lowest_dpi(dev);
|
||||
|
@ -3885,12 +3872,7 @@ gl843_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
return status;
|
||||
}
|
||||
|
||||
status = gl843_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: gl843_stop_action failed\n", __func__);
|
||||
return status;
|
||||
}
|
||||
gl843_stop_action(dev);
|
||||
|
||||
pass = 0;
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
|
@ -3928,12 +3910,7 @@ gl843_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
return status;
|
||||
}
|
||||
|
||||
status = gl843_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: gl843_stop_action failed\n", __func__);
|
||||
return status;
|
||||
}
|
||||
gl843_stop_action(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
|
|
@ -1366,11 +1366,9 @@ static void gl846_start_action(Genesys_Device* dev)
|
|||
sanei_genesys_write_register(dev, 0x0f, 0x01);
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
gl846_stop_action (Genesys_Device * dev)
|
||||
static void gl846_stop_action(Genesys_Device* dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
uint8_t val40, val;
|
||||
unsigned int loop;
|
||||
|
||||
|
@ -1383,17 +1381,12 @@ gl846_stop_action (Genesys_Device * dev)
|
|||
}
|
||||
|
||||
sanei_genesys_read_register(dev, REG40, &val40);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read home sensor: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
|
||||
/* only stop action if needed */
|
||||
if (!(val40 & REG40_DATAENB) && !(val40 & REG40_MOTMFLG))
|
||||
{
|
||||
DBG(DBG_info, "%s: already stopped\n", __func__);
|
||||
return SANE_STATUS_GOOD;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ends scan */
|
||||
|
@ -1417,14 +1410,14 @@ gl846_stop_action (Genesys_Device * dev)
|
|||
if (!(val40 & REG40_DATAENB) && !(val40 & REG40_MOTMFLG)
|
||||
&& !(val & REG41_MOTORENB))
|
||||
{
|
||||
return SANE_STATUS_GOOD;
|
||||
return;
|
||||
}
|
||||
|
||||
sanei_genesys_sleep_ms(100);
|
||||
loop--;
|
||||
}
|
||||
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
throw SaneException(SANE_STATUS_IO_ERROR, "could not stop motor");
|
||||
}
|
||||
|
||||
/* Send the low-level scan command */
|
||||
|
@ -1482,12 +1475,7 @@ gl846_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg,
|
|||
}
|
||||
else /* flat bed scanners */
|
||||
{
|
||||
status = gl846_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl846_stop_action(dev);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -1832,8 +1820,8 @@ gl846_feed (Genesys_Device * dev, unsigned int steps)
|
|||
sanei_genesys_get_status(dev, &val);
|
||||
} while (!(val & FEEDFSH));
|
||||
|
||||
/* then stop scanning */
|
||||
RIE(gl846_stop_action (dev));
|
||||
// then stop scanning
|
||||
gl846_stop_action(dev);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
@ -2192,8 +2180,8 @@ gl846_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
RIE(gl846_begin_scan(dev, sensor, ®s, SANE_TRUE));
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, line.data(), total_size));
|
||||
|
||||
/* stop scanning */
|
||||
RIE(gl846_stop_action(dev));
|
||||
// stop scanning
|
||||
gl846_stop_action(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
@ -2465,12 +2453,7 @@ gl846_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
|
||||
gl846_set_fe(dev, sensor, AFE_SET);
|
||||
|
||||
status = gl846_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl846_stop_action(dev);
|
||||
|
||||
// set up for a gray scan at lowest dpi
|
||||
unsigned dpi = *std::min_element(dev->model->xdpi_values.begin(),
|
||||
|
@ -2535,12 +2518,7 @@ gl846_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
return status;
|
||||
}
|
||||
|
||||
status = gl846_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: gl846_stop_action failed\n", __func__);
|
||||
return status;
|
||||
}
|
||||
gl846_stop_action(dev);
|
||||
|
||||
pass = 0;
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
|
@ -2577,12 +2555,7 @@ gl846_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
return status;
|
||||
}
|
||||
|
||||
status = gl846_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: gl846_stop_action failed\n", __func__);
|
||||
return status;
|
||||
}
|
||||
gl846_stop_action(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
@ -2988,7 +2961,7 @@ gl846_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
dev->frontend.set_gain(2, gain0);
|
||||
}
|
||||
|
||||
RIE (gl846_stop_action (dev));
|
||||
gl846_stop_action(dev);
|
||||
|
||||
status=gl846_slow_back_home (dev, SANE_TRUE);
|
||||
|
||||
|
|
|
@ -361,8 +361,7 @@ static SANE_Status gl846_init (Genesys_Device * dev);
|
|||
static SANE_Status
|
||||
gl846_feed (Genesys_Device * dev, unsigned int steps);
|
||||
|
||||
static SANE_Status
|
||||
gl846_stop_action (Genesys_Device * dev);
|
||||
static void gl846_stop_action(Genesys_Device* dev);
|
||||
|
||||
static SANE_Status
|
||||
gl846_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home);
|
||||
|
|
|
@ -1382,8 +1382,7 @@ static void gl847_start_action(Genesys_Device* dev)
|
|||
sanei_genesys_write_register(dev, 0x0f, 0x01);
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
gl847_stop_action (Genesys_Device * dev)
|
||||
static void gl847_stop_action(Genesys_Device* dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t val40, val;
|
||||
|
@ -1403,7 +1402,7 @@ gl847_stop_action (Genesys_Device * dev)
|
|||
if (!(val40 & REG40_DATAENB) && !(val40 & REG40_MOTMFLG))
|
||||
{
|
||||
DBG(DBG_info, "%s: already stopped\n", __func__);
|
||||
return SANE_STATUS_GOOD;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ends scan */
|
||||
|
@ -1428,14 +1427,14 @@ gl847_stop_action (Genesys_Device * dev)
|
|||
if (!(val40 & REG40_DATAENB) && !(val40 & REG40_MOTMFLG)
|
||||
&& !(val & REG41_MOTORENB))
|
||||
{
|
||||
return SANE_STATUS_GOOD;
|
||||
return;
|
||||
}
|
||||
|
||||
sanei_genesys_sleep_ms(100);
|
||||
loop--;
|
||||
}
|
||||
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
throw SaneException(SANE_STATUS_IO_ERROR, "could not stop motor");
|
||||
}
|
||||
|
||||
/* Send the low-level scan command */
|
||||
|
@ -1494,12 +1493,7 @@ gl847_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg,
|
|||
}
|
||||
else /* flat bed scanners */
|
||||
{
|
||||
status = gl847_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl847_stop_action(dev);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -1887,8 +1881,8 @@ gl847_feed (Genesys_Device * dev, unsigned int steps)
|
|||
}
|
||||
while (!(val & FEEDFSH));
|
||||
|
||||
/* then stop scanning */
|
||||
RIE(gl847_stop_action (dev));
|
||||
// then stop scanning
|
||||
gl847_stop_action(dev);
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
@ -2247,8 +2241,8 @@ gl847_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
|||
RIE(gl847_begin_scan(dev, sensor, ®s, SANE_TRUE));
|
||||
RIE(sanei_genesys_read_data_from_scanner(dev, line.data(), total_size));
|
||||
|
||||
/* stop scanning */
|
||||
RIE(gl847_stop_action (dev));
|
||||
// stop scanning
|
||||
gl847_stop_action(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
@ -2566,12 +2560,7 @@ gl847_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
GenesysRegister *r;
|
||||
|
||||
gl847_set_fe(dev, sensor, AFE_SET);
|
||||
status = gl847_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to stop: %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
gl847_stop_action(dev);
|
||||
|
||||
// set up for a gray scan at lowest dpi
|
||||
unsigned dpi = *std::min_element(dev->model->xdpi_values.begin(),
|
||||
|
@ -2636,12 +2625,7 @@ gl847_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
return status;
|
||||
}
|
||||
|
||||
status = gl847_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: gl847_stop_action failed\n", __func__);
|
||||
return status;
|
||||
}
|
||||
gl847_stop_action(dev);
|
||||
|
||||
pass = 0;
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
|
@ -2678,12 +2662,7 @@ gl847_search_strip (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
return status;
|
||||
}
|
||||
|
||||
status = gl847_stop_action (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: gl847_stop_action failed\n", __func__);
|
||||
return status;
|
||||
}
|
||||
gl847_stop_action(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_data)
|
||||
{
|
||||
|
@ -3106,7 +3085,7 @@ gl847_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
dev->frontend.set_gain(2, dev->frontend.get_gain(1));
|
||||
}
|
||||
|
||||
RIE (gl847_stop_action (dev));
|
||||
gl847_stop_action(dev);
|
||||
|
||||
status=gl847_slow_back_home (dev, SANE_TRUE);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue