summaryrefslogtreecommitdiff
path: root/backend/magicolor.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2021-02-16 18:24:19 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2021-02-16 18:24:19 +0100
commit351b7328520c16730ceb46e5acae16038c42185e (patch)
treefae21fd5c94f3c3ed0202a95c9ada705482e647b /backend/magicolor.c
parentad38bc6ecb80ddeb562841b33258dd53659b1da6 (diff)
New upstream version 1.0.32upstream/1.0.32
Diffstat (limited to 'backend/magicolor.c')
-rw-r--r--backend/magicolor.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/backend/magicolor.c b/backend/magicolor.c
index 0b079fa..886dbab 100644
--- a/backend/magicolor.c
+++ b/backend/magicolor.c
@@ -2157,10 +2157,11 @@ attach_one_net(const char *dev, unsigned int model)
}
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_unused__ *config, const char *line)
} 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 ***device_list, SANE_Bool __sane_unused__ loc
/* 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;) {