Compare commits

..

No commits in common. "c8" and "c9" have entirely different histories.
c8 ... c9

12 changed files with 333 additions and 898 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/sane-backends-1.0.27.tar.gz SOURCES/sane-backends-1.0.32.tar.gz
SOURCES/sane.png SOURCES/sane.png

View File

@ -1,2 +1,2 @@
579ec4d6279c7f0f02014358a7e74056672a1e43 SOURCES/sane-backends-1.0.27.tar.gz 97b14808e1ab4bc4c38962372d13d37d9b9fb08b SOURCES/sane-backends-1.0.32.tar.gz
338783a09c91bf1cc1a3bda838a9e7568563e02e SOURCES/sane.png 338783a09c91bf1cc1a3bda838a9e7568563e02e SOURCES/sane.png

View File

@ -1,225 +0,0 @@
diff -up sane-backends-1.0.27/backend/epson2_net.c.epsonds-issues sane-backends-1.0.27/backend/epson2_net.c
--- sane-backends-1.0.27/backend/epson2_net.c.epsonds-issues 2016-10-06 02:02:57.000000000 +0200
+++ sane-backends-1.0.27/backend/epson2_net.c 2020-07-28 15:04:58.385405722 +0200
@@ -32,11 +32,12 @@
#include "sane/sanei_debug.h"
-static int
+static ssize_t
sanei_epson_net_read_raw(Epson_Scanner *s, unsigned char *buf, ssize_t wanted,
SANE_Status *status)
{
- int ready, read = -1;
+ int ready;
+ ssize_t read = -1;
fd_set readable;
struct timeval tv;
@@ -62,111 +63,136 @@ sanei_epson_net_read_raw(Epson_Scanner *
return read;
}
-int
-sanei_epson_net_read(Epson_Scanner *s, unsigned char *buf, ssize_t wanted,
+static ssize_t
+sanei_epson_net_read_buf(Epson_Scanner *s, unsigned char *buf, ssize_t wanted,
SANE_Status * status)
{
- ssize_t size;
ssize_t read = 0;
- unsigned char header[12];
- /* read from buffer, if available */
- if (s->netptr != s->netbuf) {
- DBG(23, "reading %lu from buffer at %p, %lu available\n",
- (u_long) wanted, s->netptr, (u_long) s->netlen);
+ DBG(23, "%s: reading up to %lu from buffer at %p, %lu available\n",
+ __func__, (u_long) wanted, s->netptr, (u_long) s->netlen);
- memcpy(buf, s->netptr, wanted);
- read = wanted;
+ if ((size_t) wanted > s->netlen) {
+ *status = SANE_STATUS_IO_ERROR;
+ wanted = s->netlen;
+ }
- s->netlen -= wanted;
+ memcpy(buf, s->netptr, wanted);
+ read = wanted;
- if (s->netlen == 0) {
- DBG(23, "%s: freeing %p\n", __func__, s->netbuf);
- free(s->netbuf);
- s->netbuf = s->netptr = NULL;
- s->netlen = 0;
- }
+ s->netptr += read;
+ s->netlen -= read;
- return read;
+ if (s->netlen == 0) {
+ DBG(23, "%s: freeing %p\n", __func__, s->netbuf);
+ free(s->netbuf);
+ s->netbuf = s->netptr = NULL;
+ s->netlen = 0;
+ }
+
+ return read;
+}
+
+ssize_t
+sanei_epson_net_read(Epson_Scanner *s, unsigned char *buf, ssize_t wanted,
+ SANE_Status * status)
+{
+ if (wanted < 0) {
+ *status = SANE_STATUS_INVAL;
+ return 0;
+ }
+
+ size_t size;
+ ssize_t read = 0;
+ unsigned char header[12];
+
+ /* read from remainder of buffer */
+ if (s->netptr) {
+ return sanei_epson_net_read_buf(s, buf, wanted, status);
}
/* receive net header */
- size = sanei_epson_net_read_raw(s, header, 12, status);
- if (size != 12) {
+ read = sanei_epson_net_read_raw(s, header, 12, status);
+ if (read != 12) {
return 0;
}
+ /* validate header */
if (header[0] != 'I' || header[1] != 'S') {
DBG(1, "header mismatch: %02X %02x\n", header[0], header[1]);
*status = SANE_STATUS_IO_ERROR;
return 0;
}
+ /* parse payload size */
size = be32atoh(&header[6]);
- DBG(23, "%s: wanted = %lu, available = %lu\n", __func__,
- (u_long) wanted, (u_long) size);
-
*status = SANE_STATUS_GOOD;
- if (size == wanted) {
-
- DBG(15, "%s: full read\n", __func__);
+ if (!s->netbuf) {
+ DBG(15, "%s: direct read\n", __func__);
+ DBG(23, "%s: wanted = %lu, available = %lu\n", __func__,
+ (u_long) wanted, (u_long) size);
- read = sanei_epson_net_read_raw(s, buf, size, status);
-
- if (s->netbuf) {
- free(s->netbuf);
- s->netbuf = NULL;
- s->netlen = 0;
+ if ((size_t) wanted > size) {
+ wanted = size;
}
- if (read < 0) {
- return 0;
- }
-
-/* } else if (wanted < size && s->netlen == size) { */
+ read = sanei_epson_net_read_raw(s, buf, wanted, status);
} else {
- DBG(23, "%s: partial read\n", __func__);
+ DBG(15, "%s: buffered read\n", __func__);
+ DBG(23, "%s: bufferable = %lu, available = %lu\n", __func__,
+ (u_long) s->netlen, (u_long) size);
- read = sanei_epson_net_read_raw(s, s->netbuf, size, status);
- if (read != size) {
- return 0;
+ if (s->netlen > size) {
+ s->netlen = size;
}
- s->netlen = size - wanted;
- s->netptr += wanted;
- read = wanted;
-
- DBG(23, "0,4 %02x %02x\n", s->netbuf[0], s->netbuf[4]);
- DBG(23, "storing %lu to buffer at %p, next read at %p, %lu bytes left\n",
- (u_long) size, s->netbuf, s->netptr, (u_long) s->netlen);
+ /* fill buffer */
+ read = sanei_epson_net_read_raw(s, s->netbuf, s->netlen, status);
+ s->netptr = s->netbuf;
+ s->netlen = (read > 0 ? read : 0);
- memcpy(buf, s->netbuf, wanted);
+ /* copy wanted part */
+ read = sanei_epson_net_read_buf(s, buf, wanted, status);
}
return read;
}
-
-int
+size_t
sanei_epson_net_write(Epson_Scanner *s, unsigned int cmd, const unsigned char *buf,
size_t buf_size, size_t reply_len, SANE_Status *status)
{
unsigned char *h1, *h2, *payload;
unsigned char *packet = malloc(12 + 8 + buf_size);
- /* XXX check allocation failure */
+ if (!packet) {
+ *status = SANE_STATUS_NO_MEM;
+ return 0;
+ }
h1 = packet;
h2 = packet + 12;
payload = packet + 12 + 8;
if (reply_len) {
- s->netbuf = s->netptr = malloc(reply_len);
+ if (s->netbuf) {
+ DBG(23, "%s, freeing %p, %ld bytes unprocessed\n",
+ __func__, s->netbuf, (u_long) s->netlen);
+ free(s->netbuf);
+ s->netbuf = s->netptr = NULL;
+ s->netlen = 0;
+ }
+ s->netbuf = malloc(reply_len);
+ if (!s->netbuf) {
+ free(packet);
+ *status = SANE_STATUS_NO_MEM;
+ return 0;
+ }
s->netlen = reply_len;
- DBG(24, "allocated %lu bytes at %p\n",
- (u_long) reply_len, s->netbuf);
+ DBG(24, "%s: allocated %lu bytes at %p\n", __func__,
+ (u_long) s->netlen, s->netbuf);
}
DBG(24, "%s: cmd = %04x, buf = %p, buf_size = %lu, reply_len = %lu\n",
diff -up sane-backends-1.0.27/backend/epson2_net.h.epsonds-issues sane-backends-1.0.27/backend/epson2_net.h
--- sane-backends-1.0.27/backend/epson2_net.h.epsonds-issues 2016-10-06 02:02:57.000000000 +0200
+++ sane-backends-1.0.27/backend/epson2_net.h 2020-07-28 14:51:59.666593530 +0200
@@ -4,9 +4,9 @@
#include <sys/types.h>
#include "../include/sane/sane.h"
-extern int sanei_epson_net_read(struct Epson_Scanner *s, unsigned char *buf, ssize_t buf_size,
+extern ssize_t sanei_epson_net_read(struct Epson_Scanner *s, unsigned char *buf, ssize_t buf_size,
SANE_Status *status);
-extern int sanei_epson_net_write(struct Epson_Scanner *s, unsigned int cmd, const unsigned char *buf,
+extern size_t sanei_epson_net_write(struct Epson_Scanner *s, unsigned int cmd, const unsigned char *buf,
size_t buf_size, size_t reply_len,
SANE_Status *status);
extern SANE_Status sanei_epson_net_lock(struct Epson_Scanner *s);

View File

@ -1,72 +0,0 @@
From b9b0173409df73e235da2aa0dae5edd21fb55967 Mon Sep 17 00:00:00 2001
From: Olaf Meeuwissen <paddy-hack@member.fsf.org>
Date: Mon, 27 Apr 2020 18:48:29 +0900
Subject: [PATCH] epsonds: Prevent possible buffer overflow when reading image
data
Addresses GHSL-2020-084, re #279.
---
backend/epsonds-cmd.c | 5 +++++
backend/epsonds.c | 12 +++++++-----
backend/epsonds.h | 1 +
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/backend/epsonds-cmd.c b/backend/epsonds-cmd.c
index 9a4db3080..c182aa51a 100644
--- a/backend/epsonds-cmd.c
+++ b/backend/epsonds-cmd.c
@@ -876,6 +876,11 @@ esci2_img(struct epsonds_scanner *s, SANE_Int *length)
return parse_status;
}
+ /* more data than was accounted for in s->buf */
+ if (more > s->bsz) {
+ return SANE_STATUS_IO_ERROR;
+ }
+
/* ALWAYS read image data */
if (s->hw->connection == SANE_EPSONDS_NET) {
epsonds_net_request_read(s, more);
diff --git a/backend/epsonds.c b/backend/epsonds.c
index ff5d68106..fb9694a88 100644
--- a/backend/epsonds.c
+++ b/backend/epsonds.c
@@ -1230,16 +1230,18 @@ sane_start(SANE_Handle handle)
if (s->line_buffer == NULL)
return SANE_STATUS_NO_MEM;
- /* ring buffer for front page, twice bsz */
+ /* transfer buffer size, bsz */
/* XXX read value from scanner */
- status = eds_ring_init(&s->front, (65536 * 4) * 2);
+ s->bsz = (65536 * 4);
+
+ /* ring buffer for front page */
+ status = eds_ring_init(&s->front, s->bsz * 2);
if (status != SANE_STATUS_GOOD) {
return status;
}
- /* transfer buffer, bsz */
- /* XXX read value from scanner */
- s->buf = realloc(s->buf, 65536 * 4);
+ /* transfer buffer */
+ s->buf = realloc(s->buf, s->bsz);
if (s->buf == NULL)
return SANE_STATUS_NO_MEM;
diff --git a/backend/epsonds.h b/backend/epsonds.h
index 0427ef3b4..401b0f32c 100644
--- a/backend/epsonds.h
+++ b/backend/epsonds.h
@@ -160,6 +160,7 @@ struct epsonds_scanner
Option_Value val[NUM_OPTIONS];
SANE_Parameters params;
+ size_t bsz; /* transfer buffer size */
SANE_Byte *buf, *line_buffer;
ring_buffer *current, front, back;
--
2.25.4

View File

@ -1,2 +1,2 @@
# udev rule for saned (SANE scanning daemon) to be able to write on usb port # udev rule for saned (SANE scanning daemon) to be able to write on usb port
ENV{libsane_matched}=="yes", RUN+="/usr/bin/setfacl -m g:saned:rw $env{DEVNAME}" ENV{libsane_matched}=="yes", ENV{DEVNAME}!="", RUN+="/usr/bin/setfacl -m g:saned:rw $env{DEVNAME}"

View File

@ -1,36 +1,18 @@
From 031cd8dd376ed6537afd06ca5aec5e67f5da0489 Mon Sep 17 00:00:00 2001 diff -up sane-backends-1.0.28/ltmain.sh.soname sane-backends-1.0.28/ltmain.sh
From: Nils Philippsen <nils@redhat.com> --- sane-backends-1.0.28/ltmain.sh.soname 2019-09-12 09:57:10.979802716 +0200
Date: Fri, 31 Aug 2012 16:14:49 +0200 +++ sane-backends-1.0.28/ltmain.sh 2019-09-12 10:27:21.719895206 +0200
Subject: [PATCH] patch: soname @@ -9615,23 +9615,6 @@ EOF
Squashed commit of the following:
commit 2035ced803168210a70c4946814440764e5d0186
Author: Nils Philippsen <nils@redhat.com>
Date: Fri Aug 31 16:13:51 2012 +0200
don't use the same SONAME for backend libs and main lib
---
ltmain.sh | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/ltmain.sh b/ltmain.sh
index f3eb4c8..17d1508 100755
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -8101,25 +8101,6 @@ EOF
dlname=$soname dlname=$soname
fi fi
- # Local change for sane-backends: internal name for every lib
- # is "libsane" not "libsane-backendname". So linking to each
- # backend is possible. Also the following test was moved to this
- # location.
- # If -module or -export-dynamic was specified, set the dlname - # If -module or -export-dynamic was specified, set the dlname
- if test "$module" = yes || test "$export_dynamic" = yes; then - if test "$module" = yes || test "$export_dynamic" = yes; then
- # On all known operating systems, these are identical. - # On all known operating systems, these are identical.
- dlname="$soname" - dlname="$soname"
- fi - fi
-
- # On sane-backends the internal name for every lib is "libsane"
- # not "libsane-backendname" so that linking to each backend is possible.
- case $host in - case $host in
- *mingw*) - *mingw*)
- ;; - ;;
@ -39,11 +21,7 @@ index f3eb4c8..17d1508 100755
- *) - *)
- soname=`echo $soname | sed -e "s/libsane-[A-Za-z_0-9]*/libsane/g"` - soname=`echo $soname | sed -e "s/libsane-[A-Za-z_0-9]*/libsane/g"`
- esac - esac
- # End of local change
- -
lib="$output_objdir/$realname" lib=$output_objdir/$realname
linknames= linknames=
for link for link
--
1.7.11.4

View File

@ -1,17 +0,0 @@
diff -up sane-backends-1.0.27/backend/genesys.c.canon-lide-100 sane-backends-1.0.27/backend/genesys.c
--- sane-backends-1.0.27/backend/genesys.c.canon-lide-100 2018-02-01 10:37:26.160044539 +0100
+++ sane-backends-1.0.27/backend/genesys.c 2018-02-01 10:45:44.616653277 +0100
@@ -2070,11 +2070,9 @@ genesys_white_shading_calibration (Genes
dev->model->cmd_set->set_lamp_power (dev, dev->calib_reg, SANE_TRUE);
dev->model->cmd_set->set_motor_power (dev->calib_reg, motor);
- /* if needed, go back before doin next scan, by using rewind, registers and
- * slopes table are kept intact from previous scan */
- if (dev->model->flags & GENESYS_FLAG_SHADING_REPARK && dev->model->cmd_set->rewind)
+ if (dev->model->flags & GENESYS_FLAG_SHADING_REPARK)
{
- status = dev->model->cmd_set->rewind (dev);
+ status = dev->model->cmd_set->slow_back_home (dev, SANE_TRUE);
}
status =

View File

@ -1,406 +0,0 @@
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

View File

@ -1,28 +0,0 @@
diff -up sane-backends-1.0.27/doc/saned.man.saned-manpage sane-backends-1.0.27/doc/saned.man
--- sane-backends-1.0.27/doc/saned.man.saned-manpage 2017-11-27 12:42:05.077326419 +0100
+++ sane-backends-1.0.27/doc/saned.man 2017-11-27 12:43:21.169769553 +0100
@@ -223,8 +223,22 @@ installed on the system. this is the pre
Saned can be used wih systemd without the systemd integration
compiled in, but then logging of debug information is not supported.
-The systemd configuration is different for the 2 options, so
-both are described below.
+The systemd configuration is different for the 2 options, but you need
+to create unit files in both options and then run as root:
+.PP
+.RS
+systemctl start saned.socket
+.RE
+.PP
+to start saned. If you want to have saned.socket running after startup, run as
+root:
+.PP
+.RS
+systemctl enable saned.socket
+.RE
+.PP
+
+The systemd configuration of both options is described below.
.SH Systemd configuration for saned with systemd support compiled in
for the systemd configuration we need to add 2 configuration files in
.I /etc/systemd/system.

View File

@ -0,0 +1 @@
u saned - "SANE scanner daemon user" /usr/share/sane /sbin/nologin

View File

@ -0,0 +1,36 @@
diff --git a/backend/epson2-ops.c b/backend/epson2-ops.c
index 83a0169..573ebcf 100644
--- a/backend/epson2-ops.c
+++ b/backend/epson2-ops.c
@@ -291,14 +291,14 @@ e2_dev_post_init(struct Epson_Device *dev)
dev->need_reset_on_source_change = SANE_FALSE;
if (e2_dev_model(dev, "ES-9000H") || e2_dev_model(dev, "GT-30000")) {
- dev->cmd->set_focus_position = 0;
dev->cmd->feed = 0x19;
+ dev->focusSupport = SANE_FALSE;
}
if (e2_dev_model(dev, "GT-8200") || e2_dev_model(dev, "Perfection1650")
|| e2_dev_model(dev, "Perfection1640") || e2_dev_model(dev, "GT-8700")) {
dev->cmd->feed = 0;
- dev->cmd->set_focus_position = 0;
+ dev->focusSupport = SANE_FALSE;
dev->need_reset_on_source_change = SANE_TRUE;
}
@@ -825,12 +825,12 @@ e2_discover_capabilities(Epson_Scanner *s)
if (esci_request_focus_position(s, &s->currentFocusPosition) ==
SANE_STATUS_GOOD) {
- DBG(1, "setting focus is supported, current focus: %u\n", s->currentFocusPosition);
+ DBG(1, "getting focus is supported, current focus: %u\n", s->currentFocusPosition);
dev->focusSupport = SANE_TRUE;
s->opt[OPT_FOCUS_POS].cap &= ~SANE_CAP_INACTIVE;
s->val[OPT_FOCUS_POS].w = s->currentFocusPosition;
} else {
- DBG(1, "setting focus is not supported\n");
+ DBG(1, "getting focus is not supported\n");
dev->focusSupport = SANE_FALSE;
s->opt[OPT_FOCUS_POS].cap |= SANE_CAP_INACTIVE;
s->val[OPT_FOCUS_POS].w = FOCUS_ON_GLASS; /* just in case */

View File

@ -1,50 +1,33 @@
# let -devel require drivers to make them available as multilib # let -devel require drivers to make them available as multilib
%global needs_multilib_quirk 1 %global needs_multilib_quirk 1
%if !0%{?fedora}%{?rhel} || 0%{?fedora} >= 16 || 0%{?rhel} >= 7
%global _hardened_build 1 %global _hardened_build 1
%endif
%if !0%{?fedora}%{?rhel} || 0%{?fedora} >= 17 || 0%{?rhel} >= 7
%global udevdir %{_prefix}/lib/udev
%else
%global udevdir /lib/udev
%endif
%global udevrulesdir %{udevdir}/rules.d
%global udevhwdbdir %{udevdir}/hwdb.d
%if !0%{?fedora}%{?rhel} || 0%{?fedora} >= 18 || 0%{?rhel} >= 7
%global libusb1 1 %global libusb1 1
%else
%global libusb1 0
%endif
%global __provides_exclude_from ^%{_libdir}/sane/.*\.so.*$ %global __provides_exclude_from ^%{_libdir}/sane/.*\.so.*$
%global __requires_exclude ^libsane-.*\.so\.[0-9]*(\(\).*)?+$ %global __requires_exclude ^libsane-.*\.so\.[0-9]*(\(\).*)?+$
%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} >= 20 || 0%{?rhel} >= 8
%global _maindocdir %{_docdir}/%{name} %global _maindocdir %{_docdir}/%{name}
%global _docdocdir %{_docdir}/%{name}-doc %global _docdocdir %{_docdir}/%{name}-doc
%else
%global _maindocdir %{_docdir}/%{name}-%{version}
%global _docdocdir %{_docdir}/%{name}-doc-%{version}
%endif
Summary: Scanner access software Summary: Scanner access software
Name: sane-backends Name: sane-backends
Version: 1.0.27 Version: 1.0.32
Release: 22%{?dist} Release: 7%{?dist}
# lib/ is LGPLv2+, backends are GPLv2+ with exceptions # lib/ is LGPLv2+, backends are GPLv2+ with exceptions
# Tools are GPLv2+, docs are public domain # Tools are GPLv2+, docs are public domain
# see LICENSE for details # see LICENSE for details
License: GPLv2+ and GPLv2+ with exceptions and Public Domain and IJG and LGPLv2+ and MIT License: GPLv2+ and GPLv2+ with exceptions and Public Domain and IJG and LGPLv2+ and MIT
# Alioth Download URLs are amazing. # GitLab Download URLs are amazing. But the source code link has different name and doesnt have generated autotools stuff
Source0: https://gitlab.com/sane-project/backends/uploads/a3ba9fff29253a94e84074917bff581a/%{name}-%{version}.tar.gz Source0: https://gitlab.com/sane-project/backends/uploads/104f09c07d35519cc8e72e604f11643f/%{name}-%{version}.tar.gz
Source1: sane.png Source1: sane.png
Source2: saned.socket Source2: saned.socket
Source3: saned@.service.in Source3: saned@.service.in
Source4: README.Fedora Source4: README.Fedora
Source5: 66-saned.rules Source5: 66-saned.rules
Source6: sane-backends.sysusers
# Fedora-specific, probably not generally applicable: # Fedora-specific, probably not generally applicable:
Patch0: sane-backends-1.0.25-udev.patch Patch0: sane-backends-1.0.25-udev.patch
@ -53,50 +36,49 @@ Patch0: sane-backends-1.0.25-udev.patch
Patch1: sane-backends-1.0.23-soname.patch Patch1: sane-backends-1.0.23-soname.patch
# Fedora-specific (for now): make installed sane-config multi-lib aware again # Fedora-specific (for now): make installed sane-config multi-lib aware again
Patch2: sane-backends-1.0.23-sane-config-multilib.patch Patch2: sane-backends-1.0.23-sane-config-multilib.patch
# saned manpage incomplete and exists when saned is not installed (#1515762) # 1934308 - Several Epson devices cannot scan because they fail to set focus
Patch3: sane-backends-saned-manpage.patch Patch3: sane-epson2-disable-focus.patch
# Black vertical band in color and gray images with Canon LIDE 100 scanner (bug #1540370)
Patch4: sane-backends-canon-lide-100.patch
# Revert samsung patch from upstream (upstream tracker https://alioth.debian.org/tracker/index.php?func=detail&aid=315876&group_id=30186&atid=410366)
Patch5: sane-backends-revert-samsung-patch.patch
# 1852468, 1852467, 1852466, 1852465 - prevent buffer overflow in esci2_img
Patch6: 0001-epsonds-Prevent-possible-buffer-overflow-when-readin.patch
# 1852663, 1848097 - NULL pointer dereference in sanei_epson_net_read function
Patch7: 0001-epson2-Rewrite-network-I-O.patch
URL: http://www.sane-project.org URL: http://www.sane-project.org
BuildRequires: gettext
# gcc is no longer in buildroot by default # gcc is no longer in buildroot by default
BuildRequires: gcc BuildRequires: gcc
# genesys backend is not written in C++, so it is needed as buildrequire
BuildRequires: gcc-c++
BuildRequires: gphoto2-devel
BuildRequires: %{_bindir}/latex BuildRequires: %{_bindir}/latex
BuildRequires: libieee1284-devel
BuildRequires: libjpeg-devel
BuildRequires: libpng-devel
BuildRequires: libtiff-devel
%if %libusb1 %if %libusb1
BuildRequires: libusbx-devel BuildRequires: libusbx-devel
%else %else
BuildRequires: libusb-devel BuildRequires: libusb-devel
%endif %endif
BuildRequires: libieee1284-devel
BuildRequires: libjpeg-devel
BuildRequires: libpng-devel
BuildRequires: libtiff-devel
BuildRequires: libv4l-devel BuildRequires: libv4l-devel
BuildRequires: gettext # uses make
BuildRequires: gphoto2-devel BuildRequires: make
# pixma backend generates header files during build via python script
BuildRequires: python3
BuildRequires: systemd-devel BuildRequires: systemd-devel
BuildRequires: systemd BuildRequires: systemd
# needed by macros in rpm scriptlets
BuildRequires: systemd-rpm-macros
Requires: libpng Requires: libpng
%if 0%{?fedora} >= 32 || 0%{?rhel} > 8
Requires: sane-airscan
%endif
Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: systemd >= 196 Requires: systemd >= 196
Requires: systemd-udev >= 196 Requires: systemd-udev >= 196
Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
# Don't drag around obsoletes forever
%if ! (0%{?fedora} >= 27 || 0%{?rhel} >= 8)
Obsoletes: sane-backends < 1.0.25-3
Conflicts: sane-backends < 1.0.25-3
%endif
# fix for 1852668, 1852667, 1852666, 1852665 - autodiscovery is not supported in epsonds # workaround for Brother scanners, which drivers are built with old libnsl
# backend, so disable it during post scriptlet (grep and sed are needed for the scriptlet) # it is ignored by DNF, but it seems GUI installation apps should offer it
Requires: grep, sed # if it is not installed, it leads to crashes like #1778425
Suggests: libnsl
%description %description
Scanner Access Now Easy (SANE) is a universal scanner interface. The Scanner Access Now Easy (SANE) is a universal scanner interface. The
@ -108,10 +90,6 @@ hand-held scanner, video and still cameras, frame-grabbers, etc.).
Summary: SANE backends documentation Summary: SANE backends documentation
BuildArch: noarch BuildArch: noarch
# Don't drag around obsoletes forever # Don't drag around obsoletes forever
%if 0%{?fedora}%{?rhel} && (0%{?fedora} < 25 || 0%{?rhel} <= 8)
Obsoletes: sane-backends < 1.0.23-10
Conflicts: sane-backends < 1.0.23-10
%endif
%description doc %description doc
This package contains documentation for SANE backends. This package contains documentation for SANE backends.
@ -127,21 +105,21 @@ want to access scanners.
%package devel %package devel
Summary: SANE development toolkit Summary: SANE development toolkit
Requires: sane-backends = %{?epoch:%{epoch}:}%{version}-%{release} Requires: libieee1284-devel
Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} Requires: libjpeg-devel
%if %needs_multilib_quirk Requires: libtiff-devel
Requires: sane-backends-drivers-scanners%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: sane-backends-drivers-cameras%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%endif
%if %libusb1 %if %libusb1
Requires: libusbx-devel Requires: libusbx-devel
%else %else
Requires: libusb-devel Requires: libusb-devel
%endif %endif
Requires: libieee1284-devel
Requires: libjpeg-devel
Requires: libtiff-devel
Requires: pkgconfig Requires: pkgconfig
Requires: sane-backends = %{?epoch:%{epoch}:}%{version}-%{release}
%if %needs_multilib_quirk
Requires: sane-backends-drivers-scanners%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: sane-backends-drivers-cameras%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%endif
Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description devel %description devel
This package contains libraries and header files for writing Scanner Access Now This package contains libraries and header files for writing Scanner Access Now
@ -149,15 +127,10 @@ Easy (SANE) modules.
%package drivers-scanners %package drivers-scanners
Summary: SANE backend drivers for scanners Summary: SANE backend drivers for scanners
# pixma backend now requires libxml2
BuildRequires: libxml2-devel
Requires: sane-backends = %{?epoch:%{epoch}:}%{version}-%{release} Requires: sane-backends = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
# Don't drag around obsoletes forever
%if 0%{?rhel} && 0%{?rhel} < 8
Obsoletes: sane-backends < 1.0.22-4
Obsoletes: sane-backends-libs < 1.0.22-4
Conflicts: sane-backends < 1.0.22-4
Conflicts: sane-backends-libs < 1.0.22-4
%endif
%description drivers-scanners %description drivers-scanners
This package contains backend drivers to access scanner hardware through SANE. This package contains backend drivers to access scanner hardware through SANE.
@ -166,13 +139,6 @@ This package contains backend drivers to access scanner hardware through SANE.
Summary: Scanner backend drivers for digital cameras Summary: Scanner backend drivers for digital cameras
Requires: sane-backends = %{?epoch:%{epoch}:}%{version}-%{release} Requires: sane-backends = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
# Don't drag around obsoletes forever
%if 0%{?rhel} && 0%{?rhel} < 8
Obsoletes: sane-backends-libs-gphoto2 < 1.0.22-4
Conflicts: sane-backends-libs-gphoto2 < 1.0.22-4
Provides: sane-libs-gphoto2 = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: sane-libs-gphoto2%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%endif
%description drivers-cameras %description drivers-cameras
This package contains backend drivers to access digital cameras through SANE. This package contains backend drivers to access digital cameras through SANE.
@ -181,13 +147,6 @@ This package contains backend drivers to access digital cameras through SANE.
Summary: Scanner network daemon Summary: Scanner network daemon
Requires: sane-backends = %{?epoch:%{epoch}:}%{version}-%{release} Requires: sane-backends = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires(pre): shadow-utils
%{?systemd_requires}
# Split off saned from 1.0.25-3 on, don't drag around obsoletes forever
%if ! (0%{?fedora} >= 27 || 0%{?rhel} >= 8)
Obsoletes: sane-backends < 1.0.25-3
Conflicts: sane-backends < 1.0.25-3
%endif
%description daemon %description daemon
This package contains saned which is the daemon that allows remote clients to This package contains saned which is the daemon that allows remote clients to
@ -199,11 +158,7 @@ access image acquisition devices available on the local host.
%patch0 -p1 -b .udev %patch0 -p1 -b .udev
%patch1 -p1 -b .soname %patch1 -p1 -b .soname
%patch2 -p1 -b .sane-config-multilib %patch2 -p1 -b .sane-config-multilib
%patch3 -p1 -b .saned-manpage %patch3 -p1 -b .disable-focus
%patch4 -p1 -b .canon-lide-100
%patch5 -p1 -b .revert-samsung-patch
%patch6 -p1 -b .prevent-buffer-overflow
%patch7 -p1 -b .rework-epsonds-io
%build %build
CFLAGS="%optflags -fno-strict-aliasing" CFLAGS="%optflags -fno-strict-aliasing"
@ -222,7 +177,7 @@ LDFLAGS="-pie"
--with-usb \ --with-usb \
%endif %endif
--enable-pthread --enable-pthread
make %{?_smp_mflags} %make_build
# Write udev/hwdb files # Write udev/hwdb files
_topdir="$PWD" _topdir="$PWD"
@ -233,7 +188,9 @@ pushd tools
popd popd
%install %install
make DESTDIR="%{buildroot}" install %make_install
install -p -D -m 0644 %{SOURCE6} %{buildroot}%{_sysusersdir}/sane-backends.conf
mkdir -p %{buildroot}%{_datadir}/pixmaps mkdir -p %{buildroot}%{_datadir}/pixmaps
install -m 644 %{SOURCE1} %{buildroot}%{_datadir}/pixmaps install -m 644 %{SOURCE1} %{buildroot}%{_datadir}/pixmaps
@ -242,11 +199,11 @@ rm -f %{buildroot}%{_mandir}/man1/gamma4scanimage.1*
rm -f %{buildroot}%{_libdir}/sane/*.a %{buildroot}%{_libdir}/*.a rm -f %{buildroot}%{_libdir}/sane/*.a %{buildroot}%{_libdir}/*.a
rm -f %{buildroot}%{_libdir}/libsane*.la %{buildroot}%{_libdir}/sane/*.la rm -f %{buildroot}%{_libdir}/libsane*.la %{buildroot}%{_libdir}/sane/*.la
mkdir -p %{buildroot}%{udevrulesdir} mkdir -p %{buildroot}%{_udevrulesdir}
mkdir -p %{buildroot}%{udevhwdbdir} mkdir -p %{buildroot}%{_udevhwdbdir}
install -m 0644 tools/udev/sane-backends.rules %{buildroot}%{udevrulesdir}/65-sane-backends.rules install -m 0644 tools/udev/sane-backends.rules %{buildroot}%{_udevrulesdir}/65-sane-backends.rules
install -m 0644 tools/udev/sane-backends.hwdb %{buildroot}%{udevhwdbdir}/20-sane-backends.hwdb install -m 0644 tools/udev/sane-backends.hwdb %{buildroot}%{_udevhwdbdir}/20-sane-backends.hwdb
install -m 0644 %{SOURCE5} %{buildroot}%{udevrulesdir}/66-saned.rules install -m 0644 %{SOURCE5} %{buildroot}%{_udevrulesdir}/66-saned.rules
mkdir -p %{buildroot}%{_libdir}/pkgconfig mkdir -p %{buildroot}%{_libdir}/pkgconfig
install -m 0644 tools/sane-backends.pc %{buildroot}%{_libdir}/pkgconfig/ install -m 0644 tools/sane-backends.pc %{buildroot}%{_libdir}/pkgconfig/
@ -278,6 +235,10 @@ install -m 644 %{SOURCE2} %{buildroot}%{_unitdir}
sed 's|@CONFIGDIR@|%{_sysconfdir}/sane.d|g' < %{SOURCE3} > saned@.service sed 's|@CONFIGDIR@|%{_sysconfdir}/sane.d|g' < %{SOURCE3} > saned@.service
install -m 644 saned@.service %{buildroot}%{_unitdir} install -m 644 saned@.service %{buildroot}%{_unitdir}
%ifarch armv7hl
rm -f %{buildroot}%{_libdir}/sane/libsane-qcam.so
%endif
%find_lang %name %find_lang %name
%post %post
@ -297,11 +258,7 @@ udevadm hwdb --update >/dev/null 2>&1 || :
%ldconfig_scriptlets libs %ldconfig_scriptlets libs
%pre daemon %pre daemon
getent group saned >/dev/null || groupadd -r saned %sysusers_create_compat %{SOURCE6}
getent passwd saned >/dev/null || \
useradd -r -g saned -d %{_datadir}/sane -s /sbin/nologin \
-c "SANE scanner daemon user" saned
exit 0
%post daemon %post daemon
%systemd_post saned.socket %systemd_post saned.socket
@ -310,7 +267,7 @@ exit 0
%systemd_preun saned.socket %systemd_preun saned.socket
%postun daemon %postun daemon
%systemd_postun saned.socket %systemd_postun_with_restart saned.socket
%files -f %{name}.lang %files -f %{name}.lang
%dir %{_maindocdir} %dir %{_maindocdir}
@ -324,8 +281,8 @@ exit 0
%dir /etc/sane.d %dir /etc/sane.d
%dir /etc/sane.d/dll.d %dir /etc/sane.d/dll.d
%config(noreplace) /etc/sane.d/*.conf %config(noreplace) /etc/sane.d/*.conf
%{udevrulesdir}/65-sane-backends.rules %{_udevrulesdir}/65-sane-backends.rules
%{udevhwdbdir}/20-sane-backends.hwdb %{_udevhwdbdir}/20-sane-backends.hwdb
%{_datadir}/pixmaps/sane.png %{_datadir}/pixmaps/sane.png
%{_bindir}/sane-find-scanner %{_bindir}/sane-find-scanner
@ -344,7 +301,7 @@ exit 0
%files libs %files libs
%{_libdir}/libsane.so.1 %{_libdir}/libsane.so.1
%{_libdir}/libsane.so.1.0.27 %{_libdir}/libsane.so.1.0.32
%files devel %files devel
%{_bindir}/sane-config %{_bindir}/sane-config
@ -354,41 +311,252 @@ exit 0
%{_libdir}/pkgconfig/sane-backends.pc %{_libdir}/pkgconfig/sane-backends.pc
%files drivers-scanners %files drivers-scanners
%{_libdir}/sane/*.so # we need to specify all .so files for available backends because something like
# #1761145 can happen - genesys did not compile because of lack gcc-c++ in buildroot
# and configure printed only warning. So now we can figure out missing backend support
# during build
%{_libdir}/sane/libsane-abaton.so
%{_libdir}/sane/libsane-agfafocus.so
%{_libdir}/sane/libsane-apple.so
%{_libdir}/sane/libsane-artec.so
%{_libdir}/sane/libsane-artec_eplus48u.so
%{_libdir}/sane/libsane-as6e.so
%{_libdir}/sane/libsane-avision.so
%{_libdir}/sane/libsane-bh.so
%{_libdir}/sane/libsane-canon.so
%{_libdir}/sane/libsane-canon630u.so
%{_libdir}/sane/libsane-canon_dr.so
%{_libdir}/sane/libsane-canon_lide70.so
%{_libdir}/sane/libsane-canon_pp.so
%{_libdir}/sane/libsane-cardscan.so
%{_libdir}/sane/libsane-coolscan.so
%{_libdir}/sane/libsane-coolscan2.so
%{_libdir}/sane/libsane-coolscan3.so
%{_libdir}/sane/libsane-dc210.so
%{_libdir}/sane/libsane-dc240.so
%{_libdir}/sane/libsane-dc25.so
%{_libdir}/sane/libsane-dell1600n_net.so
%{_libdir}/sane/libsane-dll.so
%{_libdir}/sane/libsane-dmc.so
%{_libdir}/sane/libsane-epjitsu.so
%{_libdir}/sane/libsane-epson.so
%{_libdir}/sane/libsane-epson2.so
%{_libdir}/sane/libsane-epsonds.so
%{_libdir}/sane/libsane-fujitsu.so
%{_libdir}/sane/libsane-genesys.so
%{_libdir}/sane/libsane-gt68xx.so
%{_libdir}/sane/libsane-hp.so
%{_libdir}/sane/libsane-hp3500.so
%{_libdir}/sane/libsane-hp3900.so
%{_libdir}/sane/libsane-hp4200.so
%{_libdir}/sane/libsane-hp5400.so
%{_libdir}/sane/libsane-hp5590.so
%{_libdir}/sane/libsane-hpljm1005.so
%{_libdir}/sane/libsane-hpsj5s.so
%{_libdir}/sane/libsane-hs2p.so
%{_libdir}/sane/libsane-ibm.so
%{_libdir}/sane/libsane-kodak.so
%{_libdir}/sane/libsane-kodakaio.so
%{_libdir}/sane/libsane-kvs1025.so
%{_libdir}/sane/libsane-kvs20xx.so
%{_libdir}/sane/libsane-kvs40xx.so
%{_libdir}/sane/libsane-leo.so
%{_libdir}/sane/libsane-lexmark.so
%{_libdir}/sane/libsane-ma1509.so
%{_libdir}/sane/libsane-magicolor.so
%{_libdir}/sane/libsane-matsushita.so
%{_libdir}/sane/libsane-microtek.so
%{_libdir}/sane/libsane-microtek2.so
%{_libdir}/sane/libsane-mustek.so
%{_libdir}/sane/libsane-mustek_pp.so
%{_libdir}/sane/libsane-mustek_usb.so
%{_libdir}/sane/libsane-mustek_usb2.so
%{_libdir}/sane/libsane-nec.so
%{_libdir}/sane/libsane-net.so
%{_libdir}/sane/libsane-niash.so
%{_libdir}/sane/libsane-p5.so
%{_libdir}/sane/libsane-pie.so
%{_libdir}/sane/libsane-pieusb.so
%{_libdir}/sane/libsane-pixma.so
%{_libdir}/sane/libsane-plustek.so
%{_libdir}/sane/libsane-plustek_pp.so
# qcam is not on aarch64, ppc64le and s390x. SANE needs
# ioperm, inb and outb functions or portaccess function
# to support qcam backend. Those functions are only in
# armv7hl (until F30), i686 and x86_64 architectures.
# Because qcam is missing on some archs and releases,
# I'll leave here a wildcard record
%ifarch x86_64 i686
%{_libdir}/sane/libsane-qcam.so
%endif
%{_libdir}/sane/libsane-ricoh.so
%{_libdir}/sane/libsane-ricoh2.so
%{_libdir}/sane/libsane-rts8891.so
%{_libdir}/sane/libsane-s9036.so
%{_libdir}/sane/libsane-sceptre.so
%{_libdir}/sane/libsane-sharp.so
%{_libdir}/sane/libsane-sm3600.so
%{_libdir}/sane/libsane-sm3840.so
%{_libdir}/sane/libsane-snapscan.so
%{_libdir}/sane/libsane-sp15c.so
%{_libdir}/sane/libsane-st400.so
%{_libdir}/sane/libsane-stv680.so
%{_libdir}/sane/libsane-tamarack.so
%{_libdir}/sane/libsane-teco1.so
%{_libdir}/sane/libsane-teco2.so
%{_libdir}/sane/libsane-teco3.so
%{_libdir}/sane/libsane-test.so
%{_libdir}/sane/libsane-u12.so
%{_libdir}/sane/libsane-umax.so
%{_libdir}/sane/libsane-umax1220u.so
%{_libdir}/sane/libsane-umax_pp.so
%{_libdir}/sane/libsane-v4l.so
%{_libdir}/sane/libsane-xerox_mfp.so
%{_libdir}/sane/*.so.1 %{_libdir}/sane/*.so.1
%{_libdir}/sane/*.so.1.0.27 %{_libdir}/sane/*.so.1.0.32
%exclude %{_libdir}/sane/*gphoto2.so* %exclude %{_libdir}/sane/*gphoto2.so*
%files drivers-cameras %files drivers-cameras
%{_libdir}/sane/libsane-gphoto2.so %{_libdir}/sane/libsane-gphoto2.so
%{_libdir}/sane/libsane-gphoto2.so.1 %{_libdir}/sane/libsane-gphoto2.so.1
%{_libdir}/sane/libsane-gphoto2.so.1.0.27 %{_libdir}/sane/libsane-gphoto2.so.1.0.32
%files daemon %files daemon
%{_sbindir}/saned %{_sbindir}/saned
%{_mandir}/man8/saned* %{_mandir}/man8/saned*
%{udevrulesdir}/66-saned.rules %{_sysusersdir}/sane-backends.conf
%{_udevrulesdir}/66-saned.rules
%{_unitdir}/saned.socket %{_unitdir}/saned.socket
%{_unitdir}/saned@.service %{_unitdir}/saned@.service
%changelog %changelog
* Tue Sep 08 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.27-22 * Thu Jul 21 2022 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.32-7
- related 1852663 - needed to rebuild due infrastructure error - 2095461 - [RFE] sane-backends use systems-sysusers
* Thu Sep 03 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.27-21 * Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1.0.32-6
- 1852663, 1848097 - NULL pointer dereference in sanei_epson_net_read function - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Wed Jul 01 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.27-20 * Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.0.32-5
- 1852468, 1852467, 1852466, 1852465 - prevent buffer overflow in esci2_img - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
- 1852668, 1852667, 1852666, 1852665 - disable autodiscovery for epsonds backend
* Tue Jul 24 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.27-19 * Tue Mar 09 2021 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.32-4
- 1934308 - Several Epson devices cannot scan because they fail to set focus
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.0.32-3
- Rebuilt for updated systemd-rpm-macros
See https://pagure.io/fesco/issue/2583.
* Thu Feb 18 2021 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.32-2
- python3 is now needed for building pixma backend
* Tue Feb 16 2021 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.32-1
- 1928484 - sane-backends-1.0.32 is available
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.31-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Nov 05 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.31-4
- make is no longer in buildroot by default
* Fri Oct 09 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.31-3
- 1750899 - CANOSCAN N650U scanner device not correctly detected via USB
* Mon Sep 14 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.31-2
- make the base package depend on sane-airscan instead of libsane-airscan lib
* Mon Aug 24 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.31-1
- 1.0.31, backend cannon_lide70 added
* Mon Aug 03 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.30-4
- get libsane-airscan backend as one of backends
* Tue Jul 28 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.30-3
- add a scriptlet to disable epsonds autodiscovery in case an user changed epsonds.conf
* Tue Jul 14 2020 Tom Stellard <tstellar@redhat.com> - 1.0.30-2
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Tue May 19 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.30-1
- 1.0.30
* Mon May 11 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.29-8
- 1778425 - scanimage segfaults for brother scan drivers due missing deprecated libnsl
- spec file fixes - add link to upstream issue, correct source url
* Thu Apr 02 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.29-7
- remove escl backend - will be merged into sane-airscan in the future, so stop shipping it
to prevent escl going into RHEL
* Mon Mar 23 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.29-6
- complete fix for #1807751
* Mon Mar 23 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.29-5
- 1807751 - [abrt] sane-backends: std::__replacement_assert(): scanimage killed by SIGABRT
* Mon Feb 10 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.29-4
- really fix it...
* Mon Feb 10 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.29-3
- typo in install phase...
* Mon Feb 10 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.29-2
- remove qcam from armv7hl
* Mon Feb 03 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.29-1
- 1.0.29
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.28-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Jan 15 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.28-6
- add buildrequires on systemd-rpm-macros
* Thu Oct 31 2019 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.28-5
- 1761530 - apply upstream patch
* Fri Oct 18 2019 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.28-4
- Ad 1761530 - actually apply the patch...
* Thu Oct 17 2019 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.28-3
- qcam backend support is tricky among different Fedora releases and archs - let the wildcard cover it
* Thu Oct 17 2019 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.28-2
- 1761145, 1761001, 1761051, 1761234 - genesys backend now needs gcc-c++, it is not built otherwise
- 1758886 - CanoScan LiDE scanners supported by genesys backend are not detected
- 1760916 - Samsung C460 does not have JPEG support
- 1761530 - genesys aborts when accessing invalid vector index and built with GLIBCXX_ASSERTIONS
- remove qcam from armvhl7 too
* Mon Sep 30 2019 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.28-1
- 1.0.28
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.27-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Jul 18 2019 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.27-24
- 1730698 - add Canon CanonScan LiDE 300 support
* Wed Apr 03 2019 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.27-23
- mustek backend crashed from stack smashing (upstream issue #71)
* Mon Feb 04 2019 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.27-22
- 1671510 - Incorrect udev rule in sane-backends
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.27-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Tue Jul 24 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.27-20
- corrected license - corrected license
* Tue Jul 24 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.27-18 * Tue Jul 24 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.27-19
- changed URL - changed URL
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.27-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Apr 19 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.27-17 * Thu Apr 19 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.0.27-17
- revert samsung patch - revert samsung patch