]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change get option per config name
authorBastian Dehn <hhaalo@arcor.de>
Wed, 1 Oct 2025 10:30:39 +0000 (12:30 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 1 Oct 2025 10:30:39 +0000 (12:30 +0200)
src/kds_s2000w_handler_opts.c

index 857785757e901ce1eb78d75112c178c7b4bc6c76..4ee55a0f948fadb8ada64892c6a1965fcb5b0835 100644 (file)
@@ -341,14 +341,14 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
 
        option_descriptor* descriptor = kds_s2000w_option_descriptor_full_get_by_number(option);
        json_object* value_object = NULL;
-       if (option == 0) {
+       if (strcmp(descriptor->config_name, OPTION_COUNT) == 0) {
                config = json_object_object_get(h->current_scanner_config, "Configuration");
                int32_t* int_value_ptr = (int32_t*) value;
                *int_value_ptr = kds_s2000w_option_descriptors_get_max_option_count();
                return;
        }
 
-       if (option == 2) {
+       if (strcmp(descriptor->config_name, SCAN_SOURCE) == 0) {
                value_object = json_object_object_get(config, descriptor->config_name);
                _kds_s2000w_handler_opts_write_value(value_object, descriptor->descriptor->type, value);