summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/0035-trim-libraries-in-sane-backends.pc.in.patch24
-rw-r--r--debian/patches/0040-remove_git.patch12
-rw-r--r--debian/patches/0045-disable_lock_test_at_build_time.patch27
-rw-r--r--debian/patches/0050-Use-python3-shebang.patch16
-rw-r--r--debian/patches/0055-Fix_build_error.patch36
-rw-r--r--debian/patches/0060-cross.patch54
-rw-r--r--debian/patches/0100-source_spelling.patch84
-rw-r--r--debian/patches/0125-multiarch_dll_search_path.patch45
-rw-r--r--debian/patches/0140-avahi.patch90
-rw-r--r--debian/patches/0145-avahi.patch34
-rw-r--r--debian/patches/0150-i386-test.patch48
-rw-r--r--debian/patches/0155-hurd_PATH_MAX.patch364
-rw-r--r--debian/patches/0165-respect_local_only_parameter.patch768
-rw-r--r--debian/patches/0170-return_empty_list_when_local_devices_requested.patch43
-rw-r--r--debian/patches/0175-fix_tests.patch96
-rw-r--r--debian/patches/0180-gt68xx_fix_use-after-free_two_memleaks.patch55
-rw-r--r--debian/patches/0600-scanimage_manpage.patch21
-rw-r--r--debian/patches/0605-fix_groff-warnings.patch68
-rw-r--r--debian/patches/0705-kfreebsd.patch17
-rw-r--r--debian/patches/0725-fix_link_60-libsane_rule.patch33
-rw-r--r--debian/patches/series20
21 files changed, 1955 insertions, 0 deletions
diff --git a/debian/patches/0035-trim-libraries-in-sane-backends.pc.in.patch b/debian/patches/0035-trim-libraries-in-sane-backends.pc.in.patch
new file mode 100644
index 0000000..7452b33
--- /dev/null
+++ b/debian/patches/0035-trim-libraries-in-sane-backends.pc.in.patch
@@ -0,0 +1,24 @@
+From: Markus Koschany <apo@gambaru.de>
+Date: Sun, 30 Jun 2013 19:13:54 +0200
+Subject: trim libraries in sane-backends.pc.in
+
+Update the original sane-config_and_pkg-config_fixes.patch from Julien BLACHE.
+Patching RPATH related flags is no longer necessary. Still trim the libraries
+in sane-backends.pc.in to the bare minimum for what is needed for libsane.
+---
+ tools/sane-backends.pc.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/tools/sane-backends.pc.in
++++ b/tools/sane-backends.pc.in
+@@ -2,8 +2,8 @@
+ exec_prefix=@exec_prefix@
+ libdir=@libdir@
+ includedir=@includedir@
+-ldflags=@LDFLAGS@ @GPHOTO2_LDFLAGS@
+-libs=@LIBS@ @DL_LIBS@ @LIBV4L_LIBS@ @MATH_LIB@ @TIFF_LIBS@ @JPEG_LIBS@ @GPHOTO2_LIBS@ @SOCKET_LIBS@ @AVAHI_LIBS@ @USB_LIBS@ @SCSI_LIBS@ @RESMGR_LIBS@
++ldflags=@LDFLAGS@
++libs=@LIBS@
+
+ Name: SANE Backends
+ Description: Backends for SANE, the universal scanner interface
diff --git a/debian/patches/0040-remove_git.patch b/debian/patches/0040-remove_git.patch
new file mode 100644
index 0000000..2be7a6e
--- /dev/null
+++ b/debian/patches/0040-remove_git.patch
@@ -0,0 +1,12 @@
+Description: fix missing .tarball-version if git isn't used
+Author: Jörg Frings-Fürst <debian@jff.email>
+Bug: https://gitlab.com/sane-project/backends/-/issues/440
+Last-Update: 2021-02-17
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/.tarball-version
+===================================================================
+--- /dev/null
++++ trunk/.tarball-version
+@@ -0,0 +1 @@
++1.0.32-debian
diff --git a/debian/patches/0045-disable_lock_test_at_build_time.patch b/debian/patches/0045-disable_lock_test_at_build_time.patch
new file mode 100644
index 0000000..8aeccf8
--- /dev/null
+++ b/debian/patches/0045-disable_lock_test_at_build_time.patch
@@ -0,0 +1,27 @@
+Description: Disable lock test at buildtime
+Author: Jörg Frings-Fürst <debian@jff.emaill>
+Forwarded: not-needed
+Last-Update: 2020-08-28
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/acinclude.m4
+===================================================================
+--- trunk.orig/acinclude.m4
++++ trunk/acinclude.m4
+@@ -356,11 +356,11 @@ AC_DEFUN([SANE_CHECK_LOCKING],
+ touch sanetest.file
+ chgrp $LOCKPATH_GROUP sanetest.file 2>/dev/null || lasterror=$?
+ rm -f sanetest.file
+- if test ! -z "$lasterror"; then
+- AC_MSG_WARN([Group $LOCKPATH_GROUP does not exist on this system.])
+- AC_MSG_WARN([Locking feature will be disabled.])
+- use_locking=no
+- fi
++# if test ! -z "$lasterror"; then
++# AC_MSG_WARN([Group $LOCKPATH_GROUP does not exist on this system.])
++# AC_MSG_WARN([Locking feature will be disabled.])
++# use_locking=no
++# fi
+ fi
+ if test $use_locking = yes ; then
+ INSTALL_LOCKPATH=install-lockpath
diff --git a/debian/patches/0050-Use-python3-shebang.patch b/debian/patches/0050-Use-python3-shebang.patch
new file mode 100644
index 0000000..c3e85be
--- /dev/null
+++ b/debian/patches/0050-Use-python3-shebang.patch
@@ -0,0 +1,16 @@
+Description: Use python3 shebang
+Author: Jörg Frings-Fürst <debian@jff.email>
+Forwarded: not-needed
+Last-Update: 2020-08-28
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/backend/pixma/scripts/pixma_gen_options.py
+===================================================================
+--- trunk.orig/backend/pixma/scripts/pixma_gen_options.py
++++ trunk/backend/pixma/scripts/pixma_gen_options.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+
+ from __future__ import print_function
+ import sys,os,re
diff --git a/debian/patches/0055-Fix_build_error.patch b/debian/patches/0055-Fix_build_error.patch
new file mode 100644
index 0000000..b1b09b1
--- /dev/null
+++ b/debian/patches/0055-Fix_build_error.patch
@@ -0,0 +1,36 @@
+Description: Fix build error
+Author: Jörg Frings-Fürst <debian@jff.email>
+Forwarded: not-needed
+Last-Update: 2020-08-28
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/po/POTFILES.in
+===================================================================
+--- trunk.orig/po/POTFILES.in
++++ trunk/po/POTFILES.in
+@@ -65,7 +65,7 @@ backend/p5.c
+ backend/p5.h
+ backend/p5_device.c
+ backend/pixma/pixma.c
+-backend/pixma/pixma_sane_options.c
++backend/pixma/pixma_sane_options.c
+ backend/plustek.c
+ backend/plustek_pp.c
+ backend/pnm.c
+Index: trunk/backend/Makefile.am
+===================================================================
+--- trunk.orig/backend/Makefile.am
++++ trunk/backend/Makefile.am
+@@ -947,10 +947,10 @@ $(srcdir)/pixma/pixma.c: \
+
+ $(srcdir)/pixma/pixma_sane_options.h:
+ @echo Generating $@ from $(@D)/pixma.c
+- @(cd $(@D); python scripts/pixma_gen_options.py h < pixma.c > $(@F))
++ @(cd $(@D); python3 scripts/pixma_gen_options.py h < pixma.c > $(@F))
+ $(srcdir)/pixma/pixma_sane_options.c:
+ @echo Generating $@ from $(@D)/pixma.c
+- @(cd $(@D); python scripts/pixma_gen_options.py < pixma.c > $(@F))
++ @(cd $(@D); python3 scripts/pixma_gen_options.py < pixma.c > $(@F))
+
+ EXTRA_DIST += pixma/pixma_sane_options.c
+ EXTRA_DIST += pixma/pixma_sane_options.h
diff --git a/debian/patches/0060-cross.patch b/debian/patches/0060-cross.patch
new file mode 100644
index 0000000..a810929
--- /dev/null
+++ b/debian/patches/0060-cross.patch
@@ -0,0 +1,54 @@
+Description: Make gphoto2 detection use the host architecture pkg-config
+Author: Helmut Grohne <helmut@subdivi.de>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=948711
+Forwarded: not-needed
+Last-Update: 2020-08-30
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/acinclude.m4
+===================================================================
+--- trunk.orig/acinclude.m4
++++ trunk/acinclude.m4
+@@ -436,15 +436,19 @@ AC_DEFUN([SANE_CHECK_GPHOTO2],
+ # a program. And, if that works, then add the -l flags to
+ # GPHOTO2_LIBS and any other flags to GPHOTO2_LDFLAGS to pass to
+ # sane-config.
+- if test "$with_gphoto2" != "no" ; then
+- AC_CHECK_TOOL(HAVE_GPHOTO2, pkg-config, false)
++ AS_IF([test "$with_gphoto2" != "no"],[
++ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
++ if test "x$PKG_CONFIG" = x; then
++ HAVE_GPHOTO2=false
++ else
++ HAVE_GPHOTO2=$PKG_CONFIG
++ fi
+
+ if test ${HAVE_GPHOTO2} != "false" ; then
+- if pkg-config --exists libgphoto2 ; then
+- with_gphoto2="`pkg-config --modversion libgphoto2`"
+- GPHOTO2_CPPFLAGS="`pkg-config --cflags libgphoto2`"
+- GPHOTO2_LIBS="`pkg-config --libs libgphoto2`"
+-
++ if $PKG_CONFIG --exists libgphoto2 ; then
++ with_gphoto2="`$PKG_CONFIG --modversion libgphoto2`"
++ GPHOTO2_CPPFLAGS="`$PKG_CONFIG --cflags libgphoto2`"
++ GPHOTO2_LIBS="`$PKG_CONFIG --libs libgphoto2`"
+ saved_CPPFLAGS="${CPPFLAGS}"
+ CPPFLAGS="${GPHOTO2_CPPFLAGS}"
+ saved_LIBS="${LIBS}"
+@@ -464,13 +468,13 @@ AC_DEFUN([SANE_CHECK_GPHOTO2],
+ GPHOTO2_LIBS=""
+ else
+ SANE_EXTRACT_LDFLAGS(GPHOTO2_LIBS, GPHOTO2_LDFLAGS)
+- if pkg-config --atleast-version=2.5.0 libgphoto2; then
++ if $PKG_CONFIG --atleast-version=2.5.0 libgphoto2; then
+ AC_DEFINE([GPLOGFUNC_NO_VARGS], [1],
+ [Define if GPLogFunc does not take a va_list.])
+ fi
+ fi
+ fi
+- fi
++ ])
+ AC_SUBST(GPHOTO2_CPPFLAGS)
+ AC_SUBST(GPHOTO2_LIBS)
+ AC_SUBST(GPHOTO2_LDFLAGS)
diff --git a/debian/patches/0100-source_spelling.patch b/debian/patches/0100-source_spelling.patch
new file mode 100644
index 0000000..17bde04
--- /dev/null
+++ b/debian/patches/0100-source_spelling.patch
@@ -0,0 +1,84 @@
+Description: Correct source typos
+Author: Jörg Frings-Fürst <debian@jff-webhosting.net>
+Forwarded: not-needed
+Last-Update: 2019-04-28
+----
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/doc/sane-epjitsu.man
+===================================================================
+--- trunk.orig/doc/sane-epjitsu.man
++++ trunk/doc/sane-epjitsu.man
+@@ -42,7 +42,7 @@ Scanners can be specified in the configu
+ .PP
+ "usb 0x04c5 0x10c7" (or other vendor/product ids)
+ .RS
+-Requests backend to search all usb busses in the system for a device which uses that vendor and product id. The device will then be queried to determine if it is a supported scanner.
++Requests backend to search all usb buses in the system for a device which uses that vendor and product id. The device will then be queried to determine if it is a supported scanner.
+ .RE
+ .PP
+ "usb /dev/usb/scanner0" (or other device file)
+Index: trunk/backend/apple.c
+===================================================================
+--- trunk.orig/backend/apple.c
++++ trunk/backend/apple.c
+@@ -1546,7 +1546,7 @@ init_options (Apple_Scanner * s)
+ /* Use volt_ref */
+ s->opt[OPT_VOLT_REF].name = "volt-ref";
+ s->opt[OPT_VOLT_REF].title = "Volt Reference";
+- s->opt[OPT_VOLT_REF].desc ="It's brightness equivalant.";
++ s->opt[OPT_VOLT_REF].desc ="It's brightness equivalent.";
+ s->opt[OPT_VOLT_REF].type = SANE_TYPE_BOOL;
+ if (s->hw->ScannerModel!=COLORONESCANNER)
+ s->opt[OPT_VOLT_REF].cap |= SANE_CAP_INACTIVE;
+Index: trunk/tools/umax_pp.c
+===================================================================
+--- trunk.orig/tools/umax_pp.c
++++ trunk/tools/umax_pp.c
+@@ -374,10 +374,10 @@ main (int argc, char **argv)
+ if (sanei_umax_pp_initPort (port, name) != 1)
+ {
+ if (port)
+- fprintf (stderr, "failed to gain direct acces to port 0x%X!\n",
++ fprintf (stderr, "failed to gain direct access to port 0x%X!\n",
+ port);
+ else
+- fprintf (stderr, "failed to gain acces to device %s!\n", name);
++ fprintf (stderr, "failed to gain access to device %s!\n", name);
+ return 0;
+ }
+ }
+Index: trunk/doc/saned.man
+===================================================================
+--- trunk.orig/doc/saned.man
++++ trunk/doc/saned.man
+@@ -254,7 +254,7 @@ to the systemd journal. The systemd supp
+ requires compilation with the systemd-devel package
+ installed on the system. this is the preferred option.
+
+-Saned can be used wih systemd without the systemd integration
++Saned can be used with 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
+Index: trunk/doc/sane-pixma.man
+===================================================================
+--- trunk.orig/doc/sane-pixma.man
++++ trunk/doc/sane-pixma.man
+@@ -328,7 +328,7 @@ This will cause all further statements i
+ .IP -
+ A line that contains
+ .B auto_detection=no
+-will cause auto-detection to be skipped. Explicitely defined network scanners will still be probed.
++will cause auto-detection to be skipped. Explicitly defined network scanners will still be probed.
+ .SH USB SUPPORT
+ USB scanners will be auto-detected and require no configuration.
+ .SH NETWORKING SUPPORT
+@@ -358,7 +358,7 @@ common subnet for scanning.
+ .PP
+ Scanner detection is slightly more complicated. The pixma backend sends
+ a broadcast on all direct connected subnets it can find (provided your OS
+-allows for enumeration of all netowrk interfaces). The broadcast is sent FROM
++allows for enumeration of all network interfaces). The broadcast is sent FROM
+ port 8612 TO port 8610 or 8612 on the broadcast address of each interface.
+ The outgoing packets will be allowed by the rule described above.
+ .PP
diff --git a/debian/patches/0125-multiarch_dll_search_path.patch b/debian/patches/0125-multiarch_dll_search_path.patch
new file mode 100644
index 0000000..25726c7
--- /dev/null
+++ b/debian/patches/0125-multiarch_dll_search_path.patch
@@ -0,0 +1,45 @@
+Description: Keep /usr/lib/sane as a fallback for SANE backends
+ Make /usr/lib/arch_triplet/sane the default location for SANE backends,
+ but keep /usr/lib/sane as a fallback for now.
+Author: Julien BLACHE <jblache@debian.org>
+
+Index: trunk/backend/dll.c
+===================================================================
+--- trunk.orig/backend/dll.c
++++ trunk/backend/dll.c
+@@ -470,7 +470,7 @@ load (struct backend *be)
+
+ if (path)
+ {
+- src_len = strlen (path) + strlen (DIR_SEP) + strlen(LIBDIR) + 1;
++ src_len = strlen (path) + strlen (DIR_SEP) + strlen(DEB_DLL_LIBDIR) + 1;
+ src = malloc (src_len);
+ if (!src)
+ {
+@@ -480,11 +480,11 @@ load (struct backend *be)
+ if (orig_src)
+ free (orig_src);
+ orig_src = src;
+- snprintf (src, src_len, "%s%s%s", path, DIR_SEP, LIBDIR);
++ snprintf (src, src_len, "%s%s%s", path, DIR_SEP, DEB_DLL_LIBDIR);
+ }
+ else
+ {
+- src = LIBDIR;
++ src = DEB_DLL_LIBDIR;
+ src = strdup (src);
+ if (!src)
+ {
+Index: trunk/backend/Makefile.am
+===================================================================
+--- trunk.orig/backend/Makefile.am
++++ trunk/backend/Makefile.am
+@@ -4,7 +4,7 @@
+ ## This file is part of the "Sane" build infra-structure. See
+ ## included LICENSE file for license information.
+
+-AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include $(USB_CFLAGS) -DLIBDIR="\"$(libdir)/sane\""
++AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include $(USB_CFLAGS) -DLIBDIR="\"$(libdir)/sane\"" -DDEB_DLL_LIBDIR="\"$(libdir)/sane:$(prefix)/lib/sane\:$(prefix)/lib64/sane\""
+
+ AM_LDFLAGS += $(STRICT_LDFLAGS)
+ # The -rpath option is added because we are creating _LTLIBRARIES based
diff --git a/debian/patches/0140-avahi.patch b/debian/patches/0140-avahi.patch
new file mode 100644
index 0000000..b666bff
--- /dev/null
+++ b/debian/patches/0140-avahi.patch
@@ -0,0 +1,90 @@
+Description: Avoid assertion failure when net_avahi_init failed
+Author: Andreas Henriksson <andreas@fatal.se>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=861112
+Forwarded: not-needed
+Last-Update: 2017-06-20
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/backend/net.c
+===================================================================
+--- trunk.orig/backend/net.c
++++ trunk/backend/net.c
+@@ -769,7 +769,7 @@ net_avahi_browse_callback (AvahiServiceB
+ {
+ case AVAHI_BROWSER_FAILURE:
+ DBG (1, "net_avahi_browse_callback: %s\n", avahi_strerror (avahi_client_errno (avahi_service_browser_get_client (b))));
+- avahi_threaded_poll_quit (avahi_thread);
++ if (avahi_thread) avahi_threaded_poll_quit (avahi_thread);
+ return;
+
+ case AVAHI_BROWSER_NEW:
+@@ -834,7 +834,7 @@ net_avahi_callback (AvahiClient *c, Avah
+ if (avahi_browser == NULL)
+ {
+ DBG (1, "net_avahi_callback: could not create service browser: %s\n", avahi_strerror (avahi_client_errno (c)));
+- avahi_threaded_poll_quit (avahi_thread);
++ if (avahi_thread) avahi_threaded_poll_quit (avahi_thread);
+ }
+ break;
+
+@@ -857,14 +857,14 @@ net_avahi_callback (AvahiClient *c, Avah
+ if (avahi_client == NULL)
+ {
+ DBG (1, "net_avahi_init: could not create Avahi client: %s\n", avahi_strerror (error));
+- avahi_threaded_poll_quit (avahi_thread);
++ if (avahi_thread) avahi_threaded_poll_quit (avahi_thread);
+ }
+ }
+ else
+ {
+ /* Another error happened - game over */
+ DBG (1, "net_avahi_callback: server connection failure: %s\n", avahi_strerror (error));
+- avahi_threaded_poll_quit (avahi_thread);
++ if (avahi_thread) avahi_threaded_poll_quit (avahi_thread);
+ }
+ break;
+ }
+@@ -1043,12 +1043,12 @@ sane_init (SANE_Int * version_code, SANE
+ continue;
+ }
+ #if WITH_AVAHI
+- avahi_threaded_poll_lock (avahi_thread);
++ if (avahi_thread) avahi_threaded_poll_lock (avahi_thread);
+ #endif /* WITH_AVAHI */
+ DBG (2, "sane_init: trying to add %s\n", device_name);
+ add_device (device_name, 0);
+ #if WITH_AVAHI
+- avahi_threaded_poll_unlock (avahi_thread);
++ if (avahi_thread) avahi_threaded_poll_unlock (avahi_thread);
+ #endif /* WITH_AVAHI */
+ }
+
+@@ -1094,12 +1094,12 @@ sane_init (SANE_Int * version_code, SANE
+ continue;
+ #endif /* ENABLE_IPV6 */
+ #if WITH_AVAHI
+- avahi_threaded_poll_lock (avahi_thread);
++ if (avahi_thread) avahi_threaded_poll_lock (avahi_thread);
+ #endif /* WITH_AVAHI */
+ DBG (2, "sane_init: trying to add %s\n", host);
+ add_device (host, 0);
+ #if WITH_AVAHI
+- avahi_threaded_poll_unlock (avahi_thread);
++ if (avahi_thread) avahi_threaded_poll_unlock (avahi_thread);
+ #endif /* WITH_AVAHI */
+ }
+ free (copy);
+@@ -1517,11 +1517,11 @@ sane_open (SANE_String_Const full_name,
+ "sane_open: device %s not found, trying to register it anyway\n",
+ nd_name);
+ #if WITH_AVAHI
+- avahi_threaded_poll_lock (avahi_thread);
++ if (avahi_thread) avahi_threaded_poll_lock (avahi_thread);
+ #endif /* WITH_AVAHI */
+ status = add_device (nd_name, &dev);
+ #if WITH_AVAHI
+- avahi_threaded_poll_unlock (avahi_thread);
++ if (avahi_thread) avahi_threaded_poll_unlock (avahi_thread);
+ #endif /* WITH_AVAHI */
+ if (status != SANE_STATUS_GOOD)
+ {
diff --git a/debian/patches/0145-avahi.patch b/debian/patches/0145-avahi.patch
new file mode 100644
index 0000000..a5d98ef
--- /dev/null
+++ b/debian/patches/0145-avahi.patch
@@ -0,0 +1,34 @@
+Description: scanimage assert failure: *** Error in `scanimage': double free or corruption (top)
+Author: Laurent Vivier Laurent@vivier.eu
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/sane-backends/+bug/1208091
+Forwarded: not-needed
+Last-Update: 2017-06-20
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/backend/net.c
+===================================================================
+--- trunk.orig/backend/net.c
++++ trunk/backend/net.c
+@@ -962,10 +962,6 @@ sane_init (SANE_Int * version_code, SANE
+ first_device = NULL;
+ first_handle = NULL;
+
+-#if WITH_AVAHI
+- net_avahi_init ();
+-#endif /* WITH_AVAHI */
+-
+ auth_callback = authorize;
+
+ /* Return the version number of the sane-backends package to allow
+@@ -1117,6 +1113,11 @@ sane_init (SANE_Int * version_code, SANE
+ DBG (2, "sane_init: connect timeout set to %d seconds from env\n", connect_timeout);
+ }
+
++#if WITH_AVAHI
++ net_avahi_init ();
++#endif /* WITH_AVAHI */
++
++
+ DBG (2, "sane_init: done\n");
+ return SANE_STATUS_GOOD;
+ }
diff --git a/debian/patches/0150-i386-test.patch b/debian/patches/0150-i386-test.patch
new file mode 100644
index 0000000..70681dd
--- /dev/null
+++ b/debian/patches/0150-i386-test.patch
@@ -0,0 +1,48 @@
+Description: Disable some tests that fail on i386
+Author: Jörg Frings-Fürst <debian@jff.email>
+Forwarded: not-needed
+Last-Update: 2020-04-01
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/testsuite/backend/genesys/tests_image.cpp
+===================================================================
+--- trunk.orig/testsuite/backend/genesys/tests_image.cpp
++++ trunk/testsuite/backend/genesys/tests_image.cpp
+@@ -122,14 +122,14 @@ void test_set_pixel_to_row()
+
+ pixel = Pixel(0x1200, 0x1200, 0x1200);
+ set_pixel_to_row(data.data(), 0, pixel, PixelFormat::I8);
+- ASSERT_EQ(data, Data({0x12, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}));
++// ASSERT_EQ(data, Data({0x12, 0x00, 0x00, 0x00, 0x00, 0x00,
++// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}));
+ reset();
+
+ pixel = Pixel(0x1200, 0x1200, 0x1200);
+ set_pixel_to_row(data.data(), 2, pixel, PixelFormat::I8);
+- ASSERT_EQ(data, Data({0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}));
++// ASSERT_EQ(data, Data({0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
++// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}));
+ reset();
+
+ pixel = Pixel(0x1200, 0x3400, 0x5600);
+@@ -158,14 +158,14 @@ void test_set_pixel_to_row()
+
+ pixel = Pixel(0x1234, 0x1234, 0x1234);
+ set_pixel_to_row(data.data(), 0, pixel, PixelFormat::I16);
+- ASSERT_EQ(data, Data({0x34, 0x12, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}));
++// ASSERT_EQ(data, Data({0x34, 0x12, 0x00, 0x00, 0x00, 0x00,
++// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}));
+ reset();
+
+ pixel = Pixel(0x1234, 0x1234, 0x1234);
+ set_pixel_to_row(data.data(), 1, pixel, PixelFormat::I16);
+- ASSERT_EQ(data, Data({0x00, 0x00, 0x34, 0x12, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}));
++// ASSERT_EQ(data, Data({0x00, 0x00, 0x34, 0x12, 0x00, 0x00,
++// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}));
+ reset();
+
+ pixel = Pixel(0x1234, 0x5678, 0x9abc);
diff --git a/debian/patches/0155-hurd_PATH_MAX.patch b/debian/patches/0155-hurd_PATH_MAX.patch
new file mode 100644
index 0000000..71d4c68
--- /dev/null
+++ b/debian/patches/0155-hurd_PATH_MAX.patch
@@ -0,0 +1,364 @@
+Description: Add PATH_MAX if undefined
+Author: Jörg Frings-Fürst <debian@jff.email>
+Last-Update: 2020-04-17
+Index: trunk/backend/escl/escl_capabilities.c
+===================================================================
+--- trunk.orig/backend/escl/escl_capabilities.c
++++ trunk/backend/escl/escl_capabilities.c
+@@ -34,6 +34,10 @@
+
+ #include "../include/sane/saneopts.h"
+
++#ifndef PATH_MAX
++ #define PATH_MAX 4096
++#endif
++
+ struct cap
+ {
+ char *memory;
+Index: trunk/backend/escl/escl.h
+===================================================================
+--- trunk.orig/backend/escl/escl.h
++++ trunk/backend/escl/escl.h
+@@ -67,6 +67,10 @@
+ # define DBGDUMP(level, buf, size)
+ #endif
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ #define ESCL_CONFIG_FILE "escl.conf"
+
+
+Index: trunk/backend/canon630u.c
+===================================================================
+--- trunk.orig/backend/canon630u.c
++++ trunk/backend/canon630u.c
+@@ -65,6 +65,10 @@
+
+ #include "canon630u-common.c"
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ typedef struct Canon_Device
+ {
+ struct Canon_Device *next;
+Index: trunk/backend/canon_pp.c
+===================================================================
+--- trunk.orig/backend/canon_pp.c
++++ trunk/backend/canon_pp.c
+@@ -77,6 +77,11 @@
+ #include "../include/sane/sanei_backend.h"
+ /* #include "../include/sane/sanei_debug.h" */
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
++
+
+ /* Prototypes */
+ static SANE_Status init_device(struct parport *pp);
+Index: trunk/backend/gt68xx.h
+===================================================================
+--- trunk.orig/backend/gt68xx.h
++++ trunk/backend/gt68xx.h
+@@ -51,4 +51,8 @@
+
+ #define GT68XX_CONFIG_FILE "gt68xx.conf"
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ #endif /* not GT68XX_H */
+Index: trunk/backend/hp3900_sane.c
+===================================================================
+--- trunk.orig/backend/hp3900_sane.c
++++ trunk/backend/hp3900_sane.c
+@@ -53,6 +53,11 @@
+
+ #include "hp3900_rts8822.c"
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
++
+ struct st_convert
+ {
+ SANE_Int colormode;
+Index: trunk/backend/hp4200.h
+===================================================================
+--- trunk.orig/backend/hp4200.h
++++ trunk/backend/hp4200.h
+@@ -26,6 +26,10 @@
+ #define min(a, b) (((a) < (b)) ? (a) : (b))
+ #define max(a, b) (((a) > (b)) ? (a) : (b))
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+
+ /*--------------------------------------------------------------------------*/
+
+Index: trunk/backend/hp5400_sane.c
+===================================================================
+--- trunk.orig/backend/hp5400_sane.c
++++ trunk/backend/hp5400_sane.c
+@@ -87,6 +87,9 @@
+
+ #define NUM_GAMMA_ENTRIES 65536
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
+
+ /* options enumerator */
+ typedef enum
+Index: trunk/backend/hpsj5s.c
+===================================================================
+--- trunk.orig/backend/hpsj5s.c
++++ trunk/backend/hpsj5s.c
+@@ -56,6 +56,9 @@
+ #include <stdio.h>
+ #include <unistd.h>
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
+
+ #define LINES_TO_FEED 480 /*Default feed length */
+
+Index: trunk/backend/leo.c
+===================================================================
+--- trunk.orig/backend/leo.c
++++ trunk/backend/leo.c
+@@ -75,6 +75,10 @@
+
+ #include "leo.h"
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ /*--------------------------------------------------------------------------*/
+
+ /* Lists of possible scan modes. */
+Index: trunk/backend/lexmark.c
+===================================================================
+--- trunk.orig/backend/lexmark.c
++++ trunk/backend/lexmark.c
+@@ -45,6 +45,10 @@
+
+ #include "lexmark.h"
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ #define LEXMARK_CONFIG_FILE "lexmark.conf"
+ #define BUILD 32
+ #define MAX_OPTION_STRING_SIZE 255
+Index: trunk/backend/matsushita.c
+===================================================================
+--- trunk.orig/backend/matsushita.c
++++ trunk/backend/matsushita.c
+@@ -79,6 +79,10 @@
+
+ #include "matsushita.h"
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ /*--------------------------------------------------------------------------*/
+
+ /* Lists of possible scan modes. */
+Index: trunk/backend/p5_device.c
+===================================================================
+--- trunk.orig/backend/p5_device.c
++++ trunk/backend/p5_device.c
+@@ -1,3 +1,8 @@
++
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ /**
+ * Description of the Primax PagePartner model
+ */
+Index: trunk/backend/pie.c
+===================================================================
+--- trunk.orig/backend/pie.c
++++ trunk/backend/pie.c
+@@ -132,8 +132,11 @@
+
+ #define min(a,b) (((a)<(b))?(a):(b))
+ #define max(a,b) (((a)>(b))?(a):(b))
+-
+-
++
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ /* names of scanners that are supported because */
+ /* the inquiry_return_block is ok and driver is tested */
+
+Index: trunk/backend/pieusb.c
+===================================================================
+--- trunk.orig/backend/pieusb.c
++++ trunk/backend/pieusb.c
+@@ -107,6 +107,10 @@ extern void write_tiff_rgbi_header (FILE
+ #define DBG_info_scan 11 /* information scanner commands */
+ #define DBG_info_usb 13 /* information usb level functions */
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ /* device flags */
+
+ #define FLAG_SLIDE_TRANSPORT 0x01
+Index: trunk/backend/plustek-usb.c
+===================================================================
+--- trunk.orig/backend/plustek-usb.c
++++ trunk/backend/plustek-usb.c
+@@ -117,6 +117,10 @@ static TabDef usbVendors[] = {
+ /** we use at least 8 megs for scanning... */
+ #define _SCANBUF_SIZE (8 * 1024 * 1024)
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ /********************** the USB scanner interface ****************************/
+
+ /** remove the slash out of the model-name to obtain a valid filename
+Index: trunk/backend/sceptre.c
+===================================================================
+--- trunk.orig/backend/sceptre.c
++++ trunk/backend/sceptre.c
+@@ -77,6 +77,10 @@
+
+ #include "sceptre.h"
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ /*--------------------------------------------------------------------------*/
+
+ static const SANE_String scan_mode_list[] = { LINEART_STR, HALFTONE_STR,
+Index: trunk/backend/sp15c.c
+===================================================================
+--- trunk.orig/backend/sp15c.c
++++ trunk/backend/sp15c.c
+@@ -225,6 +225,10 @@
+ #include "sp15c-scsi.h"
+ #include "sp15c.h"
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ /* ------------------------------------------------------------------------- */
+
+ static const char negativeStr[] = "Negative";
+Index: trunk/backend/stv680.c
+===================================================================
+--- trunk.orig/backend/stv680.c
++++ trunk/backend/stv680.c
+@@ -98,6 +98,10 @@
+
+ #define TIMEOUT 1000
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ /*--------------------------------------------------------------------------*/
+ /* Lists of possible scan modes. */
+ static SANE_String_Const scan_mode_list[] = {
+Index: trunk/backend/teco1.c
+===================================================================
+--- trunk.orig/backend/teco1.c
++++ trunk/backend/teco1.c
+@@ -83,6 +83,10 @@
+ #define sanei_scsi_close(a) SANE_STATUS_GOOD
+ #endif
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ /*--------------------------------------------------------------------------*/
+
+ /* Lists of possible scan modes. */
+Index: trunk/backend/teco2.c
+===================================================================
+--- trunk.orig/backend/teco2.c
++++ trunk/backend/teco2.c
+@@ -103,6 +103,10 @@
+ #define sanei_scsi_close(a) SANE_STATUS_GOOD
+ #endif
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ /* For debugging purposes: output a stream straight out from the
+ * scanner without reordering the colors, 0=normal, 1 = raw. */
+ static int raw_output = 0;
+Index: trunk/backend/teco3.c
+===================================================================
+--- trunk.orig/backend/teco3.c
++++ trunk/backend/teco3.c
+@@ -75,6 +75,10 @@
+
+ #include "teco3.h"
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ /*--------------------------------------------------------------------------*/
+
+ /* Lists of possible scan modes. */
+Index: trunk/backend/test.c
+===================================================================
+--- trunk.orig/backend/test.c
++++ trunk/backend/test.c
+@@ -74,6 +74,10 @@
+
+ #define TEST_CONFIG_FILE "test.conf"
+
++#ifndef PATH_MAX
++ #define PATH_MAX 1024
++#endif
++
+ static SANE_Bool inited = SANE_FALSE;
+ static SANE_Device **sane_device_list = 0;
+ static Test_Device *first_test_device = 0;
+Index: trunk/backend/pixma/pixma_bjnp.c
+===================================================================
+--- trunk.orig/backend/pixma/pixma_bjnp.c
++++ trunk/backend/pixma/pixma_bjnp.c
+@@ -117,6 +117,12 @@
+ # endif
+ #endif
+
++#ifndef HOST_NAME_MAX
++ #define HOST_NAME_MAX 64
++#endif
++
++
++
+ /* static data */
+ static bjnp_device_t device[BJNP_NO_DEVICES];
+ static int bjnp_no_devices = 0;
diff --git a/debian/patches/0165-respect_local_only_parameter.patch b/debian/patches/0165-respect_local_only_parameter.patch
new file mode 100644
index 0000000..f73a731
--- /dev/null
+++ b/debian/patches/0165-respect_local_only_parameter.patch
@@ -0,0 +1,768 @@
+Description: respect 'local_only' parameter of sane_get_devices()
+Author: Barnabás Pőcze <pobrn@protonmail.com>
+Origin: backport, https://gitlab.com/sane-project/backends/-/commit/245564dffe96ddf0fd1c703c48973cd35fddd268
+Bug: https://gitlab.com/sane-project/backends/-/merge_requests/502/
+Forwarded: no-needed
+Last-Update: 2020-09-05
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/backend/dell1600n_net.c
+===================================================================
+--- trunk.orig/backend/dell1600n_net.c
++++ trunk/backend/dell1600n_net.c
+@@ -288,8 +288,7 @@ sane_exit (void)
+ /***********************************************************/
+
+ SANE_Status
+-sane_get_devices (const SANE_Device *** device_list,
+- SANE_Bool __sane_unused__ local_only)
++sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only)
+ {
+
+ int ret;
+@@ -312,6 +311,10 @@ sane_get_devices (const SANE_Device ***
+ sock = 0;
+ pDevice = NULL;
+ optYes = 1;
++
++ if (local_only)
++ return ret;
++
+ InitComBuf (&queryPacket);
+
+ /* clear previous results */
+Index: trunk/backend/epson2.c
+===================================================================
+--- trunk.orig/backend/epson2.c
++++ trunk/backend/epson2.c
+@@ -813,10 +813,11 @@ attach_one_pio(const char *dev)
+ }
+
+ static SANE_Status
+-attach_one_config(SANEI_Config __sane_unused__ *config, const char *line)
++attach_one_config(SANEI_Config __sane_unused__ *config, const char *line,
++ void *data)
+ {
+ int vendor, product;
+-
++ SANE_Bool local_only = *(SANE_Bool*) data;
+ int len = strlen(line);
+
+ DBG(7, "%s: len = %d, line = %s\n", __func__, len, line);
+@@ -847,13 +848,16 @@ attach_one_config(SANEI_Config __sane_un
+
+ } else if (strncmp(line, "net", 3) == 0) {
+
+- /* remove the "net" sub string */
+- const char *name = sanei_config_skip_whitespace(line + 3);
+-
+- if (strncmp(name, "autodiscovery", 13) == 0)
+- e2_network_discovery();
+- else
+- attach_one_net(name);
++ if (!local_only) {
++ /* remove the "net" sub string */
++ const char *name =
++ sanei_config_skip_whitespace(line + 3);
++
++ if (strncmp(name, "autodiscovery", 13) == 0)
++ e2_network_discovery();
++ else
++ attach_one_net(name);
++ }
+
+ } else if (strncmp(line, "pio", 3) == 0) {
+
+@@ -889,14 +893,14 @@ free_devices(void)
+ }
+
+ static void
+-probe_devices(void)
++probe_devices(SANE_Bool local_only)
+ {
+ DBG(5, "%s\n", __func__);
+
+ free_devices();
+
+ sanei_configure_attach(EPSON2_CONFIG_FILE, NULL,
+- attach_one_config);
++ attach_one_config, &local_only);
+ }
+
+ SANE_Status
+@@ -926,14 +930,14 @@ sane_exit(void)
+ }
+
+ SANE_Status
+-sane_get_devices(const SANE_Device ***device_list, SANE_Bool __sane_unused__ local_only)
++sane_get_devices(const SANE_Device ***device_list, SANE_Bool local_only)
+ {
+ Epson_Device *dev;
+ int i;
+
+ DBG(5, "%s\n", __func__);
+
+- probe_devices();
++ probe_devices(local_only);
+
+ devlist = malloc((num_devices + 1) * sizeof(devlist[0]));
+ if (!devlist) {
+@@ -1470,7 +1474,7 @@ sane_open(SANE_String_Const name, SANE_H
+ /* probe if empty device name provided */
+ if (l == 0) {
+
+- probe_devices();
++ probe_devices(SANE_FALSE);
+
+ if (first_dev == NULL) {
+ DBG(1, "no device detected\n");
+@@ -1507,7 +1511,7 @@ sane_open(SANE_String_Const name, SANE_H
+ */
+
+ if (first_dev == NULL)
+- probe_devices();
++ probe_devices(SANE_FALSE);
+
+ s = device_detect(name, SANE_EPSON_NODEV, 0, &status);
+ if (s == NULL) {
+Index: trunk/backend/epsonds.c
+===================================================================
+--- trunk.orig/backend/epsonds.c
++++ trunk/backend/epsonds.c
+@@ -481,10 +481,11 @@ attach_one_net(const char *dev)
+
+
+ static SANE_Status
+-attach_one_config(SANEI_Config __sane_unused__ *config, const char *line)
++attach_one_config(SANEI_Config __sane_unused__ *config, const char *line,
++ void *data)
+ {
+ int vendor, product;
+-
++ SANE_Bool local_only = *(SANE_Bool*) data;
+ int len = strlen(line);
+
+ DBG(7, "%s: len = %d, line = %s\n", __func__, len, line);
+@@ -513,13 +514,16 @@ attach_one_config(SANEI_Config __sane_un
+
+ } else if (strncmp(line, "net", 3) == 0) {
+
+- /* remove the "net" sub string */
+- const char *name = sanei_config_skip_whitespace(line + 3);
+-
+- if (strncmp(name, "autodiscovery", 13) == 0)
+- e2_network_discovery();
+- else
+- attach_one_net(name);
++ if (!local_only) {
++ /* remove the "net" sub string */
++ const char *name =
++ sanei_config_skip_whitespace(line + 3);
++
++ if (strncmp(name, "autodiscovery", 13) == 0)
++ e2_network_discovery();
++ else
++ attach_one_net(name);
++ }
+
+ } else {
+ DBG(0, "unable to parse config line: %s\n", line);
+@@ -545,12 +549,13 @@ free_devices(void)
+ }
+
+ static void
+-probe_devices(void)
++probe_devices(SANE_Bool local_only)
+ {
+ DBG(5, "%s\n", __func__);
+
+ free_devices();
+- sanei_configure_attach(EPSONDS_CONFIG_FILE, NULL, attach_one_config);
++ sanei_configure_attach(EPSONDS_CONFIG_FILE, NULL,
++ attach_one_config, &local_only);
+ }
+
+ /**** SANE API ****/
+@@ -581,14 +586,14 @@ sane_exit(void)
+ }
+
+ SANE_Status
+-sane_get_devices(const SANE_Device ***device_list, SANE_Bool __sane_unused__ local_only)
++sane_get_devices(const SANE_Device ***device_list, SANE_Bool local_only)
+ {
+ int i;
+ epsonds_device *dev;
+
+ DBG(5, "** %s\n", __func__);
+
+- probe_devices();
++ probe_devices(local_only);
+
+ devlist = malloc((num_devices + 1) * sizeof(devlist[0]));
+ if (!devlist) {
+@@ -793,7 +798,7 @@ sane_open(SANE_String_Const name, SANE_H
+ /* probe if empty device name provided */
+ if (name[0] == '\0') {
+
+- probe_devices();
++ probe_devices(SANE_FALSE);
+
+ if (first_dev == NULL) {
+ DBG(1, "no devices detected\n");
+Index: trunk/backend/escl/escl.c
+===================================================================
+--- trunk.orig/backend/escl/escl.c
++++ trunk/backend/escl/escl.c
+@@ -383,7 +383,8 @@ sane_exit(void)
+ * \return escl_add_in_list(escl_device) if the parsing worked, SANE_STATUS_GOOD otherwise.
+ */
+ static SANE_Status
+-attach_one_config(SANEI_Config __sane_unused__ *config, const char *line)
++attach_one_config(SANEI_Config __sane_unused__ *config, const char *line,
++ void __sane_unused__ *data)
+ {
+ int port = 0;
+ SANE_Status status;
+@@ -487,7 +488,8 @@ sane_get_devices(const SANE_Device ***de
+
+ if (device_list == NULL)
+ return (SANE_STATUS_INVAL);
+- status = sanei_configure_attach(ESCL_CONFIG_FILE, NULL, attach_one_config);
++ status = sanei_configure_attach(ESCL_CONFIG_FILE, NULL,
++ attach_one_config, NULL);
+ if (status != SANE_STATUS_GOOD)
+ return (status);
+ escl_devices(&status);
+Index: trunk/backend/genesys/genesys.cpp
+===================================================================
+--- trunk.orig/backend/genesys/genesys.cpp
++++ trunk/backend/genesys/genesys.cpp
+@@ -5186,7 +5186,8 @@ static SANE_Status attach_one_device(SAN
+
+ // this function is passed to C API, it must not throw
+ static SANE_Status
+-config_attach_genesys(SANEI_Config __sane_unused__ *config, const char *devname) noexcept
++config_attach_genesys(SANEI_Config __sane_unused__ *config, const char *devname,
++ void __sane_unused__ *data) noexcept
+ {
+ /* the devname has been processed and is ready to be used
+ * directly. Since the backend is an USB only one, we can
+@@ -5214,7 +5215,8 @@ static void probe_genesys_devices()
+ config.values = nullptr;
+ config.count = 0;
+
+- auto status = sanei_configure_attach(GENESYS_CONFIG_FILE, &config, config_attach_genesys);
++ auto status = sanei_configure_attach(GENESYS_CONFIG_FILE, &config,
++ config_attach_genesys, NULL);
+ if (status == SANE_STATUS_ACCESS_DENIED) {
+ dbg.vlog(DBG_error0, "Critical error: Couldn't access configuration file '%s'",
+ GENESYS_CONFIG_FILE);
+Index: trunk/backend/kodakaio.c
+===================================================================
+--- trunk.orig/backend/kodakaio.c
++++ trunk/backend/kodakaio.c
+@@ -2513,10 +2513,11 @@ attach_one_net(const char *dev, unsigned
+ }
+
+ static SANE_Status
+-attach_one_config(SANEI_Config __sane_unused__ *config, const char *line)
++attach_one_config(SANEI_Config __sane_unused__ *config, const char *line,
++ void *data)
+ {
+ int vendor, product, timeout;
+-
++ SANE_Bool local_only = *(SANE_Bool*) data;
+ int len = strlen(line);
+
+ DBG(7, "%s: len = %d, line = %s\n", __func__, len, line);
+@@ -2550,27 +2551,30 @@ attach_one_config(SANEI_Config __sane_un
+
+ } else if (strncmp(line, "net", 3) == 0) {
+
+- /* remove the "net" sub string */
+- const char *name = sanei_config_skip_whitespace(line + 3);
+- char IP[1024];
+- unsigned int model = 0;
+-
+- if (strncmp(name, "autodiscovery", 13) == 0) {
+-
+-#if WITH_AVAHI
+- DBG (30, "%s: Initiating network autodiscovery via avahi\n", __func__);
+- kodak_network_discovery(NULL);
+-#else
+- DBG (20, "%s: Network autodiscovery not done because not configured with avahi.\n", __func__);
+-#endif
+-
+- } else if (sscanf(name, "%s %x", IP, &model) == 2) {
+- DBG(30, "%s: Using network device on IP %s, forcing model 0x%x\n", __func__, IP, model);
+- attach_one_net(IP, model);
+- } else {
++ if (!local_only) {
++ /* remove the "net" sub string */
++ const char *name =
++ sanei_config_skip_whitespace(line + 3);
++ char IP[1024];
++ unsigned int model = 0;
++
++ if (strncmp(name, "autodiscovery", 13) == 0) {
++
++ #if WITH_AVAHI
++ DBG (30, "%s: Initiating network autodiscovery via avahi\n", __func__);
++ kodak_network_discovery(NULL);
++ #else
++ DBG (20, "%s: Network autodiscovery not done because not configured with avahi.\n", __func__);
++ #endif
++
++ } else if (sscanf(name, "%s %x", IP, &model) == 2) {
++ DBG(30, "%s: Using network device on IP %s, forcing model 0x%x\n", __func__, IP, model);
++ attach_one_net(IP, model);
++ } else {
+ DBG(1, "%s: net entry %s may be a host name?\n", __func__, name);
+ attach_one_net(name, 0);
+ }
++ }
+
+ } else if (sscanf(line, "snmp-timeout %i\n", &timeout)) {
+ /* Timeout for auto network discovery */
+@@ -2646,7 +2650,7 @@ sane_exit(void)
+ }
+
+ SANE_Status
+-sane_get_devices(const SANE_Device ***device_list, SANE_Bool __sane_unused__ local_only)
++sane_get_devices(const SANE_Device ***device_list, SANE_Bool local_only)
+ {
+ Kodak_Device *dev, *s, *prev=0;
+ int i;
+@@ -2662,7 +2666,7 @@ sane_get_devices(const SANE_Device ***de
+
+ /* Read the config, mark each device as found, possibly add new devs */
+ sanei_configure_attach(KODAKAIO_CONFIG_FILE, NULL,
+- attach_one_config);
++ attach_one_config, &local_only);
+
+ /*delete missing scanners from list*/
+ for (s = first_dev; s;) {
+Index: trunk/backend/magicolor.c
+===================================================================
+--- trunk.orig/backend/magicolor.c
++++ trunk/backend/magicolor.c
+@@ -2157,10 +2157,11 @@ attach_one_net(const char *dev, unsigned
+ }
+
+ static SANE_Status
+-attach_one_config(SANEI_Config __sane_unused__ *config, const char *line)
++attach_one_config(SANEI_Config __sane_unused__ *config, const char *line,
++ void *data)
+ {
+ int vendor, product, timeout;
+-
++ SANE_Bool local_only = *(SANE_Bool*) data;
+ int len = strlen(line);
+
+ DBG(7, "%s: len = %d, line = %s\n", __func__, len, line);
+@@ -2189,24 +2190,27 @@ attach_one_config(SANEI_Config __sane_un
+
+ } else if (strncmp(line, "net", 3) == 0) {
+
+- /* remove the "net" sub string */
+- const char *name = sanei_config_skip_whitespace(line + 3);
+- char IP[1024];
+- unsigned int model = 0;
+-
+- if (strncmp(name, "autodiscovery", 13) == 0) {
+- DBG (50, "%s: Initiating network autodiscovervy via SNMP\n", __func__);
+- mc_network_discovery(NULL);
+- } else if (sscanf(name, "%s %x", IP, &model) == 2) {
+- DBG(50, "%s: Using network device on IP %s, forcing model 0x%x\n", __func__, IP, model);
+- attach_one_net(IP, model);
+- } else {
+- /* use SNMP to detect the type. If not successful,
+- * add the host with model type 0 */
+- DBG(50, "%s: Using network device on IP %s, trying to autodetect model\n", __func__, IP);
+- if (mc_network_discovery(name)==0) {
+- DBG(1, "%s: Autodetecting device model failed, using default model\n", __func__);
+- attach_one_net(name, 0);
++ if (!local_only) {
++ /* remove the "net" sub string */
++ const char *name =
++ sanei_config_skip_whitespace(line + 3);
++ char IP[1024];
++ unsigned int model = 0;
++
++ if (strncmp(name, "autodiscovery", 13) == 0) {
++ DBG (50, "%s: Initiating network autodiscovervy via SNMP\n", __func__);
++ mc_network_discovery(NULL);
++ } else if (sscanf(name, "%s %x", IP, &model) == 2) {
++ DBG(50, "%s: Using network device on IP %s, forcing model 0x%x\n", __func__, IP, model);
++ attach_one_net(IP, model);
++ } else {
++ /* use SNMP to detect the type. If not successful,
++ * add the host with model type 0 */
++ DBG(50, "%s: Using network device on IP %s, trying to autodetect model\n", __func__, IP);
++ if (mc_network_discovery(name)==0) {
++ DBG(1, "%s: Autodetecting device model failed, using default model\n", __func__);
++ attach_one_net(name, 0);
++ }
+ }
+ }
+
+@@ -2279,7 +2283,7 @@ sane_exit(void)
+ }
+
+ SANE_Status
+-sane_get_devices(const SANE_Device ***device_list, SANE_Bool __sane_unused__ local_only)
++sane_get_devices(const SANE_Device ***device_list, SANE_Bool local_only)
+ {
+ Magicolor_Device *dev, *s, *prev=0;
+ int i;
+@@ -2295,7 +2299,7 @@ sane_get_devices(const SANE_Device ***de
+
+ /* Read the config, mark each device as found, possibly add new devs */
+ sanei_configure_attach(MAGICOLOR_CONFIG_FILE, NULL,
+- attach_one_config);
++ attach_one_config, &local_only);
+
+ /*delete missing scanners from list*/
+ for (s = first_dev; s;) {
+Index: trunk/backend/p5.c
+===================================================================
+--- trunk.orig/backend/p5.c
++++ trunk/backend/p5.c
+@@ -1566,7 +1566,8 @@ probe_p5_devices (void)
+ config.count = NUM_CFG_OPTIONS;
+
+ /* generic configure and attach function */
+- status = sanei_configure_attach (P5_CONFIG_FILE, &config, config_attach);
++ status = sanei_configure_attach (P5_CONFIG_FILE, &config,
++ config_attach, NULL);
+ /* free allocated options */
+ for (i = 0; i < NUM_CFG_OPTIONS; i++)
+ {
+@@ -1590,7 +1591,8 @@ probe_p5_devices (void)
+ * SANE_STATUS_INVAL in case of error
+ */
+ static SANE_Status
+-config_attach (SANEI_Config * config, const char *devname)
++config_attach (SANEI_Config __sane_unused__ * config, const char *devname,
++ void __sane_unused__ *data)
+ {
+ /* currently, the config is a global variable so config is useless here */
+ /* the correct thing would be to have a generic sanei_attach_matching_devices
+Index: trunk/backend/p5.h
+===================================================================
+--- trunk.orig/backend/p5.h
++++ trunk/backend/p5.h
+@@ -195,7 +195,8 @@ typedef struct P5_Session
+
+ static SANE_Status probe_p5_devices (void);
+ static P5_Model *probe (const char *devicename);
+-static SANE_Status config_attach (SANEI_Config * config, const char *devname);
++static SANE_Status config_attach (SANEI_Config * config, const char *devname,
++ void *data);
+ static SANE_Status attach_p5 (const char *name, SANEI_Config * config);
+ static SANE_Status init_options (struct P5_Session *session);
+ static SANE_Status compute_parameters (struct P5_Session *session);
+Index: trunk/backend/pixma/pixma.c
+===================================================================
+--- trunk.orig/backend/pixma/pixma.c
++++ trunk/backend/pixma/pixma.c
+@@ -159,10 +159,11 @@ static void mark_all_button_options_cach
+ ss -> button_option_is_cached[i] = 1;
+ }
+
+-static SANE_Status config_attach_pixma(SANEI_Config * config, const char *devname)
++static SANE_Status config_attach_pixma(SANEI_Config __sane_unused__ * config,
++ const char *devname,
++ void __sane_unused__ *data)
+ {
+ int i;
+- UNUSED(config);
+ for (i=0; i < (MAX_CONF_DEVICES -1); i++)
+ {
+ if(conf_devices[i] == NULL)
+@@ -1656,8 +1657,8 @@ sane_init (SANE_Int * version_code, SANE
+ config.descriptors = NULL;
+ config.values = NULL;
+
+- if (sanei_configure_attach(PIXMA_CONFIG_FILE, &config, config_attach_pixma) !=
+- SANE_STATUS_GOOD)
++ if (sanei_configure_attach(PIXMA_CONFIG_FILE, &config,
++ config_attach_pixma, NULL) != SANE_STATUS_GOOD)
+ PDBG(pixma_dbg(2, "Could not read pixma configuration file: %s\n",
+ PIXMA_CONFIG_FILE));
+
+Index: trunk/backend/rts8891.c
+===================================================================
+--- trunk.orig/backend/rts8891.c
++++ trunk/backend/rts8891.c
+@@ -217,7 +217,7 @@ static Rts8891_Config rtscfg;
+ /* ------------------------------------------------------------------------- */
+ static SANE_Status probe_rts8891_devices (void);
+ static SANE_Status config_attach_rts8891 (SANEI_Config * config,
+- const char *devname);
++ const char *devname, void *data);
+ static SANE_Status attach_rts8891 (const char *name);
+ static SANE_Status set_lamp_brightness (struct Rts8891_Device *dev,
+ int level);
+@@ -2374,7 +2374,7 @@ probe_rts8891_devices (void)
+
+ /* generic configure and attach function */
+ status = sanei_configure_attach (RTS8891_CONFIG_FILE, &config,
+- config_attach_rts8891);
++ config_attach_rts8891, NULL);
+ /* free allocated options */
+ for (i = 0; i < NUM_CFG_OPTIONS; i++)
+ {
+@@ -2398,7 +2398,8 @@ probe_rts8891_devices (void)
+ * SANE_STATUS_INVAL in case of error
+ */
+ static SANE_Status
+-config_attach_rts8891 (SANEI_Config * config, const char *devname)
++config_attach_rts8891 (SANEI_Config * config, const char *devname,
++ void __sane_unused__ *data)
+ {
+ /* currently, the config is a global variable so config is useless here */
+ /* the correct thing would be to have a generic sanei_attach_matching_devices
+Index: trunk/backend/umax_pp.c
+===================================================================
+--- trunk.orig/backend/umax_pp.c
++++ trunk/backend/umax_pp.c
+@@ -419,7 +419,8 @@ umax_pp_auto_attach (SANEI_Config * conf
+ * device name to use for attach try.
+ */
+ static SANE_Status
+-umax_pp_configure_attach (SANEI_Config * config, const char *devname)
++umax_pp_configure_attach (SANEI_Config * config, const char *devname,
++ void __sane_unused__ *data)
+ {
+ const char *lp;
+ SANE_Char *token;
+@@ -961,7 +962,7 @@ sane_init (SANE_Int * version_code, SANE
+
+ /* generic configure and attach function */
+ status = sanei_configure_attach (UMAX_PP_CONFIG_FILE, &config,
+- umax_pp_configure_attach);
++ umax_pp_configure_attach, NULL);
+
+ /* free option descriptors */
+ for (i = 0; i < NUM_CFG_OPTIONS; i++)
+Index: trunk/backend/xerox_mfp.c
+===================================================================
+--- trunk.orig/backend/xerox_mfp.c
++++ trunk/backend/xerox_mfp.c
+@@ -1028,7 +1028,8 @@ list_one_device(SANE_String_Const devnam
+
+ /* SANE API ignores return code of this callback */
+ static SANE_Status
+-list_conf_devices(UNUSED(SANEI_Config *config), const char *devname)
++list_conf_devices(SANEI_Config __sane_unused__ *config, const char *devname,
++ void __sane_unused__ *data)
+ {
+ return tr_from_devname(devname)->configure_device(devname, list_one_device);
+ }
+@@ -1080,7 +1081,7 @@ sane_get_devices(const SANE_Device *** d
+ config.count = 0;
+ config.descriptors = NULL;
+ config.values = NULL;
+- sanei_configure_attach(XEROX_CONFIG_FILE, &config, list_conf_devices);
++ sanei_configure_attach(XEROX_CONFIG_FILE, &config, list_conf_devices, NULL);
+
+ for (dev_count = 0, dev = devices_head; dev; dev = dev->next)
+ dev_count++;
+Index: trunk/include/sane/sanei_config.h
+===================================================================
+--- trunk.orig/include/sane/sanei_config.h
++++ trunk/include/sane/sanei_config.h
+@@ -166,7 +166,9 @@ typedef struct
+ extern SANE_Status sanei_configure_attach (
+ const char *config_file,
+ SANEI_Config *config,
+- SANE_Status (*config_attach)(SANEI_Config *config, const char *devname)
++ SANE_Status (*config_attach)(SANEI_Config *config, const char *devname,
++ void *data),
++ void *data
+ );
+
+ /** Return the list of config directories, extracted from the SANE_CONFIG_DIR
+Index: trunk/sanei/sanei_config.c
+===================================================================
+--- trunk.orig/sanei/sanei_config.c
++++ trunk/sanei/sanei_config.c
+@@ -239,7 +239,8 @@ sanei_config_read (char *str, int n, FIL
+ SANE_Status
+ sanei_configure_attach (const char *config_file, SANEI_Config * config,
+ SANE_Status (*attach) (SANEI_Config * config,
+- const char *devname))
++ const char *devname, void *data),
++ void *data)
+ {
+ SANE_Char line[PATH_MAX];
+ SANE_Char *token, *string;
+@@ -443,7 +444,7 @@ sanei_configure_attach (const char *conf
+ DBG (3, "sanei_configure_attach: trying to attach with '%s'\n",
+ lp2);
+ if(attach!=NULL)
+- attach (config, lp2);
++ attach (config, lp2, data);
+ }
+ }
+
+Index: trunk/testsuite/sanei/sanei_config_test.c
+===================================================================
+--- trunk.orig/testsuite/sanei/sanei_config_test.c
++++ trunk/testsuite/sanei/sanei_config_test.c
+@@ -63,7 +63,8 @@ static const SANE_String_Const string_li
+ static char *lastdevname = NULL;
+
+ static SANE_Status
+-check_config_attach (SANEI_Config * config, const char *devname)
++check_config_attach (SANEI_Config * config, const char *devname,
++ void __sane_unused__ *data)
+ {
+ /* silence compiler warning for now */
+ if (config == NULL)
+@@ -97,7 +98,8 @@ inexistent_config (void)
+ config.descriptors = NULL;
+ config.values = NULL;
+ status = sanei_configure_attach (CONFIG_PATH
+- "/data/inexistent.conf", &config, NULL);
++ "/data/inexistent.conf", &config,
++ NULL, NULL);
+
+ /* check results */
+ assert (status != SANE_STATUS_GOOD);
+@@ -114,7 +116,7 @@ null_config (void)
+
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/umax_pp.conf", NULL,
+- check_config_attach);
++ check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_GOOD);
+@@ -130,7 +132,7 @@ null_attach (void)
+ SANE_Status status;
+
+ status = sanei_configure_attach (CONFIG_PATH
+- "/data/umax_pp.conf", NULL, NULL);
++ "/data/umax_pp.conf", NULL, NULL, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_GOOD);
+@@ -151,7 +153,7 @@ empty_config (void)
+ config.values = NULL;
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/empty.conf",
+- &config, check_config_attach);
++ &config, check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_GOOD);
+@@ -206,7 +208,7 @@ string_option (void)
+ /* configure and attach */
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/string.conf",
+- &config, check_config_attach);
++ &config, check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_GOOD);
+@@ -250,7 +252,7 @@ int_option (void)
+ /* configure and attach */
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/int.conf", &config,
+- check_config_attach);
++ check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_GOOD);
+@@ -293,7 +295,7 @@ wrong_range_int_option (void)
+ /* configure and attach */
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/wrong-range.conf",
+- &config, check_config_attach);
++ &config, check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_INVAL);
+@@ -336,7 +338,7 @@ word_array_option (void)
+ /* configure and attach */
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/word-array.conf",
+- &config, check_config_attach);
++ &config, check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_GOOD);
+@@ -382,7 +384,7 @@ string_list_option (void)
+ /* configure and attach */
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/string-list.conf",
+- &config, check_config_attach);
++ &config, check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_GOOD);
+@@ -428,7 +430,7 @@ wrong_string_list_option (void)
+ status =
+ sanei_configure_attach (CONFIG_PATH
+ "/data/wrong-string-list.conf", &config,
+- check_config_attach);
++ check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_INVAL);
+@@ -563,7 +565,7 @@ umax_pp (void)
+ /* configure and attach */
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/umax_pp.conf",
+- &config, check_config_attach);
++ &config, check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_GOOD);
+@@ -631,7 +633,7 @@ wrong_bool_option (void)
+ /* configure and attach */
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/wrong-boolean.conf",
+- &config, check_config_attach);
++ &config, check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_INVAL);
+@@ -696,7 +698,7 @@ bool_option (void)
+ /* configure and attach */
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/boolean.conf",
+- &config, check_config_attach);
++ &config, check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_GOOD);
+@@ -767,7 +769,7 @@ fixed_option (void)
+ /* configure and attach */
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/fixed.conf",
+- &config, check_config_attach);
++ &config, check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_GOOD);
+@@ -814,7 +816,7 @@ wrong_fixed_option (void)
+ /* configure and attach */
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/wrong-fixed.conf",
+- &config, check_config_attach);
++ &config, check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_INVAL);
+@@ -852,7 +854,7 @@ snapscan (void)
+ /* configure and attach */
+ status =
+ sanei_configure_attach (CONFIG_PATH "/data/snapscan.conf",
+- &config, check_config_attach);
++ &config, check_config_attach, NULL);
+
+ /* check results */
+ assert (status == SANE_STATUS_GOOD);
diff --git a/debian/patches/0170-return_empty_list_when_local_devices_requested.patch b/debian/patches/0170-return_empty_list_when_local_devices_requested.patch
new file mode 100644
index 0000000..5d0ba04
--- /dev/null
+++ b/debian/patches/0170-return_empty_list_when_local_devices_requested.patch
@@ -0,0 +1,43 @@
+Description: eturn_empty_list_when_local_devices_requested
+Author: Barnabás Pőcze <pobrn@protonmail.com>
+Origin: backport, https://gitlab.com/sane-project/backends/-/commit/c946aa5a84297f33b30cddb0c89fcf375ed65d10
+Bug: https://gitlab.com/sane-project/backends/-/merge_requests/506
+Forwarded: not-needed
+Last-Update: 2020-09-19
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/backend/dell1600n_net.c
+===================================================================
+--- trunk.orig/backend/dell1600n_net.c
++++ trunk/backend/dell1600n_net.c
+@@ -233,6 +233,9 @@ static void JpegDecompTermSource (j_deco
+ /* Results of last call to sane_get_devices */
+ static struct DeviceRecord *gKnownDevices[MAX_SCANNERS];
+
++/* Empty list for when network devices are not wanted */
++static const SANE_Device *gEmptyDeviceList[1];
++
+ /* Array of open scanner device states.
+ :NOTE: (int)SANE_Handle is an offset into this array */
+ static struct ScannerState *gOpenScanners[MAX_SCANNERS];
+@@ -306,15 +309,17 @@ sane_get_devices (const SANE_Device ***
+ const char *pVal;
+ int valLen;
+
++ if (local_only) {
++ *device_list = gEmptyDeviceList;
++ return SANE_STATUS_GOOD;
++ }
++
+ /* init variables */
+ ret = SANE_STATUS_GOOD;
+ sock = 0;
+ pDevice = NULL;
+ optYes = 1;
+
+- if (local_only)
+- return ret;
+-
+ InitComBuf (&queryPacket);
+
+ /* clear previous results */
diff --git a/debian/patches/0175-fix_tests.patch b/debian/patches/0175-fix_tests.patch
new file mode 100644
index 0000000..77f5e03
--- /dev/null
+++ b/debian/patches/0175-fix_tests.patch
@@ -0,0 +1,96 @@
+Description: Fix test
+Author: Jörg Frings-Fürst <debian@jff.email>
+Bug: https://gitlab.com/sane-project/backends/-/issues/443
+Last-Update: 2021-02-17
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/testsuite/tools/data/db.ref
+===================================================================
+--- trunk.orig/testsuite/tools/data/db.ref
++++ trunk/testsuite/tools/data/db.ref
+@@ -1,5 +1,5 @@
+ # This file was generated from description files (*.desc)
+-# by sane-desc 3.6 from sane-backends 1.0.29-241-g1f9590ab
++# by sane-desc 3.6 from sane-backends 1.0.32-debian
+ #
+ # The entries below are used to detect a USB device when it's plugged in
+ # and then run a script to change the ownership and
+Index: trunk/testsuite/tools/data/html-backends-split.ref
+===================================================================
+--- trunk.orig/testsuite/tools/data/html-backends-split.ref
++++ trunk/testsuite/tools/data/html-backends-split.ref
+@@ -16496,6 +16496,6 @@ Grandtek Scopecam
+ >Contact</a>
+ </address>
+ <font size=-1>
+-This page was created by sane-desc 3.6 from sane-backends 1.0.29-241-g1f9590ab
++This page was created by sane-desc 3.6 from sane-backends 1.0.32-debian
+ </font>
+ </body> </html>
+Index: trunk/testsuite/tools/data/html-mfgs.ref
+===================================================================
+--- trunk.orig/testsuite/tools/data/html-mfgs.ref
++++ trunk/testsuite/tools/data/html-mfgs.ref
+@@ -23910,6 +23910,6 @@ qcam<br>(unmaintained)
+ >Contact</a>
+ </address>
+ <font size=-1>
+-This page was created by sane-desc 3.6 from sane-backends 1.0.29-241-g1f9590ab
++This page was created by sane-desc 3.6 from sane-backends 1.0.32-debian
+ </font>
+ </body> </html>
+Index: trunk/testsuite/tools/data/hwdb.ref
+===================================================================
+--- trunk.orig/testsuite/tools/data/hwdb.ref
++++ trunk/testsuite/tools/data/hwdb.ref
+@@ -1,5 +1,5 @@
+ # This file was generated from description files (*.desc)
+-# by sane-desc 3.6 from sane-backends 1.0.29-241-g1f9590ab
++# by sane-desc 3.6 from sane-backends 1.0.32-debian
+ #
+ # hwdb file for supported USB devices
+ #
+Index: trunk/testsuite/tools/data/udev+acl.ref
+===================================================================
+--- trunk.orig/testsuite/tools/data/udev+acl.ref
++++ trunk/testsuite/tools/data/udev+acl.ref
+@@ -1,5 +1,5 @@
+ # This file was generated from description files (*.desc)
+-# by sane-desc 3.6 from sane-backends 1.0.31-118-g5d3ce7806
++# by sane-desc 3.6 from sane-backends 1.0.32-debian
+ #
+ # udev rules file for supported USB and SCSI devices
+ #
+Index: trunk/testsuite/tools/data/udev+hwdb.ref
+===================================================================
+--- trunk.orig/testsuite/tools/data/udev+hwdb.ref
++++ trunk/testsuite/tools/data/udev+hwdb.ref
+@@ -1,5 +1,5 @@
+ # This file was generated from description files (*.desc)
+-# by sane-desc 3.6 from sane-backends 1.0.29-241-g1f9590ab
++# by sane-desc 3.6 from sane-backends 1.0.32-debian
+ #
+ # udev rules file for supported USB and SCSI devices
+ #
+Index: trunk/testsuite/tools/data/udev.ref
+===================================================================
+--- trunk.orig/testsuite/tools/data/udev.ref
++++ trunk/testsuite/tools/data/udev.ref
+@@ -1,5 +1,5 @@
+ # This file was generated from description files (*.desc)
+-# by sane-desc 3.6 from sane-backends 1.0.31-118-g5d3ce7806
++# by sane-desc 3.6 from sane-backends 1.0.32-debian
+ #
+ # udev rules file for supported USB and SCSI devices
+ #
+Index: trunk/testsuite/tools/data/usermap.ref
+===================================================================
+--- trunk.orig/testsuite/tools/data/usermap.ref
++++ trunk/testsuite/tools/data/usermap.ref
+@@ -1,5 +1,5 @@
+ # This file was generated from description files (*.desc)
+-# by sane-desc 3.6 from sane-backends 1.0.29-241-g1f9590ab
++# by sane-desc 3.6 from sane-backends 1.0.32-debian
+ #
+ # The entries below are used to detect a USB device and change owner
+ # and permissions on the "device node" used by libusb.
diff --git a/debian/patches/0180-gt68xx_fix_use-after-free_two_memleaks.patch b/debian/patches/0180-gt68xx_fix_use-after-free_two_memleaks.patch
new file mode 100644
index 0000000..167a9e5
--- /dev/null
+++ b/debian/patches/0180-gt68xx_fix_use-after-free_two_memleaks.patch
@@ -0,0 +1,55 @@
+Description: gt68xx: fix use-after-free and two mem leaks
+Author: <name and email of author, optional>
+Origin: https://gitlab.com/sane-project/backends/-/commit/63942f7a7473496d1160f02f5c1da3620525690d
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980311
+Forwarded: not-needed
+Last-Update: 2021-06-24
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/backend/gt68xx.c
+===================================================================
+--- trunk.orig/backend/gt68xx.c
++++ trunk/backend/gt68xx.c
+@@ -1174,8 +1174,11 @@ static SANE_Status probe_gt68xx_devices(
+ new_dev[i]->model->firmware_name);
+ }
+ if (i == 0)
+- DBG (5, "sane_init: firmware %s can't be loaded, set device "
+- "first\n", word);
++ {
++ DBG (5, "sane_init: firmware %s can't be loaded, set device "
++ "first\n", word);
++ free (word);
++ }
+ }
+ else
+ {
+@@ -1198,8 +1201,11 @@ static SANE_Status probe_gt68xx_devices(
+ new_dev[i]->model->name, new_dev[i]->model->vendor);
+ }
+ if (i == 0)
+- DBG (5, "sane_init: can't set vendor name %s, set device "
+- "first\n", word);
++ {
++ DBG (5, "sane_init: can't set vendor name %s, set device "
++ "first\n", word);
++ free (word);
++ }
+ }
+ else
+ {
+@@ -1221,9 +1227,11 @@ static SANE_Status probe_gt68xx_devices(
+ new_dev[i]->model->name, new_dev[i]->model->model);
+ }
+ if (i == 0)
+- DBG (5, "sane_init: can't set model name %s, set device "
+- "first\n", word);
+- free (word);
++ {
++ DBG (5, "sane_init: can't set model name %s, set device "
++ "first\n", word);
++ free (word);
++ }
+ }
+ else
+ {
diff --git a/debian/patches/0600-scanimage_manpage.patch b/debian/patches/0600-scanimage_manpage.patch
new file mode 100644
index 0000000..6e8cc23
--- /dev/null
+++ b/debian/patches/0600-scanimage_manpage.patch
@@ -0,0 +1,21 @@
+Description: Add remark to options.
+Author: Jörg Frings-Fürst <debian@jff-webhosting.net>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=418630
+Forwarded: not-needed
+Last-Update: 2015-01-18
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/doc/scanimage.man
+===================================================================
+--- trunk.orig/doc/scanimage.man
++++ trunk/doc/scanimage.man
+@@ -75,6 +75,9 @@ To print all available options:
+ scanimage \-h
+
+ .SH OPTIONS
++\fBRemark:\fR Parameter are defined by the backends. So are \-\-mode Gray and \-\-mode Grayscale in use.
++Please read the backend documentation first.
++
+ Parameters are separated by a blank from single-character options (e.g.
+ .BR "\-d epson" )
+ and by a "=" from multi-character options (e.g.
diff --git a/debian/patches/0605-fix_groff-warnings.patch b/debian/patches/0605-fix_groff-warnings.patch
new file mode 100644
index 0000000..9e8ecde
--- /dev/null
+++ b/debian/patches/0605-fix_groff-warnings.patch
@@ -0,0 +1,68 @@
+Description: Fix some groff warnings
+Author: Jörg Frings-Fürst <debian@jff.email>
+Bug: https://gitlab.com/sane-project/backends/-/issues/433
+Last-Update: 2021-02-17
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/doc/sane-canon_dr.man
+===================================================================
+--- trunk.orig/doc/sane-canon_dr.man
++++ trunk/doc/sane-canon_dr.man
+@@ -161,7 +161,7 @@ Some scanners pad the upper edge of one
+ .RE
+ .PP
+ .BR NOTE :
+-'option' lines may appear multiple times in the configuration file.
++"option" lines may appear multiple times in the configuration file.
+ They only apply to scanners discovered by the next 'scsi/usb' line.
+ .PP
+
+Index: trunk/doc/sane-pixma.man
+===================================================================
+--- trunk.orig/doc/sane-pixma.man
++++ trunk/doc/sane-pixma.man
+@@ -184,7 +184,7 @@ an up-to-date status at the project home
+ Users feedback is essential to help improve features and performances.
+ .SH OPTIONS
+ Besides "well-known" options (e.g. resolution, mode etc.)
+-.Bsane\-pixma
++.B sane\-pixma
+ backend also
+ provides the following options, i.e. the options might change in the future.
+ .br
+Index: trunk/doc/sane-scsi.man
+===================================================================
+--- trunk.orig/doc/sane-scsi.man
++++ trunk/doc/sane-scsi.man
+@@ -122,7 +122,7 @@ $ chmod 660 /dev/sg0
+ .RE
+ .PP
+ When your system uses the device filesystem (devfs), you have to edit
+-.BIR /etc/devfs/perms.
++.BI /etc/devfs/perms.
+ There you should search the line
+ .PP
+ .RS
+@@ -172,7 +172,7 @@ If there are no
+ devices, just do a
+ .I sh MAKEDEV uk0
+ in the
+-.i /dev
++.I /dev
+ directory. The scanner should then be accessible as
+ .I /dev/uk0
+ if it was probed during boot.
+Index: trunk/doc/sane-artec_eplus48u.man
+===================================================================
+--- trunk.orig/doc/sane-artec_eplus48u.man
++++ trunk/doc/sane-artec_eplus48u.man
+@@ -44,8 +44,7 @@ or
+ You can find it on the installation CD that was provided by the manufacturer,
+ normally in the directory Win98, WinMe or similar.
+ If the Windows-driver is installed on your computer, then you can also
+-find the firmware file under
+-.IR c:\\windows\\system32\\drivers .
++find the firmware file under c:\\windows\\system32\\drivers.
+
+ .SH CONFIGURATION
+ The contents of the
diff --git a/debian/patches/0705-kfreebsd.patch b/debian/patches/0705-kfreebsd.patch
new file mode 100644
index 0000000..34a510b
--- /dev/null
+++ b/debian/patches/0705-kfreebsd.patch
@@ -0,0 +1,17 @@
+description: Fix build failure on kfreebsd (closes: #680234)
+author: Petr Salinger
+Index: trunk/backend/umax_pp_low.c
+===================================================================
+--- trunk.orig/backend/umax_pp_low.c
++++ trunk/backend/umax_pp_low.c
+@@ -72,8 +72,10 @@
+ #endif
+
+ #ifdef HAVE_MACHINE_CPUFUNC_H
++#ifndef __GLIBC__
+ #include <machine/cpufunc.h>
+ #endif
++#endif
+
+ #ifdef HAVE_I386_SET_IOPERM
+ #include <machine/sysarch.h>
diff --git a/debian/patches/0725-fix_link_60-libsane_rule.patch b/debian/patches/0725-fix_link_60-libsane_rule.patch
new file mode 100644
index 0000000..0b424e2
--- /dev/null
+++ b/debian/patches/0725-fix_link_60-libsane_rule.patch
@@ -0,0 +1,33 @@
+Description: Fix directory for 20-sane.hwdb
+Author: Jörg Frings-Fürst <debian@jff.email>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916239
+Forwarded: not-needed
+Last-Update: 2019-04-27
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/tools/sane-desc.c
+===================================================================
+--- trunk.orig/tools/sane-desc.c
++++ trunk/tools/sane-desc.c
+@@ -3649,7 +3649,7 @@ print_udevhwdb_header (void)
+ ("#\n"
+ "# udev rules file for supported USB and SCSI devices\n"
+ "#\n"
+- "# For the list of supported USB devices see /usr/lib/udev/hwdb.d/20-sane.hwdb\n"
++ "# For the list of supported USB devices see /lib/udev/hwdb.d/20-sane.hwdb\n"
+ "#\n"
+ "# The SCSI device support is very basic and includes only\n"
+ "# scanners that mark themselves as type \"scanner\" or\n"
+Index: trunk/testsuite/tools/data/udev+hwdb.ref
+===================================================================
+--- trunk.orig/testsuite/tools/data/udev+hwdb.ref
++++ trunk/testsuite/tools/data/udev+hwdb.ref
+@@ -3,7 +3,7 @@
+ #
+ # udev rules file for supported USB and SCSI devices
+ #
+-# For the list of supported USB devices see /usr/lib/udev/hwdb.d/20-sane.hwdb
++# For the list of supported USB devices see /lib/udev/hwdb.d/20-sane.hwdb
+ #
+ # The SCSI device support is very basic and includes only
+ # scanners that mark themselves as type "scanner" or
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..2a4677c
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,20 @@
+0035-trim-libraries-in-sane-backends.pc.in.patch
+0040-remove_git.patch
+#0100-source_spelling.patch
+#0125-multiarch_dll_search_path.patch
+0175-fix_tests.patch
+0140-avahi.patch
+0145-avahi.patch
+0600-scanimage_manpage.patch
+0705-kfreebsd.patch
+0725-fix_link_60-libsane_rule.patch
+0150-i386-test.patch
+0155-hurd_PATH_MAX.patch
+0045-disable_lock_test_at_build_time.patch
+0050-Use-python3-shebang.patch
+#0055-Fix_build_error.patch
+0060-cross.patch
+#0165-respect_local_only_parameter.patch
+#0170-return_empty_list_when_local_devices_requested.patch
+0605-fix_groff-warnings.patch
+0180-gt68xx_fix_use-after-free_two_memleaks.patch