uru4000: retry scanner powerup 3 times
When we include the await_finger_off procedure (i.e. set mode 12), the current power-up code is unreliable - no 56aa interrupt arrives sometimes. Comparing the F0 data and hwstat at this point between a working and a non-working run yields no differences. Work around this issue by retrying power-on 3 times.
This commit is contained in:
parent
cbe1111e4e
commit
f733ddcc3b
1 changed files with 20 additions and 12 deletions
|
@ -188,8 +188,10 @@ static int get_irq(struct fp_img_dev *dev, unsigned char *buf, int timeout)
|
||||||
int r;
|
int r;
|
||||||
int infinite_timeout = 0;
|
int infinite_timeout = 0;
|
||||||
|
|
||||||
if (timeout == 0)
|
if (timeout == 0) {
|
||||||
infinite_timeout = 1;
|
infinite_timeout = 1;
|
||||||
|
timeout = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
/* Darwin and Linux behave inconsistently with regard to infinite timeouts.
|
/* Darwin and Linux behave inconsistently with regard to infinite timeouts.
|
||||||
* Linux accepts a timeout value of 0 as infinite timeout, whereas darwin
|
* Linux accepts a timeout value of 0 as infinite timeout, whereas darwin
|
||||||
|
@ -198,15 +200,12 @@ static int get_irq(struct fp_img_dev *dev, unsigned char *buf, int timeout)
|
||||||
* See http://thread.gmane.org/gmane.comp.lib.libusb.devel.general/1315 */
|
* See http://thread.gmane.org/gmane.comp.lib.libusb.devel.general/1315 */
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
r = usb_interrupt_read(dev->udev, EP_INTR, buf, IRQ_LENGTH, 1000);
|
r = usb_interrupt_read(dev->udev, EP_INTR, buf, IRQ_LENGTH, timeout);
|
||||||
if (r == -ETIMEDOUT &&
|
if (r == -ETIMEDOUT && infinite_timeout)
|
||||||
((!infinite_timeout && timeout > 0) || infinite_timeout)) {
|
|
||||||
fp_dbg("timeout, retry");
|
|
||||||
timeout--;
|
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
|
||||||
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
if (r != -ETIMEDOUT)
|
||||||
fp_err("interrupt read failed, error %d", r);
|
fp_err("interrupt read failed, error %d", r);
|
||||||
return r;
|
return r;
|
||||||
} else if (r < IRQ_LENGTH) {
|
} else if (r < IRQ_LENGTH) {
|
||||||
|
@ -367,6 +366,7 @@ static int do_init(struct fp_img_dev *dev)
|
||||||
{
|
{
|
||||||
unsigned char status;
|
unsigned char status;
|
||||||
unsigned char tmp;
|
unsigned char tmp;
|
||||||
|
int timeouts = 0;
|
||||||
int i;
|
int i;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -440,10 +440,18 @@ retry:
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = get_irq_with_type(dev, IRQDATA_SCANPWR_ON, 5);
|
r = get_irq_with_type(dev, IRQDATA_SCANPWR_ON, 400);
|
||||||
if (r == GET_IRQ_OVERFLOW)
|
if (r == GET_IRQ_OVERFLOW) {
|
||||||
goto retry;
|
goto retry;
|
||||||
else
|
} else if (r == -ETIMEDOUT) {
|
||||||
|
timeouts++;
|
||||||
|
if (timeouts <= 3) {
|
||||||
|
fp_dbg("scan power up timeout, retrying...");
|
||||||
|
goto retry;
|
||||||
|
} else {
|
||||||
|
fp_err("could not power up scanner after 3 attempts");
|
||||||
|
}
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue