Fetch option descriptors in sane_open() so a GET_VALUE on option 0 can still

work without having to get option descriptor 0 beforehand.
merge-requests/1/head
Julien BLACHE 2008-06-24 20:07:01 +00:00
rodzic 0ec211ef87
commit 29e8be57e5
2 zmienionych plików z 23 dodań i 2 usunięć

Wyświetl plik

@ -1,7 +1,9 @@
2008-06-24 Julien Blache <jb@jblache.org>
* backend/net.c: do not reload options behind the frontend's back
in sane_control_option; rather return SANE_STATUS_INVAL and warn
that the frontend is buggy.
that the frontend is buggy. Fetch option descriptors in
sane_open() so a GET_VALUE on option 0 can still work without
having to get option descriptor 0 beforehand.
* frontend/saned.c: rework error/exit path in process_request()
to properly terminate the Avahi thread when in debug mode.

Wyświetl plik

@ -1361,6 +1361,7 @@ sane_open (SANE_String_Const full_name, SANE_Handle * meta_handle)
SANE_String nd_name;
SANE_Status status;
SANE_Word handle;
SANE_Word ack;
Net_Device *dev;
Net_Scanner *s;
int need_auth;
@ -1585,8 +1586,26 @@ sane_open (SANE_String_Const full_name, SANE_Handle * meta_handle)
s->next = first_handle;
s->local_opt.desc = 0;
s->local_opt.num_options = 0;
DBG (3, "sane_open: getting option descriptors\n");
status = fetch_options (s);
if (status != SANE_STATUS_GOOD)
{
DBG (1, "sane_open: fetch_options failed (%s), closing device again\n",
sane_strstatus (status));
sanei_w_call (&s->hw->wire, SANE_NET_CLOSE,
(WireCodecFunc) sanei_w_word, &s->handle,
(WireCodecFunc) sanei_w_word, &ack);
free (s);
return status;
}
first_handle = s;
*meta_handle = s;
DBG (3, "sane_open: success\n");
return SANE_STATUS_GOOD;
}
@ -1658,7 +1677,7 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
if (!s->options_valid)
{
DBG (3, "sane_get_option_descripter: getting option descriptors\n");
DBG (3, "sane_get_option_descriptor: getting option descriptors\n");
status = fetch_options (s);
if (status != SANE_STATUS_GOOD)
{