summaryrefslogtreecommitdiff
path: root/media-gfx/sane-backends
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-10-22 11:09:47 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-10-22 11:09:47 +0100
commit64e107b9b6058580ff0432107eb37cefb0b2a7d8 (patch)
tree9a44e603e2ae365e2b1fe35ac37f73e830cdee1d /media-gfx/sane-backends
parent957235cf19a691360c720f7913672adda4258ed0 (diff)
gentoo resync : 22.10.2018
Diffstat (limited to 'media-gfx/sane-backends')
-rw-r--r--media-gfx/sane-backends/Manifest3
-rw-r--r--media-gfx/sane-backends/files/sane-backends-1.0.27-revert-samsung.patch406
-rw-r--r--media-gfx/sane-backends/files/sane-backends-1.0.27-uninitialized-variable.patch25
-rw-r--r--media-gfx/sane-backends/sane-backends-1.0.27-r2.ebuild344
4 files changed, 778 insertions, 0 deletions
diff --git a/media-gfx/sane-backends/Manifest b/media-gfx/sane-backends/Manifest
index f05e02fe9715..ce26a44de0d9 100644
--- a/media-gfx/sane-backends/Manifest
+++ b/media-gfx/sane-backends/Manifest
@@ -2,6 +2,8 @@ AUX sane-backends-1.0.24-saned_pidfile_location.patch 345 BLAKE2B dcf7cbd5787c7a
AUX sane-backends-1.0.27-canon-lide-100.patch 907 BLAKE2B 3e625443b48e2f03d1d095c1d3d2651abf1ea073ca7bbd439ef389906ed683d7f8b43123e7a9cc6360703f1b66886ff2cb6a7428984e4073496b890ed240e9bb SHA512 870dc11926df5ef0c38588336c8d69cfa11ebf9d3355f26eec4e5178fe2dac6e8ffc576980a4b5789cdb7155fbcc97a35300c63ba4e9e1ebbdd0702c563d09f3
AUX sane-backends-1.0.27-disable-usb-tests.patch 336 BLAKE2B 00fd225a4426405d515f5b6641c86e6d9035a588a776aaec26eaa4e10beebf0a9fd97da991646b7964a867c422da2bc1cf93560d1ba326f0086675036338ff00 SHA512 64cce489e87de31e1a865b86d5829ae4914a30f47e27b07fba68629261cefcd617b8eed272c94b7554545e4802283c5bd5b53f79f54403d875726b38378ae74d
AUX sane-backends-1.0.27-network.patch 1022 BLAKE2B bcc929635fe62af4201f474cddd141b95bf1b7520f7279b713771ed9614990b3331ec1b42f309d88e375d6c9cffacb7195e7e3f063e491bb9cd6e4ae39f79eea SHA512 04b65a06d2c76dde6fce501ba823e999eb89ea41573f887f9e7d5347f3aa5e35310fad69313e99f873640e29a9849372d2ff995678593a0781fba73b464bec0d
+AUX sane-backends-1.0.27-revert-samsung.patch 14137 BLAKE2B ec41dcc9862a50f09518207b0db83f37d14f7e3ba6b101800144a8bc7059eb9c0fb5fcbab42dc8ec68001f61b304baa628c3f2ac73be9031b946fe8088e5cf37 SHA512 70e8d86291fbb21c7c9c5fa9ba5df54c808e5e75e3155af33ab9c18c768bc1eaa05890802c52daa3e60619fa8961b7162cac4c51e2dd2dd6c7114986d3a6136f
+AUX sane-backends-1.0.27-uninitialized-variable.patch 902 BLAKE2B 6f2e86d6d79f85f73d564bc1877667c1278108d876f61551cc89abb159dee68e6b454bec190cb44eee61255fa648010293382f5575d208dd7c1e33c1492be3e9 SHA512 b3c5675e5ec3a92345832d081025dae72bcfda9854f79565fc2801e6ea710a83e953a9f075ef9754c6d893fb099544989b4aaabf8a177d5c52b8a4b9c6eac052
AUX saned 150 BLAKE2B 306d57a0c09856b387c3c50eb27aaafdb194972c2fdb5d1cb7de3118f0c71cf234898ce958f0d6bd17a5e1f2b5bde458e014a7bfdec52403a6204ebf51aee039 SHA512 26f3d66c6b1e75d87d7d430518aa878c77d5ab8d76a45847cef3ff15566341938eedf46c50d0fa8cdeef828df9cddefdd6fdd767c5de30d3aa7d64ed1911d910
AUX saned.confd 76 BLAKE2B cac74b6f117f7f78a71b951433bc6b155f8641e2cf1bd747871165764e97ed368d10551075761c34ff01f51f7cae1b8a9c5692fb9666a300b45134fe255ea3c1 SHA512 8f4a99ef24c19b3a7213b3d25ea16f5bca8623735cf25d21e3a706e9e0135ac8cce5d0b8fb8728845977f41dcefe6bd858076d755515fc91b00e05ee5817d751
AUX saned.initd 294 BLAKE2B 571bd4032b2330c627a31459a18baf2044852ec1b40f0216bd5b5a546d61133522cdc98c7011669feaadc2d030ffeb49a86130075f22a18edab5f4c925780681 SHA512 655200141339f14bf7fc6f4fff3403cf9504809b7f023aa5425aad691c5baa65772100da0a6311669f83ed1dce73b7d65ca20aa31345b13c48dfdb1b30ce5dbd
@@ -9,4 +11,5 @@ AUX saned.socket 132 BLAKE2B 5e9f0350a1553fc75aea88ce355fb68b881e3b2194ac0e3c6f3
AUX saned_at.service 434 BLAKE2B 6dad3c809e01c17c0064a52c4103486b19294ed3cf8fc71faad18edaf71b920584366ac988d354f45bc07607ea64a97ea480fe152ac9a1cd896df99ff457cbf7 SHA512 891c751261107676f8159f403e0f4d4254099b709b9ba0ac9f2af97a9ed30f677411ad6bc316c2e6e673c616ba988253479d5e30c9617e3ae279beb79f70e965
DIST sane-backends-1.0.27.tar.gz 6430188 BLAKE2B 90f910311e31a436eaa0ca0fedd998aac3331f89a346f31613776ebc860a10cc37055fd15db8de8d743498914ea0c16e4153dbaa101380eb6e36857d730c3456 SHA512 c6552768bfc10216730fc11011c82f74ca0952182019ded3916072147ec09be5c975ce1d37dc3ccea050c488dbdf983c2ca17dcd702644060ba796ae2591f9c5
EBUILD sane-backends-1.0.27-r1.ebuild 7729 BLAKE2B 99a75ac0aae614e4168b1216ed22c071acc4d1a448eeeee1a6c36991df23bf8e68dfb558d3047e144f8fd32cd4ad766a41238be5a991b4039172872011eed501 SHA512 42689dd5189e9bfba21f016dc63897b0fec6adb18fda2485c64c35764caceff307b18759aa359d7b56fb69aee86ceb769d1c5f5162d30cc9e8576dc3140f70aa
+EBUILD sane-backends-1.0.27-r2.ebuild 8140 BLAKE2B 8637061b459d53e5ea2c46815ffa2ded960825a2b134e52da6063eb8869a577c9fd4b5dfd6d9e000d4a9978ed2d148dfe755355f1eb10d247ce21d54d1ad50cf SHA512 507035bcab7598e62fba58c2323c9ed61c773a3af4b080fe2a9f65db5a89711027ce9881b0f38c8e903e1d577af57b4d9759f9e6007b6f7687e94cb06dcdb5de
MISC metadata.xml 166 BLAKE2B c254f1fb642881aba57637be14fb0a89b10384f91a128feaec3a8c870d76efc2cbacb92caccc0dee2dd19a5ac5eaf8643080dafa05c4e2ac96a68568927e5afd SHA512 a56648c974a1d14dd4c18237532773c72057a13ab90c58b5da04f185e3c12a8bd8d5c21fb06053507f31766291a82dc7d87b34cd65fd94cfe2af7295c813ef84
diff --git a/media-gfx/sane-backends/files/sane-backends-1.0.27-revert-samsung.patch b/media-gfx/sane-backends/files/sane-backends-1.0.27-revert-samsung.patch
new file mode 100644
index 000000000000..af3e141a010c
--- /dev/null
+++ b/media-gfx/sane-backends/files/sane-backends-1.0.27-revert-samsung.patch
@@ -0,0 +1,406 @@
+From 9b13d4c18b2424eaed02b72a928e9607921ec265 Mon Sep 17 00:00:00 2001
+From: Bernard Cafarelli <bernard.cafarelli@gmail.com>
+Date: Tue, 17 Apr 2018 22:43:15 +0200
+Subject: [PATCH] Revert "Color scanning for Samsung models, which support JPEG
+ Lossy compression."
+
+This reverts commit 926bfade544de4a4fd5f1a8082b85a97e2443770, leaving
+the new IDs in.
+As tracked in #315876, this breaks scanning with multiple Samsung scanners
+
+Conflicts:
+ backend/xerox_mfp.c
+ backend/xerox_mfp.h
+ doc/descriptions/xerox_mfp.desc
+---
+ backend/Makefile.am | 2 +-
+ backend/Makefile.in | 7 +-
+ backend/xerox_mfp.c | 193 +-------------------------------
+ backend/xerox_mfp.h | 5 -
+ doc/descriptions/xerox_mfp.desc | 10 +-
+ 5 files changed, 14 insertions(+), 203 deletions(-)
+
+diff --git a/backend/Makefile.am b/backend/Makefile.am
+index 18695a4a..3225b133 100644
+--- a/backend/Makefile.am
++++ b/backend/Makefile.am
+@@ -1086,7 +1086,7 @@ libxerox_mfp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=xerox_mfp
+ nodist_libsane_xerox_mfp_la_SOURCES = xerox_mfp-s.c
+ libsane_xerox_mfp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=xerox_mfp
+ libsane_xerox_mfp_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS)
+-libsane_xerox_mfp_la_LIBADD = $(COMMON_LIBS) libxerox_mfp.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo @SANEI_SANEI_JPEG_LO@ $(JPEG_LIBS) ../sanei/sanei_usb.lo ../sanei/sanei_tcp.lo $(MATH_LIB) $(SOCKET_LIBS) $(USB_LIBS) $(RESMGR_LIBS)
++libsane_xerox_mfp_la_LIBADD = $(COMMON_LIBS) libxerox_mfp.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_tcp.lo $(MATH_LIB) $(SOCKET_LIBS) $(USB_LIBS) $(RESMGR_LIBS)
+ EXTRA_DIST += xerox_mfp.conf.in
+
+ libdll_preload_la_SOURCES = dll.c
+diff --git a/backend/Makefile.in b/backend/Makefile.in
+index d1dca4a2..2643bb77 100644
+--- a/backend/Makefile.in
++++ b/backend/Makefile.in
+@@ -1430,10 +1430,9 @@ libsane_v4l_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ libsane_xerox_mfp_la_DEPENDENCIES = $(COMMON_LIBS) libxerox_mfp.la \
+ ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo \
+ ../sanei/sanei_config.lo sane_strstatus.lo \
+- $(am__DEPENDENCIES_1) ../sanei/sanei_usb.lo \
+- ../sanei/sanei_tcp.lo $(am__DEPENDENCIES_1) \
++ ../sanei/sanei_usb.lo ../sanei/sanei_tcp.lo \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+- $(am__DEPENDENCIES_1)
++ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ nodist_libsane_xerox_mfp_la_OBJECTS = \
+ libsane_xerox_mfp_la-xerox_mfp-s.lo
+ libsane_xerox_mfp_la_OBJECTS = $(nodist_libsane_xerox_mfp_la_OBJECTS)
+@@ -2754,7 +2753,7 @@ libxerox_mfp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=xerox_mfp
+ nodist_libsane_xerox_mfp_la_SOURCES = xerox_mfp-s.c
+ libsane_xerox_mfp_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=xerox_mfp
+ libsane_xerox_mfp_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS)
+-libsane_xerox_mfp_la_LIBADD = $(COMMON_LIBS) libxerox_mfp.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo @SANEI_SANEI_JPEG_LO@ $(JPEG_LIBS) ../sanei/sanei_usb.lo ../sanei/sanei_tcp.lo $(MATH_LIB) $(SOCKET_LIBS) $(USB_LIBS) $(RESMGR_LIBS)
++libsane_xerox_mfp_la_LIBADD = $(COMMON_LIBS) libxerox_mfp.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_tcp.lo $(MATH_LIB) $(SOCKET_LIBS) $(USB_LIBS) $(RESMGR_LIBS)
+ libdll_preload_la_SOURCES = dll.c
+ libdll_preload_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dll -DENABLE_PRELOAD
+ libdll_la_SOURCES = dll.c
+diff --git a/backend/xerox_mfp.c b/backend/xerox_mfp.c
+index 8b8c8956..d37a6237 100644
+--- a/backend/xerox_mfp.c
++++ b/backend/xerox_mfp.c
+@@ -33,9 +33,6 @@
+ #include "../include/sane/sanei_usb.h"
+ #include "../include/sane/sanei_config.h"
+ #include "../include/sane/sanei_backend.h"
+-#ifdef HAVE_LIBJPEG
+-#include <jpeglib.h>
+-#endif
+ #include "xerox_mfp.h"
+
+ #define BACKEND_BUILD 13
+@@ -93,128 +90,6 @@ static char *str_cmd(int cmd)
+ }
+
+ #define MAX_DUMP 70
+-const char *encTmpFileName = "/tmp/stmp_enc.tmp";
+-
+-static int decompress(struct device __sane_unused__ *dev,
+- const char __sane_unused__ *infilename)
+-{
+-#ifdef HAVE_LIBJPEG
+- int rc;
+- int row_stride, width, height, pixel_size;
+- struct jpeg_decompress_struct cinfo;
+- struct jpeg_error_mgr jerr;
+- unsigned long bmp_size = 0;
+- FILE *pInfile = NULL;
+- JSAMPARRAY buffer;
+-
+- if ((pInfile = fopen(infilename, "rb")) == NULL) {
+- fprintf(stderr, "can't open %s\n", infilename);
+- return -1;
+- }
+-
+- cinfo.err = jpeg_std_error(&jerr);
+-
+- jpeg_create_decompress(&cinfo);
+-
+- jpeg_stdio_src(&cinfo, pInfile);
+-
+- rc = jpeg_read_header(&cinfo, TRUE);
+- if (rc != 1) {
+- jpeg_destroy_decompress(&cinfo);
+- fclose(pInfile);
+- return -1;
+- }
+-
+- jpeg_start_decompress(&cinfo);
+-
+- width = cinfo.output_width;
+- height = cinfo.output_height;
+- pixel_size = cinfo.output_components;
+- bmp_size = width * height * pixel_size;
+- dev->decDataSize = bmp_size;
+-
+- row_stride = width * pixel_size;
+-
+- buffer = (*cinfo.mem->alloc_sarray)
+- ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
+-
+- while (cinfo.output_scanline < cinfo.output_height) {
+- buffer[0] = dev->decData + \
+- (cinfo.output_scanline) * row_stride;
+- jpeg_read_scanlines(&cinfo, buffer, 1);
+- }
+- jpeg_finish_decompress(&cinfo);
+- jpeg_destroy_decompress(&cinfo);
+- fclose(pInfile);
+- return 0;
+-#else
+- return -1;
+-#endif
+-}
+-
+-static int copy_decompress_data(struct device *dev, unsigned char *pDest, int maxlen, int *destLen)
+-{
+- int data_size = 0;
+- size_t result = 0, retVal = 0;
+-
+-
+- if (0 == dev->decDataSize) {
+- *destLen = 0;
+- return retVal;
+- }
+- data_size = dev->decDataSize - dev->currentDecDataIndex;
+- if (data_size > maxlen) {
+- data_size = maxlen;
+- }
+- memcpy(pDest, dev->decData+dev->currentDecDataIndex, data_size);
+- result = data_size;
+- *destLen = result;
+- dev->currentDecDataIndex += result;
+- retVal = result;
+-
+- if (dev->decDataSize == dev->currentDecDataIndex) {
+- dev->currentDecDataIndex = 0;
+- dev->decDataSize = 0;
+- }
+-
+- return retVal;
+-}
+-
+-static int decompress_tempfile(struct device *dev)
+-{
+- decompress(dev, encTmpFileName);
+- remove(encTmpFileName);
+- return 0;
+-}
+-
+-static int dump_to_tmp_file(struct device *dev)
+-{
+- unsigned char *pSrc = dev->data;
+- int srcLen = dev->datalen;
+- FILE *pInfile;
+- if ((pInfile = fopen(encTmpFileName, "a")) == NULL) {
+- fprintf(stderr, "can't open %s\n", encTmpFileName);
+- return 0;
+- }
+-
+- fwrite(pSrc, 1, srcLen, pInfile);
+- fclose(pInfile);
+- return srcLen;
+-}
+-
+-static int isSupportedDevice(struct device __sane_unused__ *dev)
+-{
+-#ifdef HAVE_LIBJPEG
+- /* Checking device which supports JPEG Lossy compression for color scanning*/
+- if (dev->compressionTypes & (1 << 6))
+- return 1;
+- else
+- return 0;
+-#else
+- return 0;
+-#endif
+-}
+-
+ static void dbg_dump(struct device *dev)
+ {
+ int i;
+@@ -639,11 +514,9 @@ static void set_parameters(struct device *dev)
+ dev->para.pixels_per_line = dev->win_width / px_to_len;
+ dev->para.bytes_per_line = dev->para.pixels_per_line;
+
+- if (!isSupportedDevice(dev)) {
+ #if BETTER_BASEDPI
+- px_to_len = 1213.9 / dev->val[OPT_RESOLUTION].w;
++ px_to_len = 1213.9 / dev->val[OPT_RESOLUTION].w;
+ #endif
+- }
+ dev->para.lines = dev->win_len / px_to_len;
+ if (dev->composition == MODE_LINEART ||
+ dev->composition == MODE_HALFTONE) {
+@@ -765,13 +638,6 @@ static int dev_set_window(struct device *dev)
+ cmd[0x11] = (SANE_Byte)floor(dev->win_off_y);
+ cmd[0x12] = (SANE_Byte)((dev->win_off_y - floor(dev->win_off_y)) * 100);
+ cmd[0x13] = dev->composition;
+- /* Set to JPEG Lossy Compression, if mode is color (only for supported model)...
+- * else go with Uncompressed (For backard compatibility with old models )*/
+- if (dev->composition == MODE_RGB24) {
+- if (isSupportedDevice(dev)) {
+- cmd[0x14] = 0x6;
+- }
+- }
+ cmd[0x16] = dev->threshold;
+ cmd[0x17] = dev->doc_source;
+
+@@ -843,7 +709,6 @@ dev_inquiry(struct device *dev)
+ dev->res[0x3e] << 8 |
+ dev->res[0x3f];
+ dev->line_order = dev->res[0x31];
+- dev->compressionTypes = dev->res[0x32];
+ dev->doc_loaded = (dev->res[0x35] == 0x02) &&
+ (dev->res[0x26] & 0x03);
+
+@@ -942,10 +807,6 @@ dev_free(struct device *dev)
+ free(UNCONST(dev->sane.type));
+ if (dev->data)
+ free(dev->data);
+- if (dev->decData) {
+- free(dev->decData);
+- dev->decData = NULL;
+- }
+ memset(dev, 0, sizeof(*dev));
+ free(dev);
+ }
+@@ -1283,19 +1144,6 @@ sane_read(SANE_Handle h, SANE_Byte *buf, SANE_Int maxlen, SANE_Int *lenp)
+ /* if there is no data to read or output from buffer */
+ if (!dev->blocklen && dev->datalen <= PADDING_SIZE) {
+
+- /* copying uncompressed data */
+- if (dev->composition == MODE_RGB24 &&
+- isSupportedDevice(dev) &&
+- dev->decDataSize > 0) {
+- int diff = dev->total_img_size - dev->total_out_size;
+- int bufLen = (diff < maxlen) ? diff : maxlen;
+- if (0 < diff &&
+- 0 < copy_decompress_data(dev, buf, bufLen, lenp)) {
+- dev->total_out_size += *lenp;
+- return SANE_STATUS_GOOD;
+- }
+- }
+-
+ /* and we don't need to acquire next block */
+ if (dev->final_block) {
+ int slack = dev->total_img_size - dev->total_out_size;
+@@ -1311,10 +1159,7 @@ sane_read(SANE_Handle h, SANE_Byte *buf, SANE_Int maxlen, SANE_Int *lenp)
+ /* this will never happen */
+ DBG(1, "image overflow %d bytes\n", dev->total_img_size - dev->total_out_size);
+ }
+- if (isSupportedDevice(dev) &&
+- dev->composition == MODE_RGB24) {
+- remove(encTmpFileName);
+- }
++
+ /* that's all */
+ dev_stop(dev);
+ return SANE_STATUS_EOF;
+@@ -1365,18 +1210,9 @@ sane_read(SANE_Handle h, SANE_Byte *buf, SANE_Int maxlen, SANE_Int *lenp)
+
+ if (buf && lenp) { /* read mode */
+ /* copy will do minimal of valid data */
+- if (dev->para.format == SANE_FRAME_RGB && dev->line_order) {
+- if (isSupportedDevice(dev)) {
+- clrlen = dump_to_tmp_file(dev);
+- /* decompress after reading entire block data*/
+- if (0 == dev->blocklen) {
+- decompress_tempfile(dev);
+- }
+- copy_decompress_data(dev, buf, maxlen, &olen);
+- } else {
+- clrlen = copy_mix_bands_trim(dev, buf, maxlen, &olen);
+- }
+- } else
++ if (dev->para.format == SANE_FRAME_RGB && dev->line_order)
++ clrlen = copy_mix_bands_trim(dev, buf, maxlen, &olen);
++ else
+ clrlen = copy_plain_trim(dev, buf, maxlen, &olen);
+
+ dev->datalen -= clrlen;
+@@ -1455,9 +1291,6 @@ sane_start(SANE_Handle h)
+ if (!dev->data && !(dev->data = malloc(DATASIZE)))
+ return ret_cancel(dev, SANE_STATUS_NO_MEM);
+
+- if (!dev->decData && !(dev->decData = malloc(POST_DATASIZE)))
+- return ret_cancel(dev, SANE_STATUS_NO_MEM);
+-
+ if (!dev_acquire(dev))
+ return dev->state;
+
+@@ -1479,22 +1312,6 @@ sane_start(SANE_Handle h)
+
+ dev->total_img_size = dev->para.bytes_per_line * dev->para.lines;
+
+- if (isSupportedDevice(dev) &&
+- dev->composition == MODE_RGB24) {
+- int fd;
+- remove(encTmpFileName);
+-
+- /* Precreate temporary file in exclusive mode. */
+- fd = open(encTmpFileName, O_CREAT|O_EXCL, 0600);
+- if (fd == -1) {
+- DBG(3, "%s: %p, can't create temporary file %s: %s\n", __func__,
+- (void *)dev, encTmpFileName, strerror(errno));
+- return ret_cancel(dev, SANE_STATUS_ACCESS_DENIED);
+- }
+- close(fd);
+- }
+- dev->currentDecDataIndex = 0;
+-
+ return SANE_STATUS_GOOD;
+ }
+
+diff --git a/backend/xerox_mfp.h b/backend/xerox_mfp.h
+index 3d93f06d..ea89dda2 100644
+--- a/backend/xerox_mfp.h
++++ b/backend/xerox_mfp.h
+@@ -74,10 +74,6 @@ struct device {
+ #define DATATAIL(dev) ((dev->dataoff + dev->datalen) & DATAMASK)
+ #define DATAROOM(dev) dataroom(dev)
+
+-#define POST_DATASIZE 0xFFFFFF
+- SANE_Byte *decData;
+- int decDataSize;
+- int currentDecDataIndex;
+ /* data from CMD_INQUIRY: */
+ int resolutions; /* supported resolution bitmask */
+ int compositions; /* supported image compositions bitmask */
+@@ -102,7 +98,6 @@ struct device {
+ int composition; /* MODE_ */
+ int doc_source; /* document source */
+ int threshold; /* brightness */
+- int compressionTypes;
+
+ /* CMD_READ data. It is per block only, image could be in many blocks */
+ int blocklen; /* image data block len (padding incl.) */
+diff --git a/doc/descriptions/xerox_mfp.desc b/doc/descriptions/xerox_mfp.desc
+index d21a6be6..67253b38 100644
+--- a/doc/descriptions/xerox_mfp.desc
++++ b/doc/descriptions/xerox_mfp.desc
+@@ -320,7 +320,7 @@
+
+ :model "SCX-3405W"
+ :interface "Ethernet"
+-:status :good
++:status :basic
+
+ :model "SCX-3400"
+ :interface "USB"
+@@ -335,17 +335,17 @@
+ :model "SCX-4729FD"
+ :interface "USB"
+ :usbid "0x04e8" "0x3453"
+-:status :good
++:status :basic
+
+ :model "CLX-6260"
+ :interface "USB"
+ :usbid "0x04e8" "0x3455"
+-:status :good
++:status :minimal
+
+ :model "CLX-3300 Series"
+ :interface "USB"
+ :usbid "0x04e8" "0x3456"
+-:status :good
++:status :basic
+
+ :model "SCX-470x"
+ :interface "USB"
+@@ -355,7 +355,7 @@
+ :model "CLX-4190"
+ :interface "USB"
+ :usbid "0x04e8" "0x345a"
+-:status :good
++:status :minimal
+
+ :model "SCX-4650 4x21S Series"
+ :interface "USB"
+--
+2.17.0
+
diff --git a/media-gfx/sane-backends/files/sane-backends-1.0.27-uninitialized-variable.patch b/media-gfx/sane-backends/files/sane-backends-1.0.27-uninitialized-variable.patch
new file mode 100644
index 000000000000..0311975c0ce8
--- /dev/null
+++ b/media-gfx/sane-backends/files/sane-backends-1.0.27-uninitialized-variable.patch
@@ -0,0 +1,25 @@
+From dd61ef1cc84299781e382b9258d97102cee192b4 Mon Sep 17 00:00:00 2001
+From: Olaf Meeuwissen <paddy-hack@member.fsf.org>
+Date: Thu, 3 Aug 2017 18:50:05 +0900
+Subject: [PATCH] genesys: Fix use of uninitialized variable
+
+See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=869673
+---
+ backend/genesys.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/backend/genesys.c b/backend/genesys.c
+index 1c1bbf4..0b644c4 100644
+--- a/backend/genesys.c
++++ b/backend/genesys.c
+@@ -6237,6 +6237,7 @@ attach (SANE_String_Const devname, Genesys_Device ** devp, SANE_Bool may_wait)
+ dev->model = genesys_usb_device_list[i].model;
+ dev->vendorId = genesys_usb_device_list[i].vendor;
+ dev->productId = genesys_usb_device_list[i].product;
++ dev->usb_mode = 0; /* i.e. unset */
+ dev->already_initialized = SANE_FALSE;
+
+ DBG (DBG_info, "attach: found %s flatbed scanner %s at %s\n",
+--
+2.1.4
+
diff --git a/media-gfx/sane-backends/sane-backends-1.0.27-r2.ebuild b/media-gfx/sane-backends/sane-backends-1.0.27-r2.ebuild
new file mode 100644
index 000000000000..4ce3733007d1
--- /dev/null
+++ b/media-gfx/sane-backends/sane-backends-1.0.27-r2.ebuild
@@ -0,0 +1,344 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit flag-o-matic multilib-minimal systemd toolchain-funcs udev user
+
+# gphoto and v4l are handled by their usual USE flags.
+# The pint backend was disabled because I could not get it to compile.
+IUSE_SANE_BACKENDS="
+ abaton
+ agfafocus
+ apple
+ artec
+ artec_eplus48u
+ as6e
+ avision
+ bh
+ canon
+ canon630u
+ canon_dr
+ canon_pp
+ cardscan
+ coolscan
+ coolscan2
+ coolscan3
+ dc210
+ dc240
+ dc25
+ dell1600n_net
+ dmc
+ epjitsu
+ epson
+ epson2
+ fujitsu
+ genesys
+ gt68xx
+ hp
+ hp3500
+ hp3900
+ hp4200
+ hp5400
+ hp5590
+ hpljm1005
+ hpsj5s
+ hs2p
+ ibm
+ kodak
+ kodakaio
+ kvs1025
+ kvs20xx
+ kvs40xx
+ leo
+ lexmark
+ ma1509
+ magicolor
+ matsushita
+ microtek
+ microtek2
+ mustek
+ mustek_pp
+ mustek_usb
+ mustek_usb2
+ nec
+ net
+ niash
+ p5
+ pie
+ pixma
+ plustek
+ plustek_pp
+ pnm
+ qcam
+ ricoh
+ rts8891
+ s9036
+ sceptre
+ sharp
+ sm3600
+ sm3840
+ snapscan
+ sp15c
+ st400
+ stv680
+ tamarack
+ teco1
+ teco2
+ teco3
+ test
+ u12
+ umax
+ umax1220u
+ umax_pp
+ xerox_mfp"
+
+IUSE="gphoto2 ipv6 snmp systemd threads usb v4l xinetd zeroconf"
+
+for backend in ${IUSE_SANE_BACKENDS}; do
+ case ${backend} in
+ # Disable backends that require parallel ports as no one has those anymore.
+ canon_pp|hpsj5s|mustek_pp|\
+ pnm)
+ IUSE+=" -sane_backends_${backend}"
+ ;;
+ mustek_usb2|kvs40xx)
+ IUSE+=" sane_backends_${backend}"
+ ;;
+ *)
+ IUSE+=" +sane_backends_${backend}"
+ esac
+done
+
+REQUIRED_USE="
+ sane_backends_mustek_usb2? ( threads )
+ sane_backends_kvs40xx? ( threads )
+"
+
+DESCRIPTION="Scanner Access Now Easy - Backends"
+HOMEPAGE="http://www.sane-project.org/"
+MY_P="${P}"
+FRS_ID="4224"
+SRC_URI="https://alioth.debian.org/frs/download.php/file/${FRS_ID}/${P}.tar.gz"
+
+LICENSE="GPL-2 public-domain"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
+
+RDEPEND="
+ sane_backends_dc210? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] )
+ sane_backends_dc240? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] )
+ sane_backends_dell1600n_net? (
+ >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}]
+ >=media-libs/tiff-3.9.7-r1:0=[${MULTILIB_USEDEP}]
+ )
+ sane_backends_canon_pp? ( >=sys-libs/libieee1284-0.2.11-r3[${MULTILIB_USEDEP}] )
+ sane_backends_hpsj5s? ( >=sys-libs/libieee1284-0.2.11-r3[${MULTILIB_USEDEP}] )
+ sane_backends_mustek_pp? ( >=sys-libs/libieee1284-0.2.11-r3[${MULTILIB_USEDEP}] )
+ usb? ( >=virtual/libusb-1-r1:1=[${MULTILIB_USEDEP}] )
+ gphoto2? (
+ >=media-libs/libgphoto2-2.5.3.1:=[${MULTILIB_USEDEP}]
+ >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}]
+ )
+ v4l? ( >=media-libs/libv4l-0.9.5[${MULTILIB_USEDEP}] )
+ xinetd? ( sys-apps/xinetd )
+ snmp? ( net-analyzer/net-snmp )
+ systemd? ( sys-apps/systemd:0= )
+ zeroconf? ( >=net-dns/avahi-0.6.31-r2[${MULTILIB_USEDEP}] )
+"
+
+DEPEND="${RDEPEND}
+ v4l? ( sys-kernel/linux-headers )
+ >=sys-devel/gettext-0.18.1
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
+"
+
+MULTILIB_CHOST_TOOLS=(
+ /usr/bin/sane-config
+)
+
+pkg_setup() {
+ enewgroup scanner
+ enewuser saned -1 -1 -1 scanner
+}
+
+src_prepare() {
+ default
+
+ cat >> backend/dll.conf.in <<-EOF
+ # Add support for the HP-specific backend. Needs net-print/hplip installed.
+ hpaio
+ # Add support for the Epson-specific backend. Needs media-gfx/iscan installed.
+ epkowa
+ EOF
+
+ eapply "${FILESDIR}"/${PN}-1.0.24-saned_pidfile_location.patch
+ eapply "${FILESDIR}"/${PN}-1.0.27-disable-usb-tests.patch
+
+ # From Arch
+ eapply "${FILESDIR}"/${PN}-1.0.27-network.patch
+
+ # From Fedora
+ # Fix https://bugs.gentoo.org/635348
+ eapply "${FILESDIR}"/${PN}-1.0.27-canon-lide-100.patch
+ # Fix https://bugs.gentoo.org/653300
+ eapply "${FILESDIR}"/${PN}-1.0.27-revert-samsung.patch
+
+ # From Debian
+ eapply "${FILESDIR}"/${PN}-1.0.27-uninitialized-variable.patch
+
+ # Fix for "make check". Upstream sometimes forgets to update this.
+ local ver=$(./configure --version | awk '{print $NF; exit 0}')
+ sed -i \
+ -e "/by sane-desc 3.5 from sane-backends/s:sane-backends .*:sane-backends ${ver}:" \
+ testsuite/tools/data/html* || die
+}
+
+src_configure() {
+ append-flags -fno-strict-aliasing # From Fedora
+
+ # if LINGUAS is set, just use the listed and supported localizations.
+ if [[ ${LINGUAS+set} == "set" ]]; then
+ mkdir -p po || die
+ strip-linguas -u po
+ printf '%s\n' ${LINGUAS} > po/LINGUAS
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ # the blank is intended - an empty string would result in building ALL backends.
+ local BACKENDS=" "
+
+ use gphoto2 && BACKENDS="gphoto2"
+ use v4l && BACKENDS="${BACKENDS} v4l"
+ for backend in ${IUSE_SANE_BACKENDS}; do
+ if use "sane_backends_${backend}" && [ ${backend} != pnm ]; then
+ BACKENDS="${BACKENDS} ${backend}"
+ fi
+ done
+
+ local myconf=(
+ $(use_with usb)
+ $(multilib_native_use_with snmp)
+ )
+
+ # you can only enable this backend, not disable it...
+ if use sane_backends_pnm; then
+ myconf+=( --enable-pnm-backend )
+ fi
+ if use sane_backends_mustek_pp; then
+ myconf+=( --enable-parport-directio )
+ fi
+ if ! { use sane_backends_canon_pp || use sane_backends_hpsj5s || use sane_backends_mustek_pp; }; then
+ myconf+=( sane_cv_use_libieee1284=no )
+ fi
+
+ # relative path must be used for tests to work properly
+ ECONF_SOURCE=${S} \
+ SANEI_JPEG="sanei_jpeg.o" SANEI_JPEG_LO="sanei_jpeg.lo" \
+ BACKENDS="${BACKENDS}" \
+ # All distributions pass --disable-locking because /var/lock/sane/ would be a world-writable directory
+ # --without-api-spec to not automagically depend on tons of stuff
+ # that break in many ways, bug #636202, #668232, #668350
+ # People can refer to the "Programmer's Documentation" at http://www.sane-project.org/docs.html
+ econf \
+ --disable-locking \
+ --without-api-spec \
+ $(use_with gphoto2) \
+ $(multilib_native_use_with systemd) \
+ $(use_with v4l) \
+ $(use_enable ipv6) \
+ $(use_enable threads pthread) \
+ $(use_enable zeroconf avahi) \
+ "${myconf[@]}"
+}
+
+multilib_src_compile() {
+ emake VARTEXFONTS="${T}/fonts"
+
+ if tc-is-cross-compiler; then
+ pushd "${BUILD_DIR}"/tools >/dev/null || die
+
+ # The build system sucks and doesn't handle this properly.
+ # https://alioth.debian.org/tracker/index.php?func=detail&aid=314236&group_id=30186&atid=410366
+ tc-export_build_env BUILD_CC
+ ${BUILD_CC} ${BUILD_CPPFLAGS} ${BUILD_CFLAGS} ${BUILD_LDFLAGS} \
+ -I. -I../include -I"${S}"/include \
+ "${S}"/sanei/sanei_config.c "${S}"/sanei/sanei_constrain_value.c \
+ "${S}"/sanei/sanei_init_debug.c "${S}"/tools/sane-desc.c -o sane-desc || die
+ local dirs=( hal hotplug hotplug-ng udev )
+ local targets=(
+ hal/libsane.fdi
+ hotplug/libsane.usermap
+ hotplug-ng/libsane.db
+ udev/libsane.rules
+ )
+ mkdir -p "${dirs[@]}" || die
+ emake "${targets[@]}"
+
+ popd >/dev/null
+ fi
+
+ if use usb; then
+ sed -i -e '/^$/d' \
+ tools/hotplug/libsane.usermap || die
+ fi
+}
+
+multilib_src_install() {
+ emake INSTALL_LOCKPATH="" DESTDIR="${D}" install \
+ docdir="${EPREFIX}"/usr/share/doc/${PF}
+
+ if multilib_is_native_abi; then
+ if use usb; then
+ insinto /etc/hotplug/usb
+ doins tools/hotplug/libsane.usermap
+ fi
+
+ udev_newrules tools/udev/libsane.rules 41-libsane.rules
+ insinto "/usr/share/pkgconfig"
+ doins tools/sane-backends.pc
+ fi
+}
+
+multilib_src_install_all() {
+ keepdir /var/lib/lock/sane
+ fowners root:scanner /var/lib/lock/sane
+ fperms g+w /var/lib/lock/sane
+ dodir /etc/env.d
+
+ if use systemd; then
+ systemd_newunit "${FILESDIR}"/saned_at.service "saned@.service"
+ systemd_newunit "${FILESDIR}"/saned.socket saned.socket
+ fi
+
+ if use usb; then
+ exeinto /etc/hotplug/usb
+ doexe tools/hotplug/libusbscanner
+ newdoc tools/hotplug/README README.hotplug
+ fi
+
+ dodoc NEWS AUTHORS ChangeLog* PROBLEMS README README.linux
+ find "${D}" -name '*.la' -delete || die
+
+ if use xinetd; then
+ insinto /etc/xinetd.d
+ doins "${FILESDIR}"/saned
+ fi
+
+ newinitd "${FILESDIR}"/saned.initd saned
+ newconfd "${FILESDIR}"/saned.confd saned
+}
+
+pkg_postinst() {
+ if use xinetd; then
+ elog "If you want remote clients to connect, edit"
+ elog "/etc/sane.d/saned.conf and /etc/hosts.allow"
+ fi
+
+ if ! use systemd; then
+ elog "If you are using a USB scanner, add all users who want"
+ elog "to access your scanner to the \"scanner\" group."
+ fi
+}