avision: lock-up after first duplex sheet scan with AV220D2+
I've been using the avision backend with a variety of Avision ADF scanners for 15 years or so now (I currently operate three of those), and it has been working flawless with earlier models. However, with the AV220D2+ I've always (since at least sane 1.0.25 in 2015) been facing the following problem with this model:
When scanning a larger number of pages/sheets (e.g.20) I always had to scna only one sheet (2 pages) at a time in xsane or simple-scan. This works perfectly fine, you just have to push the button to scan two more pages every second or so, after the previous two pages complete.
If you try to scan 20 pages (10 sheets) in one row, only the first two pages will be scanned. The second sheet wille be fed through the scanner but then everything will lock up. The image data from the second sheet will not show up, and after some seconds, SANE will report I/O errors.
I've always been ok with the "2 at a time" work-around, but now I finally was fed up with it sufficiently to investingate further.
I'm attacheing two log files taken with 1.0.31 (but same is with master) comparing the "2 at a time" approach (xsane1-single.og and the "all at one" approach xsane1-multi.og.
The key difference is that the "signle" performs a sane_cancel/do_cancel after the do_eof of the sheet, while the "multi" wants to contiue at that point but fails later on.
I then compared the contents of do_cancel() and do_eof() and figured out that adding a "s->page = 0" to the do_eof() function will completely solve the issue. I don't understand the code enough to know if this si the right fix, but at least it makes it work for me. I will submit a related PR.