]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
fix load first option
authorBastian Dehn <hhaalo@arcor.de>
Thu, 25 Jan 2024 18:30:16 +0000 (19:30 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Thu, 25 Jan 2024 18:30:16 +0000 (19:30 +0100)
src/kds_s2000w_handler.c
src/kds_s2000w_net.c

index 65eeac7dc02e959836101ae7c572e193d618bc40..1fa74828dd8af2839fc8b1c3d98099519b2b6708 100644 (file)
@@ -87,26 +87,19 @@ current_state* kds_s2000w_handler_current_state()
 
 void kds_s2000w_handler_get_option(int option, void* value)
 {
-       if (option != 0)
-               return;
-
        if (option == 0)
                _get_all_options();
 
        if (_all_options == NULL)
                return;
 
-       json_object* config = NULL;
        switch(option) {
                case 1:
-                       config = json_object_object_get(_all_options, "Configuration");
-                       json_object* dpi = json_object_object_get(config, "DPI");
-                       array_list* dpi_list = json_object_get_array(dpi);
-                       int** value_list = (int**) value;
-                       memcpy(value_list, dpi_list->array, dpi_list->size);
+                       int* int_value = (int*) value;
+                       *int_value = 300;
                        break;
                default:
-                       config = json_object_object_get(_all_options, "Configuration");
+                       json_object* config = json_object_object_get(_all_options, "Configuration");
                        int* num_options = (int*) value;
                        *num_options = 0;
                        *num_options = json_object_object_length(config);
index 2f5a9c2dae824658c476edc15aaa23ada7b2a6e5..0ce53272388ecf5893a7d4c90af5d38dcddf9061 100644 (file)
@@ -74,6 +74,17 @@ const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor(
 {
        current_state* state = kds_s2000w_handler_current_state();
        switch (option) {
+               case 1:
+                       optionDescripor->name = "resolution";
+                       optionDescripor->title = "resolution";
+                       optionDescripor->desc = "resolution";
+                       optionDescripor->type = SANE_TYPE_INT;
+                       optionDescripor->unit = SANE_UNIT_DPI;
+                       optionDescripor->size = sizeof(SANE_Int);
+                       optionDescripor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+                       optionDescripor->constraint_type = SANE_CONSTRAINT_NONE;
+                       optionDescripor->constraint.string_list = NULL;
+                       break;
                case 0:
                        optionDescripor->name = "";
                        optionDescripor->title = "";