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
Now detects cover open and paper jam.
Also formalised the query packet which occurs during initialization.
Hopefully, we will be able to decode this for useful information.
By detail, user can now select a single resolution value or split x
and y resolutions with an additional "split resolution" option.
Default is to enable combine resolution.
Some devices can compress colour (JPEG) and also provide raw data
in uncompressed form. The two devices that I have supply raw data
not in RBG but in YCbCr form.
Now applications have the option to choose compressed or uncompressed
colour scans if supported by the device.
Cancel from the device by pressing STOP is now handled properly.
Test machine MFC-290C seems to support JPEG and RAW colour data.
However, the raw colour data has what appears to be a strong green
component leading to very green images. Maybe some post processing
is required to generate a proper image. Dunno. JPEG looks perfectly fine.
Still one rare illusive issue that causes loss of a bit of a line's
data, resulting in a sliding of the image to the left. It doesn't
happen very often, very difficult to reproduce.
This version is a refactor using bits and pieces from the prototype.
Converted from C to C++ to make code reuse easier.
Will do gray/errdif/text scanning on the test MFC-J4320DW machine.
Cancel function added.