kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'escl-check-scan-options' into 'master'
Check options scan and fix xml. See merge request sane-project/backends!528merge-requests/540/head
commit
6d7fbc8320
|
@ -797,16 +797,23 @@ init_options(SANE_String_Const name_source, escl_sane_t *s)
|
|||
s->thresold_range.min= s->scanner->threshold->min;
|
||||
s->thresold_range.max=s->scanner->threshold->max;
|
||||
s->opt[OPT_THRESHOLD].cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT;
|
||||
s->opt[OPT_BRIGHTNESS].cap |= SANE_CAP_INACTIVE;
|
||||
s->opt[OPT_CONTRAST].cap |= SANE_CAP_INACTIVE;
|
||||
s->scanner->use_threshold = 1;
|
||||
if (s->scanner->brightness)
|
||||
s->opt[OPT_BRIGHTNESS].cap |= SANE_CAP_INACTIVE;
|
||||
if (s->scanner->contrast)
|
||||
s->opt[OPT_CONTRAST].cap |= SANE_CAP_INACTIVE;
|
||||
if (s->scanner->sharpen)
|
||||
s->opt[OPT_SHARPEN].cap |= SANE_CAP_INACTIVE;
|
||||
s->opt[OPT_THRESHOLD].cap |= SANE_CAP_INACTIVE;
|
||||
s->opt[OPT_SHARPEN].cap |= SANE_CAP_INACTIVE;
|
||||
if (!strcasecmp(s->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART))
|
||||
s->opt[OPT_THRESHOLD].cap &= ~SANE_CAP_INACTIVE;
|
||||
else {
|
||||
s->opt[OPT_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE;
|
||||
s->opt[OPT_CONTRAST].cap &= ~SANE_CAP_INACTIVE;
|
||||
s->opt[OPT_SHARPEN].cap &= ~SANE_CAP_INACTIVE;
|
||||
if (s->scanner->brightness)
|
||||
s->opt[OPT_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE;
|
||||
if (s->scanner->contrast)
|
||||
s->opt[OPT_CONTRAST].cap &= ~SANE_CAP_INACTIVE;
|
||||
if (s->scanner->sharpen)
|
||||
s->opt[OPT_SHARPEN].cap &= ~SANE_CAP_INACTIVE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1025,17 +1032,6 @@ sane_control_option(SANE_Handle h, SANE_Int n, SANE_Action a, void *v, SANE_Int
|
|||
case OPT_SCAN_SOURCE:
|
||||
case OPT_MODE:
|
||||
strcpy (v, handler->val[n].s);
|
||||
handler->opt[OPT_BRIGHTNESS].cap |= SANE_CAP_INACTIVE;
|
||||
handler->opt[OPT_CONTRAST].cap |= SANE_CAP_INACTIVE;
|
||||
handler->opt[OPT_THRESHOLD].cap |= SANE_CAP_INACTIVE;
|
||||
handler->opt[OPT_SHARPEN].cap |= SANE_CAP_INACTIVE;
|
||||
if (!strcasecmp(handler->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_LINEART))
|
||||
handler->opt[OPT_THRESHOLD].cap &= ~SANE_CAP_INACTIVE;
|
||||
else {
|
||||
handler->opt[OPT_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE;
|
||||
handler->opt[OPT_CONTRAST].cap &= ~SANE_CAP_INACTIVE;
|
||||
handler->opt[OPT_SHARPEN].cap &= ~SANE_CAP_INACTIVE;
|
||||
}
|
||||
break;
|
||||
case OPT_MODE_GROUP:
|
||||
default:
|
||||
|
@ -1076,6 +1072,26 @@ sane_control_option(SANE_Handle h, SANE_Int n, SANE_Action a, void *v, SANE_Int
|
|||
}
|
||||
if (i)
|
||||
*i |= SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS | SANE_INFO_INEXACT;
|
||||
if (handler->scanner->brightness)
|
||||
handler->opt[OPT_BRIGHTNESS].cap |= SANE_CAP_INACTIVE;
|
||||
if (handler->scanner->contrast)
|
||||
handler->opt[OPT_CONTRAST].cap |= SANE_CAP_INACTIVE;
|
||||
if (handler->scanner->threshold)
|
||||
handler->opt[OPT_THRESHOLD].cap |= SANE_CAP_INACTIVE;
|
||||
if (handler->scanner->sharpen)
|
||||
handler->opt[OPT_SHARPEN].cap |= SANE_CAP_INACTIVE;
|
||||
if (!strcasecmp(handler->val[n].s, SANE_VALUE_SCAN_MODE_LINEART)) {
|
||||
if (handler->scanner->threshold)
|
||||
handler->opt[OPT_THRESHOLD].cap &= ~SANE_CAP_INACTIVE;
|
||||
}
|
||||
else {
|
||||
if (handler->scanner->brightness)
|
||||
handler->opt[OPT_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE;
|
||||
if (handler->scanner->contrast)
|
||||
handler->opt[OPT_CONTRAST].cap &= ~SANE_CAP_INACTIVE;
|
||||
if (handler->scanner->sharpen)
|
||||
handler->opt[OPT_SHARPEN].cap &= ~SANE_CAP_INACTIVE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -317,18 +317,26 @@ static int
|
|||
find_struct_variables(xmlNode *node, capabilities_t *scanner)
|
||||
{
|
||||
const char *name = (const char *)node->name;
|
||||
if (strcmp(name, "BrightnessSupport") == 0)
|
||||
if (strcmp(name, "BrightnessSupport") == 0) {
|
||||
scanner->brightness =
|
||||
print_support(node->children);
|
||||
else if (strcmp(name, "ContrastSupport") == 0)
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(name, "ContrastSupport") == 0) {
|
||||
scanner->contrast =
|
||||
print_support(node->children);
|
||||
else if (strcmp(name, "SharpenSupport") == 0)
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(name, "SharpenSupport") == 0) {
|
||||
scanner->sharpen =
|
||||
print_support(node->children);
|
||||
else if (strcmp(name, "ThresholdSupport") == 0)
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(name, "ThresholdSupport") == 0) {
|
||||
scanner->threshold =
|
||||
print_support(node->children);
|
||||
return 1;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -361,8 +369,6 @@ find_true_variables(xmlNode *node, capabilities_t *scanner, int type)
|
|||
strcmp(name, "RiskyBottomMargin") == 0 ||
|
||||
strcmp(name, "DocumentFormatExt") == 0)
|
||||
find_value_of_int_variables(node, scanner, type);
|
||||
else
|
||||
find_struct_variables(node, scanner);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -401,7 +407,7 @@ print_xml_c(xmlNode *node, capabilities_t *scanner, int type)
|
|||
print_xml_c(node->children, scanner, ADFDUPLEX);
|
||||
scanner->caps[ADFDUPLEX].duplex = 1;
|
||||
}
|
||||
else
|
||||
else if (find_struct_variables(node, scanner) == 0)
|
||||
print_xml_c(node->children, scanner, type);
|
||||
node = node->next;
|
||||
}
|
||||
|
|
|
@ -118,9 +118,9 @@ download_callback(void *str, size_t size, size_t nmemb, void *userp)
|
|||
static char*
|
||||
add_support_option(char *key, int val)
|
||||
{
|
||||
int size = (strlen(key) * 2) + 10;
|
||||
int size = (strlen(key) * 3) + 10;
|
||||
char *tmp = (char*)calloc(1, size);
|
||||
snprintf (tmp, size, "<%s>%d</%s>\n", key, val, key);
|
||||
snprintf (tmp, size, "<scan:%s>%d</scan:%s>\n", key, val, key);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue