- 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.
Halftone and lineart mode do not work properly except for a
resolution of 600 dpi. The very last part of a scanned document is
missing and displayed as black stripe. This problem was found with a
Samsung SCX-4521F, but is assumed to affect other devices, too.
Decode the data received from the device in halftone and lineart mode
to fix this problem.
This patch was tested with a Samsung SCX-4521F device for all
resolutions supported by the device with color, grayscale, lineart
and halftone mode.
No regression test with other devices supported by the xerox_mfp
driver was done because of lack of devices.
The acquisition with the xerox_mfp driver works almost out of the box
for the Samsung SCX-4521F but the process stops just before the end
of the document until an USB transfer timeout expires. The very last
part of the scanned document is missing then.
Do not request more data from the device than available for the last
USB transfer to overcome this problem and to be conform with the
properties of the vendor driver.
The driver was tested for all resolutions supported by the device
with color and grayscale mode.
No regression test with other devices supported by the xerox_mfp
driver was done because of lack of devices.
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.
Backends use a mixture of SANE_CURRENT_{MAJOR | MINOR} and V_{MAJOR |
MINOR} with all kind of permutations. I was confused by this and one
comment in pieusb.c tells me I was not alone. Some items in old
changelogs suggest to use the SANE_CURRENT_ macros in backends, so let's
switch to do that with the exception of net.c and dll.c. Done with:
$ find backend -name '*.[ch]' | xargs sed -i '/nearly every/ ! { s/\<V_M/SANE_CURRENT_M/g }'
$ git checkout backend/net.c backend/dll.c
And manually removing the comment from pieusb.c. Everything still builds
fine.
Certain backends do network scans even if the 'local_only'
parameter for 'sane_get_devices()' is true. Fix that.
Changes:
1. Modify 'sanei_configure_attach()' so that backend specific
data may be passed to the 'attach()' function.
2. Use this in certain backends to pass the value of the
'local_only' parameter so that network related activities
are only carried out when the value is false.
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>
Jpeg mode (as submitted by Samsung developer) uses temporary file with
fixed name. This opens attacks on reading its content or overwriting any
other user-writable file (with symlink). This change pre-creates
temporary file with O_CREAT|O_EXCL and mode 0600. Assuming usual +t
permissions for tmp this should mitigate issue.
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.
Some parts of SANE used __FUNCTION__ while other parts used __func__.
Now, __func__ is used consistently throughout the SANE sources. This
fixes all occurrences of the following GCC warning:
warning: ISO C does not support '__FUNCTION__' predefined identifier
Source code was inconsistent on how they were referencing
include files in include/sane. In certain cases, sane/sane.h
and sane/saneopts.h was really including external copies (with
some preprocessor implementations anyways).