kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Return errors as exceptions from *repark_head()
rodzic
d8d1638fde
commit
e614c9e102
|
@ -3378,11 +3378,9 @@ gl646_init_regs_for_warmup (Genesys_Device * dev,
|
||||||
* so that the head goes to park position.
|
* so that the head goes to park position.
|
||||||
* as a by-product, also check for lock
|
* as a by-product, also check for lock
|
||||||
*/
|
*/
|
||||||
static SANE_Status
|
static void gl646_repark_head(Genesys_Device* dev)
|
||||||
gl646_repark_head (Genesys_Device * dev)
|
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
Genesys_Settings settings;
|
Genesys_Settings settings;
|
||||||
unsigned int expected, steps;
|
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
|
// toggle motor flag, put an huge step number and redo move backward
|
||||||
gl646_slow_back_home(dev, 1);
|
gl646_slow_back_home(dev, 1);
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *
|
/* *
|
||||||
|
@ -3588,20 +3585,9 @@ gl646_init (Genesys_Device * dev)
|
||||||
{
|
{
|
||||||
if (dev->model->flags & GENESYS_FLAG_REPARK)
|
if (dev->model->flags & GENESYS_FLAG_REPARK)
|
||||||
{
|
{
|
||||||
status = gl646_repark_head (dev);
|
// FIXME: if repark fails, we should print an error message that the scanner is locked and
|
||||||
if (status != SANE_STATUS_GOOD)
|
// the user should unlock the lock. We should also rethrow with SANE_STATUS_JAMMED
|
||||||
{
|
gl646_repark_head(dev);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -4259,17 +4259,14 @@ gl841_init_regs_for_warmup (Genesys_Device * dev,
|
||||||
* so that the head goes to park position.
|
* so that the head goes to park position.
|
||||||
* as a by-product, also check for lock
|
* as a by-product, also check for lock
|
||||||
*/
|
*/
|
||||||
static SANE_Status
|
static void sanei_gl841_repark_head(Genesys_Device* dev)
|
||||||
sanei_gl841_repark_head (Genesys_Device * dev)
|
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
|
|
||||||
gl841_feed(dev,232);
|
gl841_feed(dev,232);
|
||||||
|
|
||||||
// toggle motor flag, put an huge step number and redo move backward
|
// toggle motor flag, put an huge step number and redo move backward
|
||||||
gl841_slow_back_home(dev, SANE_TRUE);
|
gl841_slow_back_home(dev, SANE_TRUE);
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -4373,17 +4370,9 @@ gl841_init (Genesys_Device * dev)
|
||||||
/* ensure head is correctly parked, and check lock */
|
/* ensure head is correctly parked, and check lock */
|
||||||
if (dev->model->flags & GENESYS_FLAG_REPARK)
|
if (dev->model->flags & GENESYS_FLAG_REPARK)
|
||||||
{
|
{
|
||||||
status = sanei_gl841_repark_head (dev);
|
// FIXME: if repark fails, we should print an error message that the scanner is locked and
|
||||||
if (status != SANE_STATUS_GOOD)
|
// the user should unlock the lock. We should also rethrow with SANE_STATUS_JAMMED
|
||||||
{
|
sanei_gl841_repark_head(dev);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send gamma tables */
|
/* send gamma tables */
|
||||||
|
|
Ładowanie…
Reference in New Issue