From 646ee990d39e04984354dc394153fb74d8d94200 Mon Sep 17 00:00:00 2001 From: thierry1970 Date: Wed, 6 May 2020 16:08:53 +0200 Subject: [PATCH] Reduces the number of entries on offer. --- backend/escl/escl.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/backend/escl/escl.c b/backend/escl/escl.c index 2495d26a9..f519081cb 100644 --- a/backend/escl/escl.c +++ b/backend/escl/escl.c @@ -155,9 +155,24 @@ escl_device_add(int port_nb, const char *model_name, char *ip_address, char *typ ESCL_Device *current = NULL; DBG (10, "escl_device_add\n"); for (current = list_devices_primary; current; current = current->next) { - if (strcmp(current->ip_address, ip_address) == 0 && current->port_nb == port_nb - && strcmp(current->type, type) == 0) - return (SANE_STATUS_GOOD); + if (strcmp(current->ip_address, ip_address) == 0) + { + DBG (10, "escl_device_add IP[%s]->[%s]\n", current->ip_address, current->type, type); + if (strcmp(current->type, type)) + { + if(!strcmp(type, "_uscans._tcp") || + !strcmp(type, "https")) + { + free (current->type); + current->type = strdup(type); + current->port_nb = port_nb; + current->https = SANE_TRUE; + } + return (SANE_STATUS_GOOD); + } + else if (current->port_nb == port_nb) + return (SANE_STATUS_GOOD); + } } current = (ESCL_Device*)calloc(1, sizeof(*current)); if (current == NULL) {