summaryrefslogtreecommitdiff
path: root/debian/patches/0165-respect_local_only_parameter.patch
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-09-05 17:48:57 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-09-05 17:48:57 +0200
commitbce41b3c37c2a68e7dab234ce0247755a61ceb40 (patch)
tree444e59ece236e09dc153f665e42160aeb0208c24 /debian/patches/0165-respect_local_only_parameter.patch
parent5973e8e9a82906cec6520aef5140ad1280f862ea (diff)
new d/p/0165-respect_local_only_parameter.patch
Diffstat (limited to 'debian/patches/0165-respect_local_only_parameter.patch')
-rw-r--r--debian/patches/0165-respect_local_only_parameter.patch768
1 files changed, 768 insertions, 0 deletions
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..24fd39c
--- /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
+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);