Skip to content

Commit 7f4d270

Browse files
committed
Merge branch 'wip-fix-sane' into 'master'
Sane: backend 'net': item->get_options(): always call... Closes openpaperwork#1 See merge request World/OpenPaperwork/libinsane!29
2 parents a52a6ed + 99a27e6 commit 7f4d270

8 files changed

Lines changed: 7 additions & 444 deletions

File tree

subprojects/libinsane/include/libinsane/workarounds.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -112,27 +112,6 @@ extern enum lis_error lis_api_workaround_check_capabilities(
112112
);
113113

114114

115-
/*!
116-
* \brief Set some options only right before scanning.
117-
*
118-
* - API: Sane:
119-
* - Seen on:
120-
* - HP Deskjet 2130 and HP Scanjet 5550c
121-
* - Client: Libsane 1.0.27 + backend 'net'
122-
* - Server: Libsane 1.0.25 + backend 'hpaio'
123-
*
124-
* Setting mode=Color makes the whole thing go haywire:
125-
* It becomes impossible to list options anymore. So 'mode' must be set
126-
* only right before scanning.
127-
*
128-
* \param[in] to_wrap Base implementation to wrap.
129-
* \param[out] out_impl Implementation of the out_impl including the workaround.
130-
*/
131-
extern enum lis_error lis_api_workaround_set_opt_late(
132-
struct lis_api *to_wrap, struct lis_api **out_impl
133-
);
134-
135-
136115
/*!
137116
* \brief Thread-safety
138117
*

subprojects/libinsane/src/bases/sane.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,13 @@ static enum lis_error lis_sane_item_get_options(struct lis_item *self,
806806
int nb_opts, in, out;
807807
const SANE_Option_Descriptor *sane_desc;
808808

809+
// WORKAROUND(Jflesch):
810+
// When using the backend 'net', if we got a SANE_INFO_RELOAD_OPTIONS,
811+
// we must first call sane_get_option_descriptor() before sane_control_option()
812+
// even if we just want to use sane_control_option() to get the number of options.
813+
// --> we make unused call here just to make backend 'net' reloads the options.
814+
sane_get_option_descriptor(private->handle, 0);
815+
809816
err = sane_status_to_lis_error(sane_control_option(
810817
private->handle, 0 /* option 0 = number of options */,
811818
SANE_ACTION_GET_VALUE, &nb_opts, NULL

subprojects/libinsane/src/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ libinsane_srcs = files(
2727
'workarounds/one_page_flatbed.c',
2828
'workarounds/opt_names.c',
2929
'workarounds/opt_values.c',
30-
'workarounds/set_opt_late.c',
3130
)
3231

3332
deps = [dependency('threads')]

subprojects/libinsane/src/safebet.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ static const struct {
2727
enum lis_error (*wrap_cb)(struct lis_api *to_wrap, struct lis_api **wrapper);
2828
int enabled_by_default;
2929
} g_implementations[] = {
30-
{
31-
.name = "workaround_set_opt_late",
32-
.env = "LIBINSANE_WORKAROUND_SET_OPT_LATE",
33-
.wrap_cb = lis_api_workaround_set_opt_late,
34-
.enabled_by_default = 1,
35-
},
3630
{
3731
.name = "workaround_check_capabilities",
3832
.env = "LIBINSANE_WORKAROUND_CHECK_CAPABILITIES",

subprojects/libinsane/src/str2impls.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ enum lis_error lis_str2impls(const char *list_of_impls, struct lis_api **impls)
9393
err = lis_api_workaround_dedicated_thread(*impls, &next);
9494
} else if (strcmp(tok, "check_capabilities") == 0) {
9595
err = lis_api_workaround_check_capabilities(*impls, &next);
96-
} else if (strcmp(tok, "set_opt_late") == 0) {
97-
err = lis_api_workaround_set_opt_late(*impls, &next);
9896
} else if (strcmp(tok, "opt_names") == 0) {
9997
err = lis_api_workaround_opt_names(*impls, &next);
10098
} else if (strcmp(tok, "opt_values") == 0) {

subprojects/libinsane/src/workarounds/set_opt_late.c

Lines changed: 0 additions & 242 deletions
This file was deleted.

subprojects/libinsane/tests/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ LIBINSANE_VALGRIND_TESTS = [
2424
'normalizer_source_types',
2525
'workaround_cache',
2626
'workaround_check_capabilities',
27-
'workaround_set_opt_late',
2827
'workaround_dedicated_thread',
2928
'workaround_one_page_flatbed',
3029
'workaround_opt_names',

0 commit comments

Comments
 (0)