]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change load option only scanner config is null
authorBastian Dehn <hhaalo@arcor.de>
Sat, 18 Jan 2025 07:38:24 +0000 (08:38 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 18 Jan 2025 07:38:24 +0000 (08:38 +0100)
src/kds_s2000w_handler.c
src/kds_s2000w_handler.h
src/kds_s2000w_handler_opts.c
tests/kds_s2000w_net_get_opt_tests.c

index 6e684325c6706ba7b64ea078074d38617ace4224..352bc01a07310796d1f45b567c443497fa55a66d 100644 (file)
@@ -45,7 +45,6 @@ handler* init_handler()
 
        h->sessionid = 0;
        h->state = NOTCONNECTED;
-       h->current_scan_status->load_options = 0;
        h->current_scan_status->current_image_number = 1;
        h->current_scan_status->available_images = 0;
        h->current_scan_status->downloaded_images = 0;
@@ -92,7 +91,6 @@ void reset_handler(handler* h)
        h->image->data = NULL;
 
        h->state = NOTCONNECTED;
-       h->current_scan_status->load_options = 0;
        h->current_scan_status->current_image_number = 1;
        h->current_scan_status->available_images = 0;
        h->current_scan_status->downloaded_images = 0;
index fba170b513808e5e1cb19b2ecc558a16a072ba5b..6bdebf6e7b105884a143d55478c721216d46f313 100644 (file)
@@ -28,7 +28,6 @@ typedef struct {
 } metadata;
 
 typedef struct {
-       int load_options;
        int current_image_number;
        int available_images;
        int downloaded_images;
index 9ee056624d6c76febf30f69160f6ef6c3db115ee..86d602758c250a077fd54035c59ba7effa5896ca 100644 (file)
@@ -100,8 +100,7 @@ void kds_s2000w_handler_get_option(handler* h, int option, void* value, int* inf
        json_object* config = NULL;
        json_object* value_object = NULL;
 
-       if (h->current_scan_status->load_options < 1) {
-               h->current_scan_status->load_options = 1;
+       if (h->current_scanner_config == NULL) {
                _load_options(h);
                _set_autostart_on(h);
                _set_options(h);
@@ -209,8 +208,7 @@ void kds_s2000w_handler_set_option(handler* h, int option, void* value, int* inf
        if (h->read_info->scan_started)
                return;
 
-       if (h->current_scan_status->load_options == 0 && option > 0) {
-               h->current_scan_status->load_options = 1;
+       if (h->current_scanner_config == NULL) {
                _load_options(h);
                _set_autostart_on(h);
        }
index 71d331ef183a60ba8daa448aee038d778cb7169f..674581975fbdeb9ed6afcf6fac05d4f2f54acbf1 100644 (file)
@@ -31,7 +31,6 @@ void sane_kds_s2000w_net_control_get_option_zero(void** state)
 void sane_kds_s2000w_net_control_get_option_two(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        char value[50] = {0};
@@ -48,7 +47,6 @@ void sane_kds_s2000w_net_control_get_option_two(void** state)
 void sane_kds_s2000w_net_control_get_option_three(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        char value[50] = {0};
@@ -64,7 +62,6 @@ void sane_kds_s2000w_net_control_get_option_three(void** state)
 void sane_kds_s2000w_net_control_get_option_four(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        int value = 0;
@@ -80,7 +77,6 @@ void sane_kds_s2000w_net_control_get_option_four(void** state)
 void sane_kds_s2000w_net_control_get_option_five(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        char value[50] = {0};
@@ -96,7 +92,6 @@ void sane_kds_s2000w_net_control_get_option_five(void** state)
 void sane_kds_s2000w_net_control_get_option_seven(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        int value = -1;
@@ -112,7 +107,6 @@ void sane_kds_s2000w_net_control_get_option_seven(void** state)
 void sane_kds_s2000w_net_control_get_option_eight(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        char value[50] = {0};
@@ -128,7 +122,6 @@ void sane_kds_s2000w_net_control_get_option_eight(void** state)
 void sane_kds_s2000w_net_control_get_option_nine(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        int value = -1;
@@ -144,7 +137,6 @@ void sane_kds_s2000w_net_control_get_option_nine(void** state)
 void sane_kds_s2000w_net_control_get_option_ten(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        char value[50] = {0};
@@ -160,7 +152,6 @@ void sane_kds_s2000w_net_control_get_option_ten(void** state)
 void sane_kds_s2000w_net_control_get_option_eleven(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        char value[50] = {0};
@@ -176,7 +167,6 @@ void sane_kds_s2000w_net_control_get_option_eleven(void** state)
 void sane_kds_s2000w_net_control_get_option_twelve(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        int value = -1;
@@ -192,7 +182,6 @@ void sane_kds_s2000w_net_control_get_option_twelve(void** state)
 void sane_kds_s2000w_net_control_get_option_thirdteen(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        int value = -1;
@@ -208,7 +197,6 @@ void sane_kds_s2000w_net_control_get_option_thirdteen(void** state)
 void sane_kds_s2000w_net_control_get_option_fourteen(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        int value = -1;
@@ -224,7 +212,6 @@ void sane_kds_s2000w_net_control_get_option_fourteen(void** state)
 void sane_kds_s2000w_net_control_get_option_fifteen(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        int value = -1;
@@ -240,7 +227,6 @@ void sane_kds_s2000w_net_control_get_option_fifteen(void** state)
 void sane_kds_s2000w_net_control_get_option_sixteen(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        char value[50] = {0};
@@ -256,7 +242,6 @@ void sane_kds_s2000w_net_control_get_option_sixteen(void** state)
 void sane_kds_s2000w_net_control_get_option_seventeen(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        int value = -1;
@@ -272,7 +257,6 @@ void sane_kds_s2000w_net_control_get_option_seventeen(void** state)
 void sane_kds_s2000w_net_control_get_option_eightteen(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        char value[50] = {0};
@@ -288,7 +272,6 @@ void sane_kds_s2000w_net_control_get_option_eightteen(void** state)
 void sane_kds_s2000w_net_control_get_option_nineteen(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        int value = -1;
@@ -304,7 +287,6 @@ void sane_kds_s2000w_net_control_get_option_nineteen(void** state)
 void sane_kds_s2000w_net_control_get_option_twenty(void** state)
 {
        handler* h = init_handler();
-       h->current_scan_status->load_options = 1;
        response* resp = (response*) *state;
        h->current_scanner_config = json_tokener_parse(resp->data);
        int value = -1;