kopia lustrzana https://gitlab.com/sane-project/backends
Porównaj commity
14 Commity
7443c05f2f
...
9c7fa2acff
Autor | SHA1 | Data |
---|---|---|
ThierryFR | 9c7fa2acff | |
Ralph Little | 0f472aa205 | |
ThierryFR | 728ca40272 | |
ThierryFR | 113be50f6b | |
Guillaume Girol | a6d63a72ec | |
Ordissimo | 7bc9c57e8c | |
Ordissimo | 9b43402b13 | |
thierry1970 | 14b5bce021 | |
thierry1970 | 0a9f8d55e9 | |
thierry1970 | e07c3ea3d6 | |
thierry1970 | 0f347bbd15 | |
Ordissimo | 59b9916064 | |
thierry1970 | b4a4f7bb59 | |
thierry1970 | 4d828f8e9b |
|
@ -6,7 +6,8 @@
|
|||
# Your editor may need a plugin for this configuration to take effect.
|
||||
# See http://editorconfig.org/#download for details.
|
||||
|
||||
root = true ; look no further
|
||||
; look no further
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
|
|
|
@ -1345,7 +1345,7 @@ sane_cancel(SANE_Handle h)
|
|||
}
|
||||
handler->scanner->work = SANE_FALSE;
|
||||
handler->cancel = SANE_TRUE;
|
||||
escl_scanner(handler->device, handler->scanner->scanJob, handler->result);
|
||||
escl_scanner(handler->device, handler->scanner->scanJob, handler->result, SANE_TRUE);
|
||||
free(handler->result);
|
||||
handler->result = NULL;
|
||||
free(handler->scanner->scanJob);
|
||||
|
@ -1566,6 +1566,7 @@ sane_start(SANE_Handle h)
|
|||
handler->decompress_scan_data = SANE_FALSE;
|
||||
handler->end_read = SANE_FALSE;
|
||||
if (handler->scanner->work == SANE_FALSE) {
|
||||
escl_reset_all_jobs(handler->device);
|
||||
SANE_Status st = escl_status(handler->device,
|
||||
handler->scanner->source,
|
||||
NULL,
|
||||
|
|
|
@ -248,7 +248,11 @@ SANE_Status escl_scan(capabilities_t *scanner,
|
|||
|
||||
void escl_scanner(const ESCL_Device *device,
|
||||
char *scanJob,
|
||||
char *result);
|
||||
char *result,
|
||||
SANE_Bool status);
|
||||
|
||||
SANE_Status escl_reset_all_jobs(ESCL_Device *device);
|
||||
|
||||
|
||||
typedef void CURL;
|
||||
|
||||
|
|
|
@ -44,7 +44,32 @@ write_callback(void __sane_unused__*str,
|
|||
* This function is called in the 'sane_cancel' function.
|
||||
*/
|
||||
void
|
||||
escl_scanner(const ESCL_Device *device, char *scanJob, char *result)
|
||||
escl_delete(const ESCL_Device *device, char *uri)
|
||||
{
|
||||
CURL *curl_handle = NULL;
|
||||
long answer = 0;
|
||||
|
||||
if (uri == NULL)
|
||||
return;
|
||||
curl_handle = curl_easy_init();
|
||||
if (curl_handle != NULL) {
|
||||
escl_curl_url(curl_handle, device, uri);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_CUSTOMREQUEST, "DELETE");
|
||||
if (curl_easy_perform(curl_handle) == CURLE_OK) {
|
||||
curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &answer);
|
||||
return;
|
||||
}
|
||||
curl_easy_cleanup(curl_handle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn void escl_scanner(const ESCL_Device *device, char *result)
|
||||
* \brief Function that resets the scanner after each scan, using curl.
|
||||
* This function is called in the 'sane_cancel' function.
|
||||
*/
|
||||
void
|
||||
escl_scanner(const ESCL_Device *device, char *scanJob, char *result, SANE_Bool status)
|
||||
{
|
||||
CURL *curl_handle = NULL;
|
||||
const char *scan_jobs = "/eSCL/";
|
||||
|
@ -70,10 +95,15 @@ CURL_CALL:
|
|||
if (i >= 15) return;
|
||||
}
|
||||
curl_easy_cleanup(curl_handle);
|
||||
if (SANE_STATUS_GOOD != escl_status(device,
|
||||
PLATEN,
|
||||
NULL,
|
||||
NULL))
|
||||
goto CURL_CALL;
|
||||
char* end = strrchr(scan_cmd, '/');
|
||||
*end = 0;
|
||||
escl_delete(device, scan_cmd);
|
||||
if (status) {
|
||||
if (SANE_STATUS_GOOD != escl_status(device,
|
||||
PLATEN,
|
||||
NULL,
|
||||
NULL))
|
||||
goto CURL_CALL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <libxml/parser.h>
|
||||
|
||||
|
@ -270,3 +271,135 @@ clean_data:
|
|||
}
|
||||
return (status);
|
||||
}
|
||||
|
||||
static void
|
||||
print_xml_job_finish(xmlNode *node,
|
||||
SANE_Status *job)
|
||||
{
|
||||
while (node) {
|
||||
if (node->type == XML_ELEMENT_NODE) {
|
||||
if (find_nodes_s(node)) {
|
||||
if (strcmp((const char *)node->name, "JobState") == 0) {
|
||||
const char *state = (const char *)xmlNodeGetContent(node);
|
||||
if (!strcmp(state, "Canceled")) {
|
||||
*job = SANE_STATUS_GOOD;
|
||||
DBG(10, "jobId Completed SANE_STATUS_GOOD\n");
|
||||
}
|
||||
else if (!strcmp(state, "Aborted")) {
|
||||
*job = SANE_STATUS_GOOD;
|
||||
DBG(10, "jobId Completed SANE_STATUS_GOOD\n");
|
||||
}
|
||||
else if (!strcmp(state, "Completed")) {
|
||||
*job = SANE_STATUS_GOOD;
|
||||
DBG(10, "jobId Completed SANE_STATUS_GOOD\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print_xml_job_finish(node->children, job);
|
||||
node = node->next;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_xml_reset_all_jobs (xmlNode *node,
|
||||
ESCL_Device *device)
|
||||
{
|
||||
DBG(10, "print_xml_reset_all_jobs\n");
|
||||
SANE_Status status = SANE_STATUS_DEVICE_BUSY;
|
||||
while (node) {
|
||||
if (node->type == XML_ELEMENT_NODE) {
|
||||
if (find_nodes_s(node)) {
|
||||
if (strcmp((const char *)node->name, "JobUri") == 0) {
|
||||
DBG(10, "print_xml_reset_all_jobs: %s\n", node->name);
|
||||
if (device != NULL) {
|
||||
print_xml_job_finish (node, &status);
|
||||
if (status == SANE_STATUS_DEVICE_BUSY) {
|
||||
char *jobUri = (char *)xmlNodeGetContent(node);
|
||||
char *job = strrchr((const char *)jobUri, '/');
|
||||
char *scanj = NULL;
|
||||
if (job != NULL) {
|
||||
if (strstr(jobUri,"ScanJobs"))
|
||||
scanj = strdup("ScanJobs");
|
||||
else
|
||||
scanj = strdup("ScanJob");
|
||||
DBG(10, "print_xml_reset_all_jobs: %s/%s\n", scanj, job);
|
||||
escl_scanner(device, scanj, job, SANE_FALSE);
|
||||
free(scanj);
|
||||
}
|
||||
DBG(10, "print_xml_reset_all_jobs: sleep to finish the job\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print_xml_reset_all_jobs (node->children,
|
||||
device);
|
||||
node = node->next;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn SANE_Status escl_reset_all_jobs (ESCL_Device *device, , char *scanJob)
|
||||
* \brief Function that forces the end of jobs, using curl.
|
||||
* This function is called in the 'sane_start' function.
|
||||
*
|
||||
* \return status (if everything is OK, status = SANE_STATUS_GOOD, otherwise, SANE_STATUS_NO_MEM/SANE_STATUS_INVAL)
|
||||
*/
|
||||
SANE_Status
|
||||
escl_reset_all_jobs(ESCL_Device *device)
|
||||
{
|
||||
CURL *curl_handle = NULL;
|
||||
xmlDoc *data = NULL;
|
||||
xmlNode *node = NULL;
|
||||
struct idle *var = NULL;
|
||||
const char *scanner_status = "/eSCL/ScannerStatus";
|
||||
SANE_Status status = SANE_STATUS_DEVICE_BUSY;
|
||||
|
||||
DBG(10, "escl_reset_all_jobs\n");
|
||||
if (device == NULL)
|
||||
return (SANE_STATUS_NO_MEM);
|
||||
DBG(10, "1 - escl_reset_all_jobs\n");
|
||||
var = (struct idle*)calloc(1, sizeof(struct idle));
|
||||
if (var == NULL)
|
||||
return (SANE_STATUS_NO_MEM);
|
||||
DBG(10, "2 - escl_reset_all_jobs\n");
|
||||
var->memory = malloc(1);
|
||||
var->size = 0;
|
||||
curl_handle = curl_easy_init();
|
||||
|
||||
escl_curl_url(curl_handle, device, scanner_status);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, memory_callback_s);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)var);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
|
||||
CURLcode res = curl_easy_perform(curl_handle);
|
||||
if (res != CURLE_OK) {
|
||||
DBG( 1, "The scanner didn't respond: %s\n", curl_easy_strerror(res));
|
||||
status = SANE_STATUS_INVAL;
|
||||
goto clean_data1;
|
||||
}
|
||||
DBG(10, "3 - escl_reset_all_jobs\n");
|
||||
DBG( 10, "eSCL : Status : %s.\n", var->memory);
|
||||
data = xmlReadMemory(var->memory, var->size, "file.xml", NULL, 0);
|
||||
if (data == NULL) {
|
||||
status = SANE_STATUS_NO_MEM;
|
||||
goto clean_data1;
|
||||
}
|
||||
node = xmlDocGetRootElement(data);
|
||||
if (node == NULL) {
|
||||
status = SANE_STATUS_NO_MEM;
|
||||
goto clean1;
|
||||
}
|
||||
print_xml_reset_all_jobs (node, device);
|
||||
status = SANE_STATUS_GOOD;
|
||||
clean1:
|
||||
xmlFreeDoc(data);
|
||||
clean_data1:
|
||||
xmlCleanupParser();
|
||||
xmlMemoryDump();
|
||||
curl_easy_cleanup(curl_handle);
|
||||
free(var->memory);
|
||||
free(var);
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -30,3 +30,13 @@
|
|||
#
|
||||
# Example using for a scanner using mfnp including the optional timeout:
|
||||
# mfnp://scanner.bad-network.org/timeout=1500
|
||||
|
||||
|
||||
# TYPE : MP150 OR ICLASS
|
||||
#
|
||||
# device MP150 NAME MODEL PID DPI CAPACITE
|
||||
# device MP150 "Canon PIXMA TS2600 Series" "TS2600" 0x1107 600 PIXMA_CAP_CIS
|
||||
#
|
||||
#
|
||||
# device ICLASS NAME MODEL PID DPI ADF_DPI WIDTH HEIGHT CAPACITE
|
||||
# device ICLASS "Canon i-SENSYS MF630 Series" "MF630" 0x27e1 600 0 637 1050 PIXMA_CAP_ADFDUP
|
||||
|
|
|
@ -152,6 +152,9 @@ static pixma_sane_t *first_scanner = NULL;
|
|||
static const SANE_Device **dev_list = NULL;
|
||||
static const char* conf_devices[MAX_CONF_DEVICES];
|
||||
|
||||
void pixma_add_custom_mp150_device (const char *, const char *, const char *, const char *, const char *);
|
||||
void pixma_add_custom_iclass_device (const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *);
|
||||
|
||||
static void mark_all_button_options_cached ( struct pixma_sane_t * ss )
|
||||
{
|
||||
int i;
|
||||
|
@ -159,19 +162,144 @@ static void mark_all_button_options_cached ( struct pixma_sane_t * ss )
|
|||
ss -> button_option_is_cached[i] = 1;
|
||||
}
|
||||
|
||||
static SANE_Status config_attach_pixma_generic (const char *line)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < (MAX_CONF_DEVICES -1); i++) {
|
||||
if (conf_devices[i] == NULL) {
|
||||
conf_devices[i] = strdup(line);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
}
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
static SANE_Status config_attach_pixma(SANEI_Config __sane_unused__ * config,
|
||||
const char *devname,
|
||||
const char *line,
|
||||
void __sane_unused__ *data)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < (MAX_CONF_DEVICES -1); i++)
|
||||
{
|
||||
if(conf_devices[i] == NULL)
|
||||
{
|
||||
conf_devices[i] = strdup(devname);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
if (*line == '#') return SANE_STATUS_GOOD;
|
||||
if (strncmp(line, "device", 6) == 0) {
|
||||
char *type_str = NULL;
|
||||
|
||||
line = sanei_config_get_string(line + 6, &type_str);
|
||||
if (!type_str || !*type_str) {
|
||||
PDBG (pixma_dbg (3, "Canon Type device missing.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Canon Type device is [%s].\n", type_str));
|
||||
if (strcmp(type_str, "MP150") == 0) {
|
||||
char *name_str = NULL;
|
||||
char *model_str = NULL;
|
||||
char *pid_str = NULL;
|
||||
char *dpi_str = NULL;
|
||||
char *capacity_str = NULL;
|
||||
// # DEVICE NAME MODEL PID DPI CAPACITE
|
||||
PDBG (pixma_dbg (3, "New define pixma description (%s)\n", line));
|
||||
line = sanei_config_get_string(line , &name_str);
|
||||
if (!name_str || !*name_str) {
|
||||
PDBG (pixma_dbg (3, "Pixma name missing.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Pixma name is [%s].\n", name_str));
|
||||
line = sanei_config_get_string(line, &model_str);
|
||||
if (!model_str || !*model_str) {
|
||||
PDBG (pixma_dbg (3, "Pixma model missing.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Pixma model is [%s].\n", model_str));
|
||||
line = sanei_config_get_string(line, &pid_str);
|
||||
if (!pid_str || !*pid_str) {
|
||||
PDBG (pixma_dbg (3, "Pixma usbid missig.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Pixma pid is [%s].\n", pid_str));
|
||||
line = sanei_config_get_string(line, &dpi_str);
|
||||
if (!dpi_str || !*dpi_str) {
|
||||
PDBG (pixma_dbg (3, "Pixma dpi missig.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Pixma dpi is [%s].\n", dpi_str));
|
||||
line = sanei_config_get_string(line, &capacity_str);
|
||||
if (!capacity_str || !*capacity_str) {
|
||||
PDBG (pixma_dbg (3, "Pixma capacity missig.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Pixma capacity is [%s].\n", capacity_str));
|
||||
pixma_add_custom_mp150_device (name_str, model_str, pid_str, dpi_str, capacity_str);
|
||||
return SANE_STATUS_GOOD;
|
||||
|
||||
}
|
||||
else if (strcmp(type_str, "ICLASS") == 0) {
|
||||
char *name_str = NULL;
|
||||
char *model_str = NULL;
|
||||
char *pid_str = NULL;
|
||||
char *dpi_str = NULL;
|
||||
char *adpi_str = NULL;
|
||||
char *w_str = NULL;
|
||||
char *h_str = NULL;
|
||||
char *capacity_str = NULL;
|
||||
// # DEVICE NAME MODEL PID DPI ADF_DPI WIDTH HEIGHT CAPACITE
|
||||
PDBG (pixma_dbg (3, "New define iclass description (%s)\n", line));
|
||||
line = sanei_config_get_string(line , &name_str);
|
||||
if (!name_str || !*name_str) {
|
||||
PDBG (pixma_dbg (3, "Iclass name missing.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Iclass name is [%s].\n", name_str));
|
||||
line = sanei_config_get_string(line, &model_str);
|
||||
if (!model_str || !*model_str) {
|
||||
PDBG (pixma_dbg (3, "Iclass model missig.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Iclass model is [%s].\n", model_str));
|
||||
line = sanei_config_get_string(line, &pid_str);
|
||||
if (!pid_str || !*pid_str) {
|
||||
PDBG (pixma_dbg (3, "Iclass pid missig.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Iclass pid is [%s].\n", pid_str));
|
||||
line = sanei_config_get_string(line, &dpi_str);
|
||||
if (!dpi_str || !*dpi_str) {
|
||||
PDBG (pixma_dbg (3, "Pixma dpi missig.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Pixma dpi is [%s].\n", dpi_str));;
|
||||
line = sanei_config_get_string(line, &adpi_str);
|
||||
if (!adpi_str || !*adpi_str) {
|
||||
PDBG (pixma_dbg (3, "Pixma adf-dpi missig.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Pixma adf-dpi is [%s].\n", adpi_str));
|
||||
line = sanei_config_get_string(line, &w_str);
|
||||
if (!w_str || !*w_str) {
|
||||
PDBG (pixma_dbg (3, "Pixma width missig.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Pixma width is [%s].\n", w_str));
|
||||
line = sanei_config_get_string(line, &h_str);
|
||||
if (!h_str || !*h_str) {
|
||||
PDBG (pixma_dbg (3, "Pixma height missig.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Pixma height is [%s].\n", h_str));
|
||||
line = sanei_config_get_string(line, &capacity_str);
|
||||
if (!capacity_str || !*capacity_str) {
|
||||
PDBG (pixma_dbg (3, "Pixma capacity missig.\n"));
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
PDBG (pixma_dbg (3, "Pixma capacity is [%s].\n", capacity_str));
|
||||
pixma_add_custom_iclass_device (name_str, model_str, pid_str, dpi_str, adpi_str, w_str, h_str, capacity_str);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
else {
|
||||
return config_attach_pixma_generic (line);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
return config_attach_pixma_generic (line);
|
||||
}
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -378,6 +378,9 @@ struct pixma_scan_param_t
|
|||
unsigned frontend_cancel;
|
||||
};
|
||||
|
||||
extern const char *ccaps[18];
|
||||
extern const unsigned ucaps[18];
|
||||
|
||||
/** PIXMA model information */
|
||||
struct pixma_config_t
|
||||
{
|
||||
|
|
|
@ -74,6 +74,10 @@ extern const pixma_config_t pixma_mp750_devices[];
|
|||
extern const pixma_config_t pixma_mp730_devices[];
|
||||
extern const pixma_config_t pixma_mp800_devices[];
|
||||
extern const pixma_config_t pixma_iclass_devices[];
|
||||
extern pixma_config_t *pixma_custom_mp150_devices;
|
||||
extern int pixma_custom_mp150_devices_count;
|
||||
extern pixma_config_t *pixma_custom_iclass_devices;
|
||||
extern int pixma_custom_iclass_devices_count;
|
||||
|
||||
static const pixma_config_t *const pixma_devices[] = {
|
||||
pixma_mp150_devices,
|
||||
|
@ -1223,6 +1227,26 @@ pixma_fill_gamma_table (double gamma, uint8_t * table, unsigned n)
|
|||
int
|
||||
pixma_find_scanners (const char **conf_devices, SANE_Bool local_only)
|
||||
{
|
||||
if (pixma_custom_mp150_devices_count > 0 || pixma_custom_iclass_devices_count > 0) {
|
||||
int i = 0;
|
||||
const pixma_config_t **pixma_devices_all = (const pixma_config_t **)calloc(8, sizeof(pixma_config_t *));
|
||||
for (i = 0; i < 6; i++)
|
||||
pixma_devices_all[i] = pixma_devices[i];
|
||||
i = 5;
|
||||
if (pixma_custom_mp150_devices_count > 0) {
|
||||
pixma_devices_all[i] = pixma_custom_mp150_devices;
|
||||
i++;
|
||||
pixma_devices_all[i] = NULL;
|
||||
PDBG (pixma_dbg (3, "Add custom devices mp150 in pixma_devices\n"));
|
||||
}
|
||||
if (pixma_custom_mp150_devices_count > 0) {
|
||||
pixma_devices_all[i] = pixma_custom_iclass_devices;
|
||||
i++;
|
||||
pixma_devices_all[i] = NULL;
|
||||
PDBG (pixma_dbg (3, "Add custom devices iclass in pixma_devices\n"));
|
||||
}
|
||||
return pixma_collect_devices (conf_devices, pixma_devices_all, local_only);
|
||||
};
|
||||
return pixma_collect_devices (conf_devices, pixma_devices, local_only);
|
||||
}
|
||||
|
||||
|
@ -1352,4 +1376,44 @@ clean:
|
|||
xmlFreeDoc(doc);
|
||||
return status;
|
||||
}
|
||||
|
||||
const char *ccaps [18] = {"PIXMA_CAP_EASY_RGB",
|
||||
"PIXMA_CAP_GRAY",
|
||||
"PIXMA_CAP_ADF",
|
||||
"PIXMA_CAP_48BIT",
|
||||
"PIXMA_CAP_GAMMA_TABLE",
|
||||
"PIXMA_CAP_EVENTS",
|
||||
"PIXMA_CAP_TPU",
|
||||
"PIXMA_CAP_ADFDUP",
|
||||
"PIXMA_CAP_CIS",
|
||||
"PIXMA_CAP_CCD",
|
||||
"PIXMA_CAP_LINEART",
|
||||
"PIXMA_CAP_NEGATIVE",
|
||||
"PIXMA_CAP_TPUIR",
|
||||
"PIXMA_CAP_ADF_WAIT",
|
||||
"PIXMA_CAP_ADF_JPEG",
|
||||
"PIXMA_CAP_JPEG",
|
||||
"PIXMA_CAP_GT_4096",
|
||||
NULL
|
||||
};
|
||||
|
||||
const unsigned ucaps [18] = {PIXMA_CAP_EASY_RGB,
|
||||
PIXMA_CAP_GRAY,
|
||||
PIXMA_CAP_ADF,
|
||||
PIXMA_CAP_48BIT,
|
||||
PIXMA_CAP_GAMMA_TABLE,
|
||||
PIXMA_CAP_EVENTS,
|
||||
PIXMA_CAP_TPU,
|
||||
PIXMA_CAP_ADFDUP,
|
||||
PIXMA_CAP_CIS,
|
||||
PIXMA_CAP_CCD,
|
||||
PIXMA_CAP_LINEART,
|
||||
PIXMA_CAP_NEGATIVE,
|
||||
PIXMA_CAP_TPUIR,
|
||||
PIXMA_CAP_ADF_WAIT,
|
||||
PIXMA_CAP_ADF_JPEG,
|
||||
PIXMA_CAP_JPEG,
|
||||
PIXMA_CAP_GT_4096,
|
||||
0
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -163,6 +163,8 @@ typedef struct iclass_t
|
|||
uint8_t adf_state; /* handle adf scanning */
|
||||
} iclass_t;
|
||||
|
||||
pixma_config_t *pixma_custom_iclass_devices = NULL;
|
||||
int pixma_custom_iclass_devices_count = 0;
|
||||
|
||||
static int is_scanning_from_adf (pixma_t * s)
|
||||
{
|
||||
|
@ -996,3 +998,46 @@ const pixma_config_t pixma_iclass_devices[] = {
|
|||
DEV ("Canon i-SENSYS MF440 Series", "MF440", MF440_PID, 600, 300, 637, 877, PIXMA_CAP_ADFDUP),
|
||||
DEV (NULL, NULL, 0, 0, 0, 0, 0, 0)
|
||||
};
|
||||
|
||||
void
|
||||
pixma_add_custom_iclass_device (const char *name,
|
||||
const char *model,
|
||||
const char *pid,
|
||||
const char *dpi,
|
||||
const char *adf_dpi,
|
||||
const char *w,
|
||||
const char *h,
|
||||
const char *capacity)
|
||||
{
|
||||
int ddpi = 0;
|
||||
int dadpi = 0;
|
||||
int dw = 0;
|
||||
int dh = 0;
|
||||
uint16_t ppid = 0;
|
||||
unsigned caps = 0;
|
||||
int lcaps = 0;
|
||||
|
||||
if (pixma_custom_iclass_devices_count == 0) {
|
||||
pixma_custom_iclass_devices = (pixma_config_t *)calloc (2, sizeof(pixma_config_t));
|
||||
} else {
|
||||
pixma_custom_iclass_devices = realloc (pixma_custom_iclass_devices, sizeof(pixma_config_t) * (pixma_custom_iclass_devices_count + 2));
|
||||
}
|
||||
|
||||
while (ccaps[lcaps] != NULL) {
|
||||
if(strstr(capacity, ccaps[lcaps]) != NULL) {
|
||||
caps = caps | ucaps[lcaps];
|
||||
}
|
||||
lcaps++;
|
||||
}
|
||||
|
||||
ddpi = atoi(dpi);
|
||||
dadpi = atoi(adf_dpi);
|
||||
dw = atoi(w);
|
||||
dh = atoi(h);
|
||||
ppid = (uint16_t)strtoll(pid, NULL, 16);
|
||||
pixma_config_t elem = DEV (name, model, ppid, ddpi, dadpi, dw, dh, caps);
|
||||
pixma_custom_iclass_devices[pixma_custom_iclass_devices_count] = elem;
|
||||
pixma_config_t noelem = DEV (NULL, NULL, 0, 0, 0, 0, 0, 0);
|
||||
pixma_custom_iclass_devices[(pixma_custom_iclass_devices_count + 1)] = noelem;
|
||||
pixma_custom_iclass_devices_count++;
|
||||
}
|
||||
|
|
|
@ -490,6 +490,9 @@ typedef struct mp150_t
|
|||
u8[ILEN] image data
|
||||
*/
|
||||
|
||||
pixma_config_t *pixma_custom_mp150_devices = NULL;
|
||||
int pixma_custom_mp150_devices_count = 0;
|
||||
|
||||
static void mp150_finish_scan (pixma_t * s);
|
||||
|
||||
static int
|
||||
|
@ -2019,3 +2022,37 @@ const pixma_config_t pixma_mp150_devices[] = {
|
|||
|
||||
END_OF_DEVICE_LIST
|
||||
};
|
||||
|
||||
void
|
||||
pixma_add_custom_mp150_device (const char *name,
|
||||
const char *model,
|
||||
const char *pid,
|
||||
const char *dpi,
|
||||
const char *capacity)
|
||||
{
|
||||
int ddpi = 0;
|
||||
uint16_t ppid = 0;
|
||||
unsigned caps = 0;
|
||||
int lcaps = 0;
|
||||
|
||||
if (pixma_custom_mp150_devices_count == 0) {
|
||||
pixma_custom_mp150_devices = (pixma_config_t *)calloc (2, sizeof(pixma_config_t));
|
||||
} else {
|
||||
pixma_custom_mp150_devices = realloc (pixma_custom_mp150_devices, sizeof(pixma_config_t) * (pixma_custom_mp150_devices_count + 2));
|
||||
}
|
||||
|
||||
while (ccaps[lcaps] != NULL) {
|
||||
if(strstr(capacity, ccaps[lcaps]) != NULL) {
|
||||
caps = caps | ucaps[lcaps];
|
||||
}
|
||||
lcaps++;
|
||||
}
|
||||
|
||||
ddpi = atoi(dpi);
|
||||
ppid = (uint16_t)strtoll(pid, NULL, 16);
|
||||
pixma_config_t elem = DEVICE (name, model, ppid, 0, ddpi, 0, 0, 638, 877, caps);
|
||||
pixma_custom_mp150_devices[pixma_custom_mp150_devices_count] = elem;
|
||||
pixma_config_t noelem = END_OF_DEVICE_LIST;
|
||||
pixma_custom_mp150_devices[(pixma_custom_mp150_devices_count + 1)] = noelem;
|
||||
pixma_custom_mp150_devices_count++;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue