]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add read option eight
authorBastian Dehn <hhaalo@arcor.de>
Sat, 27 Jan 2024 10:58:17 +0000 (11:58 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 27 Jan 2024 10:58:17 +0000 (11:58 +0100)
src/kds_s2000w_handler.c
src/kds_s2000w_net.c

index 0f791be641cb89b2311f4a312a5d4fdfc1837bcd..f445c9855321bb5222ceafe5a215f589f131d663 100644 (file)
@@ -89,7 +89,7 @@ void kds_s2000w_handler_get_option(int option, void* value)
                        int_value_ptr = (int*) value;
                        int_value = json_object_object_length(config);
                        printf("option number count: %i\n", int_value);
-                       *int_value_ptr = 8;
+                       *int_value_ptr = 9;
                        break;
                case 1:
                        value_object = json_object_object_get(config, "DPI");
@@ -135,7 +135,14 @@ void kds_s2000w_handler_get_option(int option, void* value)
                        int_value = json_object_get_int(value_object);
                        int_value_ptr = (int*) value;
                        *int_value_ptr = int_value;
-                       break;  
+                       break;
+               case 8:
+                       value_object = json_object_object_get(config, "OutputType");
+                       string_value = json_object_get_string(value_object);
+                       char_value = (char*) value;
+                       value_length = strlen(char_value);
+                       memcpy(char_value, string_value, sizeof(char) * value_length);
+                       break;
                default:
                        break;
        }
index bddf89b5bd064cccd51ce054a8aac1b4f16e070c..8c05cf8c90513a5cc7afcae2d1b669b299a88afa 100644 (file)
@@ -188,7 +188,18 @@ const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor(
                        option_descriptor_array.option_descriptors[option]->cap = SANE_CAP_SOFT_DETECT;
                        option_descriptor_array.option_descriptors[option]->constraint_type = SANE_CONSTRAINT_NONE;
                        option_descriptor_array.option_descriptors[option]->constraint.string_list = NULL;
-                       break;  
+                       break;
+               case 8:
+                       free(option_descriptor_array.option_descriptors[option]);
+                       option_descriptor_array.option_descriptors[option] = NULL;
+                       option_descriptor_array.option_descriptors[option] = malloc(sizeof(SANE_Option_Descriptor));
+                       option_descriptor_array.option_descriptors[option]->name = "outputtype";
+                       option_descriptor_array.option_descriptors[option]->title = "outputtype";
+                       option_descriptor_array.option_descriptors[option]->desc = "outputtype";
+                       option_descriptor_array.option_descriptors[option]->cap = SANE_CAP_SOFT_DETECT;
+                       option_descriptor_array.option_descriptors[option]->constraint_type = SANE_CONSTRAINT_NONE;
+                       option_descriptor_array.option_descriptors[option]->constraint.string_list = NULL;
+                       break;
                default:
                        return NULL;
                        break;
@@ -207,6 +218,7 @@ const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor(
                case 2:
                case 3:
                case 6:
+               case 8:
                        option_descriptor_array.option_descriptors[option]->type = SANE_TYPE_STRING;
                        option_descriptor_array.option_descriptors[option]->unit = SANE_UNIT_NONE;
                        option_descriptor_array.option_descriptors[option]->size = sizeof(SANE_String) * 50;