From 84357741a6a6e6430f199b2c3f7498e0e97da9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 12 Feb 2023 17:35:53 +0100 Subject: New upstream version 1.2.1 --- backend/escl/escl_newjob.c | 85 +++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 35 deletions(-) (limited to 'backend/escl/escl_newjob.c') diff --git a/backend/escl/escl_newjob.c b/backend/escl/escl_newjob.c index 98a953f..e1b326f 100644 --- a/backend/escl/escl_newjob.c +++ b/backend/escl/escl_newjob.c @@ -46,7 +46,7 @@ struct downloading static const char settings[] = "" \ "" \ - " 2.0" \ + " %.2f" \ " " \ " " \ " escl:ThreeHundredthsOfInches" \ @@ -56,13 +56,11 @@ static const char settings[] = " %d" \ " " \ " " \ - " %s" \ "%s" \ " %s" \ " %d" \ " %d" \ " %s" \ - " %s" \ "%s" \ "%s" \ ""; @@ -138,8 +136,8 @@ escl_newjob (capabilities_t *scanner, const ESCL_Device *device, SANE_Status *st char *location = NULL; char *result = NULL; char *temporary = NULL; - char *f_ext = ""; char *format_ext = NULL; + char f_ext_tmp[1024]; char duplex_mode[1024] = { 0 }; int wakup_count = 0; @@ -189,16 +187,22 @@ escl_newjob (capabilities_t *scanner, const ESCL_Device *device, SANE_Status *st scanner->caps[scanner->source].default_format = strdup(scanner->caps[scanner->source].DocumentFormats[have_pdf]); } - if (scanner->caps[scanner->source].format_ext == 1) + if (device->version <= 2.0) { - char f_ext_tmp[1024]; + // For eSCL 2.0 and older clients snprintf(f_ext_tmp, sizeof(f_ext_tmp), - " %s", + " %s", scanner->caps[scanner->source].default_format); - format_ext = f_ext_tmp; } else - format_ext = f_ext; + { + // For eSCL 2.1 and newer clients + snprintf(f_ext_tmp, sizeof(f_ext_tmp), + " %s", + scanner->caps[scanner->source].default_format); + } + format_ext = f_ext_tmp; + if(scanner->source > PLATEN && scanner->Sources[ADFDUPLEX]) { snprintf(duplex_mode, sizeof(duplex_mode), " %s", @@ -215,52 +219,63 @@ escl_newjob (capabilities_t *scanner, const ESCL_Device *device, SANE_Status *st char *source = (scanner->source == PLATEN ? "Platen" : "Feeder"); if (scanner->use_threshold) { - char *tmp = add_support_option("ThresholdSupport", scanner->val_threshold); - if (support_options[0]) - strcat(support_options, tmp); - else - strcpy(support_options, tmp); - free(tmp); + if (scanner->val_threshold != scanner->threshold->value) + { + char *tmp = add_support_option("ThresholdSupport", scanner->val_threshold); + if (support_options[0]) + strcat(support_options, tmp); + else + strcpy(support_options, tmp); + free(tmp); + } } if (scanner->use_sharpen) { - char *tmp = add_support_option("SharpenSupport", scanner->val_sharpen); - if (support_options[0]) - strcat(support_options, tmp); - else - strcpy(support_options, tmp); - free(tmp); + if (scanner->val_sharpen != scanner->sharpen->value) + { + char *tmp = add_support_option("SharpenSupport", scanner->val_sharpen); + if (support_options[0]) + strcat(support_options, tmp); + else + strcpy(support_options, tmp); + free(tmp); + } } if (scanner->use_contrast) { - char *tmp = add_support_option("ContrastSupport", scanner->val_contrast); - if (support_options[0]) - strcat(support_options, tmp); - else - strcpy(support_options, tmp); - free(tmp); + if (scanner->val_contrast != scanner->contrast->value) + { + char *tmp = add_support_option("ContrastSupport", scanner->val_contrast); + if (support_options[0]) + strcat(support_options, tmp); + else + strcpy(support_options, tmp); + free(tmp); + } } if (scanner->use_brightness) { - char *tmp = add_support_option("BrightnessSupport", scanner->val_brightness); - if (support_options[0]) - strcat(support_options, tmp); - else - strcpy(support_options, tmp); - free(tmp); + if (scanner->val_brightness != scanner->brightness->value) + { + char *tmp = add_support_option("BrightnessSupport", scanner->val_brightness); + if (support_options[0]) + strcat(support_options, tmp); + else + strcpy(support_options, tmp); + free(tmp); + } } snprintf(cap_data, sizeof(cap_data), settings, + device->version, scanner->caps[scanner->source].height, scanner->caps[scanner->source].width, off_x, off_y, - scanner->caps[scanner->source].default_format, format_ext, scanner->caps[scanner->source].default_color, scanner->caps[scanner->source].default_resolution, scanner->caps[scanner->source].default_resolution, source, - source, duplex_mode[0] == 0 ? " " : duplex_mode, support_options[0] == 0 ? " " : support_options); upload->memory = strdup(cap_data); -- cgit v1.2.3