- 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.
JPEG compression improves scan time, and some scanners require it
for high DPI values. But it loses some data, and we already support
toggling it at compile-time.
Add an advanced option so users can decide at scan-time.
Do not decode JPEG into output buffer if it's NULL.
Also, I add assert() for `dev->decData` size, which is never
checked anywhere. Thanks to Michal Nowak for report and
testing. Fixes#128.
References:
https://gitlab.com/sane-project/backends/issues/128
Tested-by: Michal Nowak <Mno-hime@gitlab>
Patch is submitted by Laxmeesh Onkar Markod <m.laxmeesh@samsung.com>
Patch to code is applied almost verbatim, except, insignificant
formatting fixes and making new functions static.
Also, new USB ids added and scanner support is changed as reported.