Not only the Perfection1650, but other scanners need to ignore the
FSG_STATUS_CANCEL_REQ bit as well. Thanks to @matc for debugging and
providing a list. Should fix#716. Remove the hardcoded bitmask while
here.
Signed-off-by: Wolfram Sang <wsa@kernel.org>
- Stopping and releasing the device causes the ADF to purge any remaining pages,
thus only the first page gets properly scanned (observed with Samsung
SCX-4729FW).
- Instead, when sourcing from the ADF, at each page's completion it should
continue and issue "OBJECT POSITION" command to proceed to the next page.
- Once all pages have been processed, the subsequent "OBJECT POSITION" command
returns the proper "CHECK CONDITION" status (ADF is empty) and triggers the
device stop and release.
- Additionally, the status of the ADF (loaded/empty) needs to be requeried
at the `sane_start()` for proper handling of the "Auto" mode. Otherwise,
the scanning session retains the ADF state from the start of the session,
even though ADF will become empty. Thus the "Auto" mode will not properly
switch to Flatbed as intended in the client application (observed in
Simple-Scan).
> NOTE: the initial "READ" command in `sane_start()` is extraneous and
> appears to always return STATUS_BUSY (indeed, the scanner is usually
> busy loading the page). The actual READ is correctly done in
> `dev_acquire()`. It may appear benign in a single page scan mode, however,
> it becomes malfunctioning in the mutipage ADF mode. The initial READ,
> when successful, will cause the skipping of the read block from processing,
> as the actual processing is tied to content read from `dev_acquire()`.
>
> Therefore, the initial READ command in the `sane_start()` is removed.
Without this change, pixma scanning is currently broken (tested with Canon MP495). The stated reason for the workaround (libusb not supporting timeouts for interrupts) hasn't been true since 2010:
67d9ef7b68
1. Fixed scan to jpeg/png
2. Fixed bottom part of the image
3. Removed white pixels from the right part of the image
4. Adjusted physical dimensions of the scanning area
Instead use make(1) env MAKEFLAGS set to `-w -O`.
With silent rules we don't see compile commands and only see a error
messages. This is beautiful when there is no errors but harder to
understand the cause when there are errors.
For example, after adding `-Wno-error=unused-but-set-variable`
I still see the error:
CXX genesys/libgenesys_la-device.lo
genesys/genesys.cpp:843:19: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
843 | for (unsigned i = 0;; ++i) {
| ^
But why? Hard to tell since we don't see compile command line.
With `-w -O` we see each compilation job grouped in the log.
This will help to debug build issues in CI, where reproduction is
costly/harder for a casual contributor. Compilation command is just
above the error. Find errors in log by searching for `error:` or
`warning:` strings.
clang 17 warnings that need to be fixed:
hp-option.c:3812:10: error: variable 'errcount' set but not used [-Werror,-Wunused-but-set-variable]
3812 | int i, errcount = 0;
| ^
In file included from hp3900.c:59:
./hp3900_sane.c:1755:12: error: variable 'nline' set but not used [-Werror,-Wunused-but-set-variable]
1755 | SANE_Int nline = 0;
| ^
lexmark_low.c:2500:7: error: variable 'blackLineCount' set but not used [-Werror,-Wunused-but-set-variable]
2500 | int blackLineCount = 0;
| ^
In file included from plustek_pp.c:124:
./plustek-pp_io.c:425:8: error: variable 'dwTime' set but not used [-Werror,-Wunused-but-set-variable]
425 | ULong dwTime = 1;
| ^
genesys/genesys.cpp:843:19: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
843 | for (unsigned i = 0;; ++i) {
| ^
After fixing them this commit could be reversed.
GCC 13 error message:
kodakaio.c: In function 'k_init_parametersta':
kodakaio.c:1830:67: error: unpaired UTF-8 bidirectional control character detected [-Werror=bidi-chars=]
1830 | * The default color depth is stored in mode_params.depth:<U+202D>
| ~~~~~~~~^
| | |
| | end of bidirectional context
| U+202D (LEFT-TO-RIGHT OVERRIDE)
Fixes: 06fae3526 ("kodakaio params.depth corrected for lineart, color mode made the default.")