From 154bea9618c752c20f286ea397a78b746f65439f Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Sun, 20 Jul 2008 10:28:14 +0000 Subject: [PATCH] sane_control_option(): perform options reload if asked by the remote backend and the frontend doesn't care (info == NULL) --- ChangeLog | 6 ++++++ backend/net.c | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f905a7e99..8421a2698 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-07-20 Julien Blache + * backend/net.c: sane_control_option: when the frontend doesn't + care (info == NULL) and the remote backend asks for a reload, + perform the reload. Hopefully this brings the behaviour back in + line with standard backends. + 2008-07-15 Nicolas Martin * backend/pixma_mp150.c: Changed page scan end condition to handle correctly PIXMA ADF. diff --git a/backend/net.c b/backend/net.c index 79dd394e0..b6b57753f 100644 --- a/backend/net.c +++ b/backend/net.c @@ -1705,6 +1705,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option, SANE_Status status; size_t value_size; int need_auth; + SANE_Word local_info; DBG (3, "sane_control_option: option %d, action %d\n", option, action); @@ -1755,6 +1756,8 @@ sane_control_option (SANE_Handle handle, SANE_Int option, req.value_size = value_size; req.value = value; + local_info = 0; + DBG (3, "sane_control_option: remote control option\n"); sanei_w_call (&s->hw->wire, SANE_NET_CONTROL_OPTION, (WireCodecFunc) sanei_w_control_option_req, &req, @@ -1779,6 +1782,8 @@ sane_control_option (SANE_Handle handle, SANE_Int option, } else if (status == SANE_STATUS_GOOD) { + local_info = reply.info; + if (info) *info = reply.info; if (value_size > 0) @@ -1800,7 +1805,19 @@ sane_control_option (SANE_Handle handle, SANE_Int option, } while (need_auth); - DBG (2, "sane_control_option: done (%s)\n", sane_strstatus (status)); + DBG (2, "sane_control_option: remote done (%s, info %x)\n", sane_strstatus (status), local_info); + + if ((status == SANE_STATUS_GOOD) && (info == NULL) && (local_info & SANE_INFO_RELOAD_OPTIONS)) + { + DBG (2, "sane_control_option: reloading options as frontend does not care\n"); + + status = fetch_options (s); + + DBG (2, "sane_control_option: reload done (%s)\n", sane_strstatus (status)); + } + + DBG (2, "sane_control_option: done (%s, info %x)\n", sane_strstatus (status), local_info); + return status; }