]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add reset blank pages
authorBastian Dehn <hhaalo@arcor.de>
Tue, 30 Jan 2024 18:21:12 +0000 (19:21 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 30 Jan 2024 18:47:12 +0000 (19:47 +0100)
src/kds_s2000w_handler.c

index 7e6f7974d6955ae0ff9265a9be8b534eb33bcccf..1534cc215a8541dee1b7566b41f08e4e44a7701e 100644 (file)
@@ -91,6 +91,26 @@ int _color_change_to_color_bw()
        return 0;
 }
 
+int _change_skip_blank_pages_off()
+{
+       json_object* value_object = json_object_object_get(config, "OutputType");
+       const char* output_type = json_object_get_string(value_object);
+       value_object = NULL;
+       value_object = json_object_object_get(config, "ScanSide");
+       const char* scan_side = json_object_get_string(value_object);
+       value_object = NULL;
+
+       if (strcmp(scan_side, "Duplex") == 0
+               && strcmp(output_type, "SinglePageColorPDFPlus2TIFs") == 0) {
+               value_object = json_object_object_get(config, "SkipBlankPages");
+               json_object_set_int(value_object, 0);
+               value_object = NULL;
+               return 1;
+       }
+
+       return 0;
+}
+
 current_state* kds_s2000w_handler_open()
 {
        state = malloc(sizeof(current_state));
@@ -277,11 +297,17 @@ void kds_s2000w_handler_set_option(int option, void* value, int* info)
                case 3:
                        value_object = json_object_object_get(config, "ScanSide");
                        _write_string_value_to_json(value_object, value);
+                       value_object = NULL;
+
+                       // BUG: change blank page off response 405 invalid settings
+                       if (_change_skip_blank_pages_off())
+                               *info = RELOAD_OPTIONS;
+
                        break;
                case 4:
                        value_object = json_object_object_get(config, "ColorMode");
                        _write_string_value_to_json(value_object, value);
-                       const char* current_value = (const char*) value;
+                       value_object = NULL;
 
                        if (_change_output_type_to_images())
                                *info = RELOAD_OPTIONS;
@@ -290,6 +316,11 @@ void kds_s2000w_handler_set_option(int option, void* value, int* info)
                case 5:
                        value_object = json_object_object_get(config, "SkipBlankPages");
                        _write_int_value_to_json(value_object, value);
+                       value_object = NULL;
+
+                       if (_change_skip_blank_pages_off())
+                               *info = RELOAD_OPTIONS;
+
                        break;
                case 6:
                        value_object = json_object_object_get(config, "AutoStart");
@@ -308,9 +339,10 @@ void kds_s2000w_handler_set_option(int option, void* value, int* info)
                        _write_string_value_to_json(value_object, value);
                        value_object = NULL;
 
-                       value_object = json_object_object_get(config, "ColorMode");
-                       const char* color_mode = json_object_get_string(value_object);
-                       if (_color_change_to_color_bw(color_mode))
+                       if (_color_change_to_color_bw())
+                               *info = RELOAD_OPTIONS;
+
+                       if (_change_skip_blank_pages_off())
                                *info = RELOAD_OPTIONS;
 
                        break;