kopia lustrzana https://gitlab.com/sane-project/backends
Add a device according to the information added in the pixma.conf file
rodzic
b4a4f7bb59
commit
59b9916064
|
|
@ -152,6 +152,8 @@ static pixma_sane_t *first_scanner = NULL;
|
||||||
static const SANE_Device **dev_list = NULL;
|
static const SANE_Device **dev_list = NULL;
|
||||||
static const char* conf_devices[MAX_CONF_DEVICES];
|
static const char* conf_devices[MAX_CONF_DEVICES];
|
||||||
|
|
||||||
|
void pixma_add_custom_mp150_device (const char *, const char *, const char *, const char *, const char *);
|
||||||
|
|
||||||
static void mark_all_button_options_cached ( struct pixma_sane_t * ss )
|
static void mark_all_button_options_cached ( struct pixma_sane_t * ss )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -203,7 +205,7 @@ static SANE_Status config_attach_pixma(SANEI_Config __sane_unused__ * config,
|
||||||
return SANE_STATUS_INVAL;
|
return SANE_STATUS_INVAL;
|
||||||
}
|
}
|
||||||
PDBG (pixma_dbg (3, "Pixma capacity is [%s].\n", capacity_str));
|
PDBG (pixma_dbg (3, "Pixma capacity is [%s].\n", capacity_str));
|
||||||
pixma_add_custom_device (name_str, model_str, pid_str, dpi_str, capacity_str);
|
pixma_add_custom_mp150_device (name_str, model_str, pid_str, dpi_str, capacity_str);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (i=0; i < (MAX_CONF_DEVICES -1); i++) {
|
for (i=0; i < (MAX_CONF_DEVICES -1); i++) {
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,8 @@ extern const pixma_config_t pixma_mp750_devices[];
|
||||||
extern const pixma_config_t pixma_mp730_devices[];
|
extern const pixma_config_t pixma_mp730_devices[];
|
||||||
extern const pixma_config_t pixma_mp800_devices[];
|
extern const pixma_config_t pixma_mp800_devices[];
|
||||||
extern const pixma_config_t pixma_iclass_devices[];
|
extern const pixma_config_t pixma_iclass_devices[];
|
||||||
|
extern pixma_config_t *pixma_custom_mp150_devices;
|
||||||
|
extern int pixma_custom_mp150_devices_count;
|
||||||
|
|
||||||
static const pixma_config_t *const pixma_devices[] = {
|
static const pixma_config_t *const pixma_devices[] = {
|
||||||
pixma_mp150_devices,
|
pixma_mp150_devices,
|
||||||
|
|
@ -1223,6 +1225,15 @@ pixma_fill_gamma_table (double gamma, uint8_t * table, unsigned n)
|
||||||
int
|
int
|
||||||
pixma_find_scanners (const char **conf_devices, SANE_Bool local_only)
|
pixma_find_scanners (const char **conf_devices, SANE_Bool local_only)
|
||||||
{
|
{
|
||||||
|
if (pixma_custom_mp150_devices_count > 0) {
|
||||||
|
int i = 0;
|
||||||
|
const pixma_config_t **pixma_devices_all = (const pixma_config_t **)calloc(7, sizeof(pixma_config_t *));
|
||||||
|
for (i = 0; i < 6; i++)
|
||||||
|
pixma_devices_all[i] = pixma_devices[i];
|
||||||
|
pixma_devices_all[5] = pixma_custom_mp150_devices;
|
||||||
|
pixma_devices_all[6] = NULL;
|
||||||
|
return pixma_collect_devices (conf_devices, pixma_devices_all, local_only);
|
||||||
|
}
|
||||||
return pixma_collect_devices (conf_devices, pixma_devices, local_only);
|
return pixma_collect_devices (conf_devices, pixma_devices, local_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1353,14 +1364,3 @@ clean:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
|
||||||
pixma_add_custom_device (const char *name,
|
|
||||||
const char *model,
|
|
||||||
const char *pid,
|
|
||||||
const char *dpi,
|
|
||||||
const char *capacity)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,6 @@ int pixma_map_status_errno (unsigned status);
|
||||||
#if defined(HAVE_LIBXML2)
|
#if defined(HAVE_LIBXML2)
|
||||||
int pixma_parse_xml_response(const char *xml_message);
|
int pixma_parse_xml_response(const char *xml_message);
|
||||||
#endif
|
#endif
|
||||||
void pixma_add_custom_device (const char *, const char *, const char *, const char *, const char *);
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
#define pixma_fill_checksum(start, end) do { \
|
#define pixma_fill_checksum(start, end) do { \
|
||||||
|
|
|
||||||
|
|
@ -464,6 +464,9 @@ typedef struct mp150_t
|
||||||
u8[ILEN] image data
|
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 void mp150_finish_scan (pixma_t * s);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -1968,3 +1971,75 @@ const pixma_config_t pixma_mp150_devices[] = {
|
||||||
|
|
||||||
END_OF_DEVICE_LIST
|
END_OF_DEVICE_LIST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char *ccaps [] = {"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 [] = {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
|
||||||
|
};
|
||||||
|
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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