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

index 6aaaaf64d7e2ea55e7348f87bd469af848be3083..61a33b04754180ec183abd28f3f026e9e1e0b52d 100644 (file)
@@ -75,15 +75,17 @@ void kds_s2000w_handler_get_option(int option, void* value)
        if (result != 0 || resp->code == 404)
                return;
 
+       printf("DEBUG response: \n%s\n", resp->data);
        json_object* dpi_value_object = NULL;
        switch(option) {
                case 0:
                        int* ignore_value = (int*) value;
-                       *ignore_value = 0;
+                       *ignore_value = 2;
                        break;
                case 1:
                        dpi_value_object = json_object_object_get(config, "DPI");
                        int dpi_value = json_object_get_int(dpi_value_object);
+                       printf("DEBUG dpi_value: %i\n", dpi_value);
                        int* int_value = (int*) value;
                        *int_value = dpi_value;
                        break;
index 5ba9ea6a071cd146ff9b89833e09d48858047f2d..34b8bdb512587ed2cd77d6d49539145176d3b430 100644 (file)
@@ -86,7 +86,15 @@ const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor(
                        optionDescripor->constraint.string_list = NULL;
                        break;
                default:
-                       optionDescripor = NULL;
+                       optionDescripor->name = "";
+                       optionDescripor->title = "option number count";
+                       optionDescripor->desc = "available number of options";
+                       optionDescripor->type = SANE_TYPE_INT;
+                       optionDescripor->unit = SANE_UNIT_NONE;
+                       optionDescripor->size = sizeof(SANE_Int);
+                       optionDescripor->cap = SANE_CAP_SOFT_SELECT;
+                       optionDescripor->constraint_type = SANE_CONSTRAINT_NONE;
+                       optionDescripor->constraint.string_list = NULL;
                        break;
        }