kopia lustrzana https://gitlab.com/sane-project/backends
The job URL is adapted to the information provided by the value of the Location property.
rodzic
a78abbbdba
commit
667d8f7acc
|
@ -1222,9 +1222,11 @@ sane_cancel(SANE_Handle h)
|
|||
}
|
||||
handler->scanner->work = SANE_FALSE;
|
||||
handler->cancel = SANE_TRUE;
|
||||
escl_scanner(handler->device, handler->result);
|
||||
escl_scanner(handler->device, handler->scanner->scanJob, handler->result);
|
||||
free(handler->result);
|
||||
handler->result = NULL;
|
||||
free(handler->scanner->scanJob);
|
||||
handler->scanner->scanJob = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1592,7 +1594,7 @@ sane_start(SANE_Handle h)
|
|||
return SANE_STATUS_NO_DOCS;
|
||||
}
|
||||
}
|
||||
status = escl_scan(handler->scanner, handler->device, handler->result);
|
||||
status = escl_scan(handler->scanner, handler->device, handler->scanner->scanJob, handler->result);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return (status);
|
||||
if (!strcmp(handler->scanner->caps[handler->scanner->source].default_format, "image/jpeg"))
|
||||
|
|
|
@ -156,6 +156,7 @@ typedef struct capabilities
|
|||
SANE_String_Const *Sources;
|
||||
int SourcesSize;
|
||||
FILE *tmp;
|
||||
char *scanJob;
|
||||
unsigned char *img_data;
|
||||
long img_size;
|
||||
long img_read;
|
||||
|
@ -238,9 +239,11 @@ char *escl_newjob(capabilities_t *scanner,
|
|||
|
||||
SANE_Status escl_scan(capabilities_t *scanner,
|
||||
const ESCL_Device *device,
|
||||
char *scanJob,
|
||||
char *result);
|
||||
|
||||
void escl_scanner(const ESCL_Device *device,
|
||||
char *scanJob,
|
||||
char *result);
|
||||
|
||||
typedef void CURL;
|
||||
|
|
|
@ -296,7 +296,17 @@ wake_up_device:
|
|||
result = strdup(location);
|
||||
DBG( 1, "Create NewJob : %s\n", result);
|
||||
*temporary = '\n';
|
||||
*location = '\0';
|
||||
location = strrchr(tmp_location,'/');
|
||||
wakup_count = 0;
|
||||
if (location) {
|
||||
location++;
|
||||
scanner->scanJob = strdup(location);
|
||||
DBG( 1, "Full location header [%s]\n", scanner->scanJob);
|
||||
}
|
||||
else
|
||||
scanner->scanJob = strdup("ScanJobs");
|
||||
*location = '/';
|
||||
}
|
||||
}
|
||||
if (result == NULL) {
|
||||
|
|
|
@ -44,10 +44,10 @@ write_callback(void __sane_unused__*str,
|
|||
* This function is called in the 'sane_cancel' function.
|
||||
*/
|
||||
void
|
||||
escl_scanner(const ESCL_Device *device, char *result)
|
||||
escl_scanner(const ESCL_Device *device, char *scanJob, char *result)
|
||||
{
|
||||
CURL *curl_handle = NULL;
|
||||
const char *scan_jobs = "/eSCL/ScanJobs";
|
||||
const char *scan_jobs = "/eSCL/";
|
||||
const char *scanner_start = "/NextDocument";
|
||||
char scan_cmd[PATH_MAX] = { 0 };
|
||||
int i = 0;
|
||||
|
@ -58,8 +58,8 @@ escl_scanner(const ESCL_Device *device, char *result)
|
|||
CURL_CALL:
|
||||
curl_handle = curl_easy_init();
|
||||
if (curl_handle != NULL) {
|
||||
snprintf(scan_cmd, sizeof(scan_cmd), "%s%s%s",
|
||||
scan_jobs, result, scanner_start);
|
||||
snprintf(scan_cmd, sizeof(scan_cmd), "%s%s%s%s",
|
||||
scan_jobs, scanJob, result, scanner_start);
|
||||
escl_curl_url(curl_handle, device, scan_cmd);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback);
|
||||
if (curl_easy_perform(curl_handle) == CURLE_OK) {
|
||||
|
|
|
@ -57,10 +57,10 @@ write_callback(void *str, size_t size, size_t nmemb, void *userp)
|
|||
* \return status (if everything is OK, status = SANE_STATUS_GOOD, otherwise, SANE_STATUS_NO_MEM/SANE_STATUS_INVAL)
|
||||
*/
|
||||
SANE_Status
|
||||
escl_scan(capabilities_t *scanner, const ESCL_Device *device, char *result)
|
||||
escl_scan(capabilities_t *scanner, const ESCL_Device *device, char *scanJob, char *result)
|
||||
{
|
||||
CURL *curl_handle = NULL;
|
||||
const char *scan_jobs = "/eSCL/ScanJobs";
|
||||
const char *scan_jobs = "/eSCL/";
|
||||
const char *scanner_start = "/NextDocument";
|
||||
char scan_cmd[PATH_MAX] = { 0 };
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
|
@ -70,8 +70,8 @@ escl_scan(capabilities_t *scanner, const ESCL_Device *device, char *result)
|
|||
scanner->real_read = 0;
|
||||
curl_handle = curl_easy_init();
|
||||
if (curl_handle != NULL) {
|
||||
snprintf(scan_cmd, sizeof(scan_cmd), "%s%s%s",
|
||||
scan_jobs, result, scanner_start);
|
||||
snprintf(scan_cmd, sizeof(scan_cmd), "%s%s%s%s",
|
||||
scan_jobs, scanJob, result, scanner_start);
|
||||
escl_curl_url(curl_handle, device, scan_cmd);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback);
|
||||
if (scanner->tmp)
|
||||
|
|
Ładowanie…
Reference in New Issue