summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <sane-dev@marcschink.de>2017-01-15 18:59:17 +0100
committerMarc Schink <sane-dev@marcschink.de>2017-01-15 18:59:17 +0100
commit8537f48e7fd5248d47430f4b887a8b58b0471f07 (patch)
tree8e6a9250fcd3999f0b4eecffd3e234fec9854bc3
parente038c320f07013b18b0c421bcccba8835136f1ac (diff)
xerox_mfp: Fix lineart and halftone modescx_4521f_support
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.
-rw-r--r--backend/xerox_mfp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/backend/xerox_mfp.c b/backend/xerox_mfp.c
index 945c385..0c604f1 100644
--- a/backend/xerox_mfp.c
+++ b/backend/xerox_mfp.c
@@ -1294,6 +1294,13 @@ sane_read(SANE_Handle h, SANE_Byte *buf, SANE_Int maxlen, SANE_Int *lenp)
dev->total_out_size += *lenp;
return SANE_STATUS_GOOD;
}
+ } else if (dev->composition != MODE_RGB24) {
+ int diff = dev->total_img_size - dev->total_out_size;
+ int bufLen = (diff < maxlen) ? diff : maxlen;
+ if (diff > 0 && copy_plain_trim(dev, buf, bufLen, lenp) > 0) {
+ dev->total_out_size += *lenp;
+ return SANE_STATUS_GOOD;
+ }
}
/* and we don't need to acquire next block */