From: Bastian Dehn Date: Sat, 27 Jan 2024 11:29:21 +0000 (+0100) Subject: add option teen X-Git-Tag: v1.0.0^2~441 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=e2a9afa3b0526f7d3bdab434337242d0d2fb9a98;p=sane-kds-s2000w-net.git add option teen --- diff --git a/src/kds_s2000w_handler.c b/src/kds_s2000w_handler.c index bd85f57..1f8d76c 100644 --- a/src/kds_s2000w_handler.c +++ b/src/kds_s2000w_handler.c @@ -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 = 10; + *int_value_ptr = 11; break; case 1: value_object = json_object_object_get(config, "DPI"); @@ -152,6 +152,15 @@ void kds_s2000w_handler_get_option(int option, void* value) value_length = strlen(string_value) + 1; memcpy(char_value, string_value, sizeof(char) * value_length); break; + case 10: + printf("DEBUG response: \n%s\n", resp->data); + value_object = json_object_object_get(config, "ColorBalanceMode"); + string_value = json_object_get_string(value_object); + printf("DEBUG value: %s\n", string_value); + char_value = (char*) value; + value_length = strlen(string_value) + 1; + memcpy(char_value, string_value, sizeof(char) * value_length); + break; default: break; } diff --git a/src/kds_s2000w_net.c b/src/kds_s2000w_net.c index 6e00bba..4500cf4 100644 --- a/src/kds_s2000w_net.c +++ b/src/kds_s2000w_net.c @@ -211,6 +211,17 @@ const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor( option_descriptor_array.option_descriptors[option]->constraint_type = SANE_CONSTRAINT_NONE; option_descriptor_array.option_descriptors[option]->constraint.string_list = NULL; break; + case 10: + 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 = "colorbalancemode"; + option_descriptor_array.option_descriptors[option]->title = "colorbalancemode"; + option_descriptor_array.option_descriptors[option]->desc = "colorbalancemode"; + 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; @@ -231,6 +242,7 @@ const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor( case 6: case 8: case 9: + case 10: 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;