kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Move waiting for motor stop out of *_init_regs_for_scan()
rodzic
bba75702b6
commit
442ffd0486
|
@ -3883,6 +3883,10 @@ genesys_start_scan (Genesys_Device * dev, SANE_Bool lamp_off)
|
|||
}
|
||||
}
|
||||
|
||||
if (dev->model->cmd_set->wait_for_motor_stop) {
|
||||
dev->model->cmd_set->wait_for_motor_stop(dev);
|
||||
}
|
||||
|
||||
status = dev->model->cmd_set->init_regs_for_scan(dev, sensor);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
|
|
|
@ -2419,6 +2419,25 @@ gl124_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
static void gl124_wait_for_motor_stop(Genesys_Device* dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t val40, val;
|
||||
|
||||
TIE(sanei_genesys_get_status(dev, &val));
|
||||
TIE(sanei_genesys_read_register(dev, REG100, &val40));
|
||||
|
||||
if ((val & MOTORENB) == 0 && (val40 & REG100_MOTMFLG) == 0)
|
||||
return;
|
||||
|
||||
do {
|
||||
sanei_genesys_sleep_ms(10);
|
||||
TIE(sanei_genesys_get_status(dev, &val));
|
||||
TIE(sanei_genesys_read_register(dev, REG100, &val40));
|
||||
} while ((val & MOTORENB) ||(val40 & REG100_MOTMFLG));
|
||||
sanei_genesys_sleep_ms(50);
|
||||
}
|
||||
|
||||
/** @brief set up registers for the actual scan
|
||||
*/
|
||||
static SANE_Status
|
||||
|
@ -2430,51 +2449,12 @@ gl124_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
float move;
|
||||
int move_dpi;
|
||||
float start;
|
||||
uint8_t val40,val;
|
||||
|
||||
SANE_Status status;
|
||||
|
||||
DBG(DBG_info, "%s ", __func__);
|
||||
debug_dump(DBG_info, dev->settings);
|
||||
|
||||
/* wait for motor to stop first */
|
||||
status = sanei_genesys_get_status (dev, &val);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error, "%s: failed to read status: %s\n", __func__, sane_strstatus (status));
|
||||
DBGCOMPLETED;
|
||||
return status;
|
||||
}
|
||||
status = sanei_genesys_read_register (dev, REG100, &val40);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error, "%s: failed to read reg100: %s\n", __func__, sane_strstatus (status));
|
||||
DBGCOMPLETED;
|
||||
return status;
|
||||
}
|
||||
if((val & MOTORENB) || (val40 & REG100_MOTMFLG))
|
||||
{
|
||||
do
|
||||
{
|
||||
sanei_genesys_sleep_ms(10);
|
||||
status = sanei_genesys_get_status (dev, &val);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error, "%s: failed to read status: %s\n", __func__, sane_strstatus (status));
|
||||
DBGCOMPLETED;
|
||||
return status;
|
||||
}
|
||||
status = sanei_genesys_read_register (dev, REG100, &val40);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error, "%s: failed to read reg100: %s\n", __func__, sane_strstatus (status));
|
||||
DBGCOMPLETED;
|
||||
return status;
|
||||
}
|
||||
} while ((val & MOTORENB) || (val40 & REG100_MOTMFLG));
|
||||
sanei_genesys_sleep_ms(50);
|
||||
}
|
||||
|
||||
/* ensure head is parked in case of calibration */
|
||||
RIE (gl124_slow_back_home (dev, SANE_TRUE));
|
||||
|
||||
|
@ -3582,6 +3562,7 @@ static Genesys_Command_Set gl124_cmd_set = {
|
|||
gl124_coarse_gain_calibration,
|
||||
gl124_led_calibration,
|
||||
|
||||
gl124_wait_for_motor_stop,
|
||||
gl124_slow_back_home,
|
||||
gl124_rewind,
|
||||
|
||||
|
|
|
@ -4936,6 +4936,7 @@ static Genesys_Command_Set gl646_cmd_set = {
|
|||
gl646_coarse_gain_calibration,
|
||||
gl646_led_calibration,
|
||||
|
||||
NULL,
|
||||
gl646_slow_back_home,
|
||||
NULL,
|
||||
|
||||
|
|
|
@ -5594,6 +5594,7 @@ static Genesys_Command_Set gl841_cmd_set = {
|
|||
gl841_coarse_gain_calibration,
|
||||
gl841_led_calibration,
|
||||
|
||||
NULL,
|
||||
gl841_slow_back_home,
|
||||
NULL,
|
||||
|
||||
|
|
|
@ -4388,6 +4388,7 @@ static Genesys_Command_Set gl843_cmd_set = {
|
|||
gl843_coarse_gain_calibration,
|
||||
gl843_led_calibration,
|
||||
|
||||
NULL,
|
||||
gl843_slow_back_home,
|
||||
NULL,
|
||||
|
||||
|
|
|
@ -3361,6 +3361,7 @@ static Genesys_Command_Set gl846_cmd_set = {
|
|||
gl846_coarse_gain_calibration,
|
||||
gl846_led_calibration,
|
||||
|
||||
NULL,
|
||||
gl846_slow_back_home,
|
||||
NULL,
|
||||
|
||||
|
|
|
@ -3485,6 +3485,7 @@ static Genesys_Command_Set gl847_cmd_set = {
|
|||
gl847_coarse_gain_calibration,
|
||||
gl847_led_calibration,
|
||||
|
||||
NULL,
|
||||
gl847_slow_back_home,
|
||||
NULL, /* disable gl847_rewind, see #7 */
|
||||
|
||||
|
|
|
@ -1024,6 +1024,7 @@ typedef struct Genesys_Command_Set
|
|||
SANE_Status (*led_calibration) (Genesys_Device * dev, Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set& regs);
|
||||
|
||||
void (*wait_for_motor_stop) (Genesys_Device* dev);
|
||||
SANE_Status (*slow_back_home) (Genesys_Device * dev, SANE_Bool wait_until_home);
|
||||
SANE_Status (*rewind) (Genesys_Device * dev);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue