kopia lustrzana https://gitlab.com/sane-project/backends
If Adf, acquisition of the next page, if it exists.
rodzic
cf94e585f5
commit
54136b8deb
|
@ -617,6 +617,7 @@ sane_cancel(SANE_Handle h)
|
||||||
fclose(handler->scanner->tmp);
|
fclose(handler->scanner->tmp);
|
||||||
handler->scanner->tmp = NULL;
|
handler->scanner->tmp = NULL;
|
||||||
}
|
}
|
||||||
|
handler->scanner- = SANE_FALSE;
|
||||||
handler->cancel = SANE_TRUE;
|
handler->cancel = SANE_TRUE;
|
||||||
escl_scanner(handler->name, handler->result);
|
escl_scanner(handler->name, handler->result);
|
||||||
}
|
}
|
||||||
|
@ -760,6 +761,7 @@ sane_start(SANE_Handle h)
|
||||||
handler->write_scan_data = SANE_FALSE;
|
handler->write_scan_data = SANE_FALSE;
|
||||||
handler->decompress_scan_data = SANE_FALSE;
|
handler->decompress_scan_data = SANE_FALSE;
|
||||||
handler->end_read = SANE_FALSE;
|
handler->end_read = SANE_FALSE;
|
||||||
|
if (handler->scanner->work == SANE_FALSE) {
|
||||||
if(handler->scanner->caps[handler->scanner->source].default_color)
|
if(handler->scanner->caps[handler->scanner->source].default_color)
|
||||||
free(handler->scanner->caps[handler->scanner->source].default_color);
|
free(handler->scanner->caps[handler->scanner->source].default_color);
|
||||||
if (handler->val[OPT_PREVIEW].w == SANE_TRUE)
|
if (handler->val[OPT_PREVIEW].w == SANE_TRUE)
|
||||||
|
@ -816,6 +818,7 @@ sane_start(SANE_Handle h)
|
||||||
handler->result = escl_newjob(handler->scanner, handler->name, &status);
|
handler->result = escl_newjob(handler->scanner, handler->name, &status);
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
return (status);
|
return (status);
|
||||||
|
}
|
||||||
status = escl_scan(handler->scanner, handler->name, handler->result);
|
status = escl_scan(handler->scanner, handler->name, handler->result);
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
return (status);
|
return (status);
|
||||||
|
@ -841,8 +844,6 @@ sane_start(SANE_Handle h)
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG(10, "2-Size Image [%dx%d|%dx%d]\n", 0, 0, w, he);
|
DBG(10, "2-Size Image [%dx%d|%dx%d]\n", 0, 0, w, he);
|
||||||
if (handler->scanner->source > 0)
|
|
||||||
escl_scanner(handler->name, handler->result);
|
|
||||||
|
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
return (status);
|
return (status);
|
||||||
|
@ -850,7 +851,15 @@ sane_start(SANE_Handle h)
|
||||||
handler->ps.pixels_per_line = w;
|
handler->ps.pixels_per_line = w;
|
||||||
handler->ps.lines = he;
|
handler->ps.lines = he;
|
||||||
handler->ps.bytes_per_line = w * bps;
|
handler->ps.bytes_per_line = w * bps;
|
||||||
handler->ps.last_frame = SANE_TRUE;
|
if (handler->scanner->source != PLATEN) {
|
||||||
|
SANE_Bool next_page = (SANE_STATUS_GOOD == escl_status(handler->name) ? SANE_TRUE : SANE_FALSE);
|
||||||
|
handler->scanner->work == next_page;
|
||||||
|
handler->ps.last_frame = next_page;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
handler->scanner->work == SANE_FALSE;
|
||||||
|
handler->ps.last_frame = SANE_FALSE;
|
||||||
|
}
|
||||||
handler->ps.format = SANE_FRAME_RGB;
|
handler->ps.format = SANE_FRAME_RGB;
|
||||||
DBG(10, "Real Size Image [%dx%d|%dx%d]\n", 0, 0, w, he);
|
DBG(10, "Real Size Image [%dx%d|%dx%d]\n", 0, 0, w, he);
|
||||||
return (status);
|
return (status);
|
||||||
|
@ -875,7 +884,7 @@ sane_get_parameters(SANE_Handle h, SANE_Parameters *p)
|
||||||
return (status);
|
return (status);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
p->depth = 8;
|
p->depth = 8;
|
||||||
p->last_frame = SANE_TRUE;
|
p->last_frame = handler->ps.last_frame;
|
||||||
p->format = SANE_FRAME_RGB;
|
p->format = SANE_FRAME_RGB;
|
||||||
p->pixels_per_line = handler->ps.pixels_per_line;
|
p->pixels_per_line = handler->ps.pixels_per_line;
|
||||||
p->lines = handler->ps.lines;
|
p->lines = handler->ps.lines;
|
||||||
|
|
|
@ -137,6 +137,7 @@ typedef struct capabilities
|
||||||
unsigned char *img_data;
|
unsigned char *img_data;
|
||||||
long img_size;
|
long img_size;
|
||||||
long img_read;
|
long img_read;
|
||||||
|
SANE_Bool work;
|
||||||
} capabilities_t;
|
} capabilities_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -94,19 +94,50 @@ static void
|
||||||
print_xml_s(xmlNode *node, SANE_Status *status)
|
print_xml_s(xmlNode *node, SANE_Status *status)
|
||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
SANE_Status platen_status;
|
||||||
|
SANE_Status adf_status;
|
||||||
|
|
||||||
while (node) {
|
while (node) {
|
||||||
if (node->type == XML_ELEMENT_NODE) {
|
if (node->type == XML_ELEMENT_NODE) {
|
||||||
if (find_nodes_s(node)) {
|
if (find_nodes_s(node)) {
|
||||||
if (strcmp((const char *)node->name, "State") == 0)
|
if (strcmp((const char *)node->name, "State") == 0) {
|
||||||
x = 1;
|
if (!strcmp(state, "Idle")) {
|
||||||
|
platen_status = SANE_STATUS_GOOD;
|
||||||
|
} else if (!strcmp(state, "Processing")) {
|
||||||
|
platen_status = SANE_STATUS_DEVICE_BUSY;
|
||||||
|
} else {
|
||||||
|
platen_status = SANE_STATUS_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (strcmp((const char *)node->name, "AdfState") == 0) {
|
||||||
|
if (!strcmp(state, "ScannerAdfLoaded")) {
|
||||||
|
adf_status = SANE_STATUS_GOOD;
|
||||||
|
} else if (!strcmp(state, "ScannerAdfJam")) {
|
||||||
|
adf_status = SANE_STATUS_JAMMED;
|
||||||
|
} else if (!strcmp(state, "ScannerAdfDoorOpen")) {
|
||||||
|
adf_status = SANE_STATUS_COVER_OPEN;
|
||||||
|
} else if (!strcmp(state, "ScannerAdfProcessing")) {
|
||||||
|
adf_status = SANE_STATUS_NO_DOCS;
|
||||||
|
} else if (!strcmp(state, "ScannerAdfEmpty")) {
|
||||||
|
adf_status = SANE_STATUS_NO_DOCS;
|
||||||
|
} else {
|
||||||
|
adf_status = SANE_STATUS_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (x == 1 && strcmp((const char *)xmlNodeGetContent(node), "Idle") == 0)
|
|
||||||
*status = SANE_STATUS_GOOD;
|
|
||||||
}
|
}
|
||||||
print_xml_s(node->children, status);
|
print_xml_s(node->children, status);
|
||||||
node = node->next;
|
node = node->next;
|
||||||
}
|
}
|
||||||
|
/* Decode Job status */
|
||||||
|
if (platen_status != SANE_STATUS_GOOD &&
|
||||||
|
platen_status != SANE_STATUS_UNSUPPORTED) {
|
||||||
|
*status = platen_status;
|
||||||
|
} else if (dev->opt.src == OPT_SOURCE_PLATEN) {
|
||||||
|
*status = platen_status;
|
||||||
|
} else {
|
||||||
|
*status = adf_status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Ładowanie…
Reference in New Issue