epson2: bail out if device is still initializing

The comment says it all.
merge-requests/605/head
Wolfram Sang 2021-03-04 19:49:58 +01:00
rodzic c70426fde2
commit 85d8047601
1 zmienionych plików z 13 dodań i 1 usunięć

Wyświetl plik

@ -1649,11 +1649,23 @@ e2_start_ext_scan(Epson_Scanner * s)
if (buf[0] != STX)
return SANE_STATUS_INVAL;
if (buf[1] & 0x80) {
if (buf[1] & STATUS_FER) {
DBG(1, "%s: fatal error\n", __func__);
return SANE_STATUS_IO_ERROR;
}
/*
* The 12000XL signals busy only with FS+G, all other status queries
* say non-busy. Probably because you can in deed communicate with the
* device, just scanning is not yet possible. I tried polling with FS+G
* every 5 seconds, but that made scary noises. So, bail out and let
* the user retry manually.
*/
if (buf[1] & STATUS_NOT_READY) {
DBG(1, "%s: device not ready\n", __func__);
return SANE_STATUS_DEVICE_BUSY;
}
s->ext_block_len = le32atoh(&buf[2]);
s->ext_blocks = le32atoh(&buf[6]);
s->ext_last_len = le32atoh(&buf[10]);