genesys: Return errors as exceptions from *repark_head()

merge-requests/104/head
Povilas Kanapickas 2019-07-20 11:02:05 +03:00
rodzic d8d1638fde
commit e614c9e102
2 zmienionych plików z 8 dodań i 33 usunięć

Wyświetl plik

@ -3378,11 +3378,9 @@ gl646_init_regs_for_warmup (Genesys_Device * dev,
* so that the head goes to park position.
* as a by-product, also check for lock
*/
static SANE_Status
gl646_repark_head (Genesys_Device * dev)
static void gl646_repark_head(Genesys_Device* dev)
{
DBG_HELPER(dbg);
SANE_Status status = SANE_STATUS_GOOD;
Genesys_Settings settings;
unsigned int expected, steps;
@ -3425,7 +3423,6 @@ gl646_repark_head (Genesys_Device * dev)
// toggle motor flag, put an huge step number and redo move backward
gl646_slow_back_home(dev, 1);
return status;
}
/* *
@ -3588,20 +3585,9 @@ gl646_init (Genesys_Device * dev)
{
if (dev->model->flags & GENESYS_FLAG_REPARK)
{
status = gl646_repark_head (dev);
if (status != SANE_STATUS_GOOD)
{
if (status == SANE_STATUS_INVAL)
{
DBG(DBG_error0, "Your scanner is locked. Please move the lock switch to the "
"unlocked position\n");
return SANE_STATUS_JAMMED;
}
else
DBG(DBG_error, "%s: gl646_repark_head failed: %s\n", __func__,
sane_strstatus(status));
return status;
}
// FIXME: if repark fails, we should print an error message that the scanner is locked and
// the user should unlock the lock. We should also rethrow with SANE_STATUS_JAMMED
gl646_repark_head(dev);
}
else
{

Wyświetl plik

@ -4259,17 +4259,14 @@ gl841_init_regs_for_warmup (Genesys_Device * dev,
* so that the head goes to park position.
* as a by-product, also check for lock
*/
static SANE_Status
sanei_gl841_repark_head (Genesys_Device * dev)
static void sanei_gl841_repark_head(Genesys_Device* dev)
{
DBG_HELPER(dbg);
SANE_Status status = SANE_STATUS_GOOD;
gl841_feed(dev,232);
// toggle motor flag, put an huge step number and redo move backward
gl841_slow_back_home(dev, SANE_TRUE);
return status;
}
static bool
@ -4373,17 +4370,9 @@ gl841_init (Genesys_Device * dev)
/* ensure head is correctly parked, and check lock */
if (dev->model->flags & GENESYS_FLAG_REPARK)
{
status = sanei_gl841_repark_head (dev);
if (status != SANE_STATUS_GOOD)
{
if (status == SANE_STATUS_INVAL)
DBG(DBG_error0, "Your scanner is locked. Please move the lock switch to the unlocked "
"position\n");
else
DBG(DBG_error, "%s: sanei_gl841_repark_head failed: %s\n", __func__,
sane_strstatus(status));
return status;
}
// FIXME: if repark fails, we should print an error message that the scanner is locked and
// the user should unlock the lock. We should also rethrow with SANE_STATUS_JAMMED
sanei_gl841_repark_head(dev);
}
/* send gamma tables */