From: Bastian Dehn Date: Thu, 25 Sep 2025 07:43:24 +0000 (+0200) Subject: add autostart option for full profile X-Git-Tag: v1.1.7^2~3^2~2 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=6bd9d5ab20158b63386898c1d370d5fd78be4962;p=sane-kds-s2000w-net.git add autostart option for full profile --- diff --git a/src/kds_s2000w_option_descriptors.c b/src/kds_s2000w_option_descriptors.c index 490642e..5521cca 100644 --- a/src/kds_s2000w_option_descriptors.c +++ b/src/kds_s2000w_option_descriptors.c @@ -4,7 +4,7 @@ #include "kds_s2000w_option_descriptors.h" #include "kds_s2000w_debug.h" -#define PROFILE_FULL_MAX_OPTION_COUNT 47 +#define PROFILE_FULL_MAX_OPTION_COUNT 48 #define PROFILE_230802_V1_0_36_MAX_OPTION_COUNT 24 #define PROFILE_MIN_MAX_OPTION_COUNT 10 @@ -1040,6 +1040,24 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_height() return descriptor; } +SANE_Option_Descriptor _kds_s2000w_option_descriptor_autostart() +{ + kds_s2000w_debug_printf(ALL, "_kds_s2000w_option_descriptor_autostart"); + + SANE_Option_Descriptor descriptor = { + "autostart", + "Autostart", + "Autostart", + SANE_TYPE_BOOL, + SANE_UNIT_NONE, + sizeof(SANE_Int), + SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, + SANE_CONSTRAINT_NONE + }; + + return descriptor; +} + SANE_Option_Descriptor _kds_s2000w_option_descriptor_boldness_smoothing_group() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_advanced_group"); @@ -1293,18 +1311,20 @@ void _kds_s2000w_option_descriptors_init_full_profile() descriptors[39]->descriptor = _kds_s2000w_option_descriptor_jpeg_quality(); descriptors[40]->config_name = FEEDER_GROUP; descriptors[40]->descriptor = _kds_s2000w_option_descriptor_feeder_group(); - descriptors[41]->config_name = MAX_DOCUMENT_LENGTH; - descriptors[41]->descriptor = _kds_s2000w_option_descriptor_max_document_length(); - descriptors[42]->config_name = TRANSPORT_HANDLING; - descriptors[42]->descriptor = _kds_s2000w_option_descriptor_transport_handling(); - descriptors[43]->config_name = MULTIFEED_SENSITIVITY; - descriptors[43]->descriptor = _kds_s2000w_option_descriptor_multifeed_sensitivity(); - descriptors[44]->config_name = MULTIFEED_RESPONSE; - descriptors[44]->descriptor = _kds_s2000w_option_descriptor_multifeed_response(); - descriptors[45]->config_name = DOCUMENT_FEEDER_TIMEOUT; - descriptors[45]->descriptor = _kds_s2000w_option_descriptor_document_feeder_timeout(); - descriptors[46]->config_name = DOCUMENT_FEEDER_TIMEOUT_RESPONSE; - descriptors[46]->descriptor = _kds_s2000w_option_descriptor_document_feeder_timeout_response(); + descriptors[41]->config_name = AUTOSTART; + descriptors[41]->descriptor = _kds_s2000w_option_descriptor_autostart(); + descriptors[42]->config_name = MAX_DOCUMENT_LENGTH; + descriptors[42]->descriptor = _kds_s2000w_option_descriptor_max_document_length(); + descriptors[43]->config_name = TRANSPORT_HANDLING; + descriptors[43]->descriptor = _kds_s2000w_option_descriptor_transport_handling(); + descriptors[44]->config_name = MULTIFEED_SENSITIVITY; + descriptors[44]->descriptor = _kds_s2000w_option_descriptor_multifeed_sensitivity(); + descriptors[45]->config_name = MULTIFEED_RESPONSE; + descriptors[45]->descriptor = _kds_s2000w_option_descriptor_multifeed_response(); + descriptors[46]->config_name = DOCUMENT_FEEDER_TIMEOUT; + descriptors[46]->descriptor = _kds_s2000w_option_descriptor_document_feeder_timeout(); + descriptors[47]->config_name = DOCUMENT_FEEDER_TIMEOUT_RESPONSE; + descriptors[47]->descriptor = _kds_s2000w_option_descriptor_document_feeder_timeout_response(); } void kds_s2000w_option_descriptors_init(uint8_t profile) diff --git a/src/kds_s2000w_option_descriptors.h b/src/kds_s2000w_option_descriptors.h index d838808..a9d8ef4 100644 --- a/src/kds_s2000w_option_descriptors.h +++ b/src/kds_s2000w_option_descriptors.h @@ -50,6 +50,7 @@ #define JPEG_QUALITY "JpegQuality" #define FEEDER_GROUP "FeederGroup" +#define AUTOSTART "AutoStart" #define MAX_DOCUMENT_LENGTH "MaxDocumentLength" #define TRANSPORT_HANDLING "TransportHandling" #define MULTIFEED_SENSITIVITY "MultifeedSensitivity" diff --git a/tests/kds_s2000w_net_get_opt_tests.c b/tests/kds_s2000w_net_get_opt_tests.c index 8f81281..2fe9b3a 100644 --- a/tests/kds_s2000w_net_get_opt_tests.c +++ b/tests/kds_s2000w_net_get_opt_tests.c @@ -7,7 +7,7 @@ #include "../src/kds_s2000w_net.h" #include "../src/kds_s2000w_handler.h" -#define FULL_PROFILE_MAX_OPTION_COUNT 47 +#define FULL_PROFILE_MAX_OPTION_COUNT 48 void sane_kds_s2000w_net_control_get_option_zero_test(void** state) { @@ -530,11 +530,11 @@ void sane_kds_s2000w_net_control_get_option_fourtyone_test(void** state) handler* h = kds_s2000w_handler_init(); response* resp = (response*) *state; h->current_scanner_config = json_tokener_parse(resp->data); - uint32_t value = -1; + uint32_t value = 0; sane_kds_s2000w_net_control_option(h, 41, SANE_ACTION_GET_VALUE, &value, NULL); - assert_int_equal(value, 140); + assert_int_equal(value, 0); kds_s2000w_handler_free(h); h = NULL; @@ -545,11 +545,11 @@ void sane_kds_s2000w_net_control_get_option_fourtytwo_test(void** state) handler* h = kds_s2000w_handler_init(); response* resp = (response*) *state; h->current_scanner_config = json_tokener_parse(resp->data); - char value[50] = {0}; + uint32_t value = -1; sane_kds_s2000w_net_control_option(h, 42, SANE_ACTION_GET_VALUE, &value, NULL); - assert_string_equal(value, "Normal"); + assert_int_equal(value, 140); kds_s2000w_handler_free(h); h = NULL; @@ -564,13 +564,12 @@ void sane_kds_s2000w_net_control_get_option_fourtythree_test(void** state) sane_kds_s2000w_net_control_option(h, 43, SANE_ACTION_GET_VALUE, &value, NULL); - assert_string_equal(value, "None"); + assert_string_equal(value, "Normal"); kds_s2000w_handler_free(h); h = NULL; } - void sane_kds_s2000w_net_control_get_option_fourtyfour_test(void** state) { handler* h = kds_s2000w_handler_init(); @@ -580,7 +579,7 @@ void sane_kds_s2000w_net_control_get_option_fourtyfour_test(void** state) sane_kds_s2000w_net_control_option(h, 44, SANE_ACTION_GET_VALUE, &value, NULL); - assert_string_equal(value, "Stop"); + assert_string_equal(value, "None"); kds_s2000w_handler_free(h); h = NULL; @@ -591,11 +590,11 @@ void sane_kds_s2000w_net_control_get_option_fourtyfive_test(void** state) handler* h = kds_s2000w_handler_init(); response* resp = (response*) *state; h->current_scanner_config = json_tokener_parse(resp->data); - uint32_t value = -1; + char value[50] = {0}; sane_kds_s2000w_net_control_option(h, 45, SANE_ACTION_GET_VALUE, &value, NULL); - assert_int_equal(value, 2); + assert_string_equal(value, "Stop"); kds_s2000w_handler_free(h); h = NULL; @@ -606,10 +605,25 @@ void sane_kds_s2000w_net_control_get_option_fourtysix_test(void** state) handler* h = kds_s2000w_handler_init(); response* resp = (response*) *state; h->current_scanner_config = json_tokener_parse(resp->data); - char value[50] = {0}; + uint32_t value = -1; sane_kds_s2000w_net_control_option(h, 46, SANE_ACTION_GET_VALUE, &value, NULL); + assert_int_equal(value, 2); + + kds_s2000w_handler_free(h); + h = NULL; +} + +void sane_kds_s2000w_net_control_get_option_fourtyseven_test(void** state) +{ + handler* h = kds_s2000w_handler_init(); + response* resp = (response*) *state; + h->current_scanner_config = json_tokener_parse(resp->data); + char value[50] = {0}; + + sane_kds_s2000w_net_control_option(h, 47, SANE_ACTION_GET_VALUE, &value, NULL); + assert_string_equal(value, "Stop"); kds_s2000w_handler_free(h); diff --git a/tests/kds_s2000w_net_get_opt_tests.h b/tests/kds_s2000w_net_get_opt_tests.h index 3659963..d8cd008 100644 --- a/tests/kds_s2000w_net_get_opt_tests.h +++ b/tests/kds_s2000w_net_get_opt_tests.h @@ -46,5 +46,6 @@ void sane_kds_s2000w_net_control_get_option_fourtythree_test(void** state); void sane_kds_s2000w_net_control_get_option_fourtyfour_test(void** state); void sane_kds_s2000w_net_control_get_option_fourtyfive_test(void** state); void sane_kds_s2000w_net_control_get_option_fourtysix_test(void** state); +void sane_kds_s2000w_net_control_get_option_fourtyseven_test(void** state); #endif \ No newline at end of file diff --git a/tests/kds_s2000w_net_get_opt_tests_run.c b/tests/kds_s2000w_net_get_opt_tests_run.c index b059c52..6acdfd6 100644 --- a/tests/kds_s2000w_net_get_opt_tests_run.c +++ b/tests/kds_s2000w_net_get_opt_tests_run.c @@ -122,7 +122,8 @@ int main() cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_fourtythree_test, setup_default_get_option, teardown_default_get_option), cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_fourtyfour_test, setup_default_get_option, teardown_default_get_option), cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_fourtyfive_test, setup_default_get_option, teardown_default_get_option), - cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_fourtysix_test, setup_default_get_option, teardown_default_get_option) + cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_fourtysix_test, setup_default_get_option, teardown_default_get_option), + cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_fourtyseven_test, setup_default_get_option, teardown_default_get_option) }; return cmocka_run_group_tests(net_tests, NULL, NULL); diff --git a/tests/kds_s2000w_option_descriptor_tests.c b/tests/kds_s2000w_option_descriptor_tests.c index 66b0254..1935f15 100644 --- a/tests/kds_s2000w_option_descriptor_tests.c +++ b/tests/kds_s2000w_option_descriptor_tests.c @@ -716,6 +716,19 @@ void kds_s2000w_option_get_descriptor_fourtyone_test() { SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get_by_number(41); + assert_string_equal("autostart", option->name); + assert_string_equal("Autostart", option->title); + assert_string_equal("Autostart", option->desc); + assert_int_equal(SANE_TYPE_BOOL, option->type); + assert_int_equal(SANE_UNIT_NONE, option->unit); + assert_int_equal(sizeof(SANE_Int), option->size); + assert_int_equal(SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, option->cap); + assert_int_equal(SANE_CONSTRAINT_NONE, option->constraint_type); +} + +void kds_s2000w_option_get_descriptor_fourtytwo_test() +{ + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get_by_number(42); assert_string_equal("max-document-length", option->name); assert_string_equal("Max Document Length", option->title); @@ -730,9 +743,9 @@ void kds_s2000w_option_get_descriptor_fourtyone_test() assert_int_equal(option->constraint.range->quant, 1); } -void kds_s2000w_option_get_descriptor_fourtytwo_test() +void kds_s2000w_option_get_descriptor_fourtythree_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get_by_number(42); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get_by_number(43); assert_string_equal("transport-handling", option->name); assert_string_equal("Transport Handling", option->title); @@ -749,9 +762,9 @@ void kds_s2000w_option_get_descriptor_fourtytwo_test() assert_null(option->constraint.string_list[4]); } -void kds_s2000w_option_get_descriptor_fourtythree_test() +void kds_s2000w_option_get_descriptor_fourtyfour_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get_by_number(43); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get_by_number(44); assert_string_equal("multifeed-sensitivity", option->name); assert_string_equal("Multifeed Sensitivity", option->title); @@ -768,9 +781,9 @@ void kds_s2000w_option_get_descriptor_fourtythree_test() assert_null(option->constraint.string_list[4]); } -void kds_s2000w_option_get_descriptor_fourtyfour_test() +void kds_s2000w_option_get_descriptor_fourtyfive_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get_by_number(44); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get_by_number(45); assert_string_equal("multifeed-response", option->name); assert_string_equal("Multifeed Response", option->title); @@ -785,9 +798,9 @@ void kds_s2000w_option_get_descriptor_fourtyfour_test() assert_null(option->constraint.string_list[2]); } -void kds_s2000w_option_get_descriptor_fourtyfive_test() +void kds_s2000w_option_get_descriptor_fourtysix_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get_by_number(45); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get_by_number(46); assert_string_equal("document-feeder-timeout", option->name); assert_string_equal("Document Feeder Timeout", option->title); @@ -802,9 +815,9 @@ void kds_s2000w_option_get_descriptor_fourtyfive_test() assert_int_equal(option->constraint.range->quant, 1); } -void kds_s2000w_option_get_descriptor_fourtysix_test() +void kds_s2000w_option_get_descriptor_fourtyseven_test() { - SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get_by_number(46); + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get_by_number(47); assert_string_equal("document-feeder-timeout-response", option->name); assert_string_equal("Document Feeder Timeout Response", option->title); diff --git a/tests/kds_s2000w_option_descriptor_tests.h b/tests/kds_s2000w_option_descriptor_tests.h index 0e5cefe..4748008 100644 --- a/tests/kds_s2000w_option_descriptor_tests.h +++ b/tests/kds_s2000w_option_descriptor_tests.h @@ -55,6 +55,7 @@ void kds_s2000w_option_get_descriptor_fourtythree_test(); void kds_s2000w_option_get_descriptor_fourtyfour_test(); void kds_s2000w_option_get_descriptor_fourtyfive_test(); void kds_s2000w_option_get_descriptor_fourtysix_test(); +void kds_s2000w_option_get_descriptor_fourtyseven_test(); void kds_s2000w_option_get_descriptor_get_by_name_test(); void kds_s2000w_option_get_descriptor_over_max_options_test(); void kds_s2000w_option_full_get_descriptor_by_number(); diff --git a/tests/kds_s2000w_option_descriptor_tests_run.c b/tests/kds_s2000w_option_descriptor_tests_run.c index f18fa00..988fc0e 100644 --- a/tests/kds_s2000w_option_descriptor_tests_run.c +++ b/tests/kds_s2000w_option_descriptor_tests_run.c @@ -50,6 +50,7 @@ int main() cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_fourtyfour_test, setup, teardown), cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_fourtyfive_test, setup, teardown), cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_fourtysix_test, setup, teardown), + cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_fourtyseven_test, setup, teardown), cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_get_by_name_test, setup, teardown), cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_over_max_options_test, setup, teardown), cmocka_unit_test_setup_teardown(kds_s2000w_option_full_get_descriptor_by_number, setup, teardown),