Merge branch 'escl-set-option-if-necessary' into 'master'

Escl: set option if necessary

See merge request sane-project/backends!733
251-scanner-canon-mf110-910-series-is-not-supported
Ordissimo 2022-05-11 13:18:18 +00:00
commit 6b30245844
4 zmienionych plików z 45 dodań i 30 usunięć

Wyświetl plik

@ -1039,7 +1039,7 @@ init_options(SANE_String_Const name_source, escl_sane_t *s)
s->opt[OPT_BRIGHTNESS].constraint_type = SANE_CONSTRAINT_RANGE;
if (s->scanner->brightness) {
s->opt[OPT_BRIGHTNESS].constraint.range = &s->brightness_range;
s->val[OPT_BRIGHTNESS].w = s->scanner->brightness->normal;
s->val[OPT_BRIGHTNESS].w = s->scanner->brightness->value;
s->brightness_range.quant=1;
s->brightness_range.min=s->scanner->brightness->min;
s->brightness_range.max=s->scanner->brightness->max;
@ -1058,7 +1058,7 @@ init_options(SANE_String_Const name_source, escl_sane_t *s)
s->opt[OPT_CONTRAST].constraint_type = SANE_CONSTRAINT_RANGE;
if (s->scanner->contrast) {
s->opt[OPT_CONTRAST].constraint.range = &s->contrast_range;
s->val[OPT_CONTRAST].w = s->scanner->contrast->normal;
s->val[OPT_CONTRAST].w = s->scanner->contrast->value;
s->contrast_range.quant=1;
s->contrast_range.min=s->scanner->contrast->min;
s->contrast_range.max=s->scanner->contrast->max;
@ -1077,7 +1077,7 @@ init_options(SANE_String_Const name_source, escl_sane_t *s)
s->opt[OPT_SHARPEN].constraint_type = SANE_CONSTRAINT_RANGE;
if (s->scanner->sharpen) {
s->opt[OPT_SHARPEN].constraint.range = &s->sharpen_range;
s->val[OPT_SHARPEN].w = s->scanner->sharpen->normal;
s->val[OPT_SHARPEN].w = s->scanner->sharpen->value;
s->sharpen_range.quant=1;
s->sharpen_range.min=s->scanner->sharpen->min;
s->sharpen_range.max=s->scanner->sharpen->max;
@ -1097,7 +1097,7 @@ init_options(SANE_String_Const name_source, escl_sane_t *s)
s->opt[OPT_THRESHOLD].constraint_type = SANE_CONSTRAINT_RANGE;
if (s->scanner->threshold) {
s->opt[OPT_THRESHOLD].constraint.range = &s->thresold_range;
s->val[OPT_THRESHOLD].w = s->scanner->threshold->normal;
s->val[OPT_THRESHOLD].w = s->scanner->threshold->value;
s->thresold_range.quant=1;
s->thresold_range.min= s->scanner->threshold->min;
s->thresold_range.max=s->scanner->threshold->max;

Wyświetl plik

@ -148,6 +148,7 @@ typedef struct support
int min;
int max;
int normal;
int value;
int step;
} support_t;

Wyświetl plik

@ -325,7 +325,8 @@ print_support(xmlNode *node)
cpt++;
}
else if (!strcmp((const char *)node->name, "Normal")) {
sup->normal = atoi((const char *)xmlNodeGetContent(node));
sup->value = atoi((const char *)xmlNodeGetContent(node));
sup->normal = sup->value;
cpt++;
have_norm = 1;
}
@ -338,7 +339,8 @@ print_support(xmlNode *node)
if (cpt == 4)
return sup;
if (cpt == 3 && have_norm == 0) {
sup->normal = (sup->max / 2 );
sup->value = (sup->max / 2 );
sup->normal = sup->value;
return sup;
}
free(sup);

Wyświetl plik

@ -219,39 +219,51 @@ 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,
scanner->caps[scanner->source].height,