From d651e44192c09628d8856debe9bab9cec7c38b15 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Fri, 31 Jul 2020 13:47:58 +0200 Subject: [PATCH] pixma: Log unsupported scanner type in BJNP and AXIS --- backend/pixma/pixma_axis.c | 11 ++++++++++- backend/pixma/pixma_bjnp.c | 3 +++ backend/pixma/pixma_io_sanei.c | 5 +---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/backend/pixma/pixma_axis.c b/backend/pixma/pixma_axis.c index e489c5975..246c97035 100644 --- a/backend/pixma/pixma_axis.c +++ b/backend/pixma/pixma_axis.c @@ -491,7 +491,16 @@ add_scanner(int udp_socket, const char *uri, if (status == 1) snprintf(serial, sizeof(serial), "%s BUSY %s", inet_ntoa(addr.sin_addr), user); device[axis_no_devices++].addr = addr.sin_addr; - attach_axis(uri, devname, serial, pixma_devices); + switch (attach_axis(uri, devname, serial, pixma_devices)) + { + case SANE_STATUS_GOOD: + break; + case SANE_STATUS_INVAL: + DBG(LOG_CRIT, "add_scanner: Scanner %s is not supported, model is unknown! Please report upstream\n", devname); + break; + default: + DBG(LOG_CRIT, "add_scanner: unexpected error (out of memory?)\n"); + } } return 0; diff --git a/backend/pixma/pixma_bjnp.c b/backend/pixma/pixma_bjnp.c index 2c3fc09d1..dc374bfd0 100644 --- a/backend/pixma/pixma_bjnp.c +++ b/backend/pixma/pixma_bjnp.c @@ -1845,6 +1845,9 @@ static void add_scanner(SANE_Int *dev_no, PDBG (bjnp_dbg (LOG_NOTICE, "add_scanner: New scanner added: %s, serial %s, mac address: %s.\n", uri, serial, device[*dev_no].mac_address)); break; + case SANE_STATUS_INVAL: + PDBG (bjnp_dbg (LOG_CRIT, "add_scanner: Scanner %s is not supported, model is unknown! Please report upstream\n", makemodel)); + break; default: PDBG (bjnp_dbg (LOG_CRIT, "add_scanner: unexpected error (out of memory?), adding %s\n", makemodel)); } diff --git a/backend/pixma/pixma_io_sanei.c b/backend/pixma/pixma_io_sanei.c index e85dfb31e..e83c71067 100644 --- a/backend/pixma/pixma_io_sanei.c +++ b/backend/pixma/pixma_io_sanei.c @@ -178,10 +178,7 @@ attach_net (SANE_String_Const devname, SANE_String_Const makemodel, if (!si->devname) return SANE_STATUS_NO_MEM; if ((cfg = lookup_scanner(makemodel, pixma_devices)) == (struct pixma_config_t *)NULL) - { - pixma_dbg (0, "attach_net: Scanner %s is not supported, model is unknown! Please report upstream\n", makemodel); - error = SANE_STATUS_INVAL; - } + error = SANE_STATUS_INVAL; else { si->cfg = cfg;