backend/pixma.c backend/pixma.h backend/pixma_mp150.c backend/pixma_mp810.c

backend/pixma_sane_options.c backend/pixma_sane_options.h:
- added new options:
     original (type of original to be scanned)
     target (action to be perfomed as target of the scan)
  Both these indocators can be returned by the scanner.
  pixma_mp810 can definately return these (e.g. for my MP980)
  I have assumed that the same applies to devices in pixma_mp150.c
  The target used to be returned in button1/2 in bits 0 - 8.
- All button options are now read and cached when any of the options
  are read (SANE_ACTION_GET_VALUE) or SANE_ACTION_SET_VALUE is used
  on option button_update.
  When reading an option again, the status of all options is re-read.
- Added a dummy info field that is used in case info is NULL
  as this is a valid input
merge-requests/1/head
Louis Lagendijk 2012-10-31 12:40:07 +01:00
rodzic 240ea344b8
commit d9e7dc5412
6 zmienionych plików z 180 dodań i 102 usunięć

Wyświetl plik

@ -87,9 +87,12 @@
/* pixma_sane_options.h generated by /* pixma_sane_options.h generated by
* scripts/pixma_gen_options.py h < pixma.c > pixma_sane_options.h * scripts/pixma_gen_options.py h < pixma.c > pixma_sane_options.h
* *and* formatted */ */
#include "pixma_sane_options.h" #include "pixma_sane_options.h"
#define BUTTON_GROUP_SIZE ( opt_target - opt_button_1 + 1 )
#define BUTTON_GROUP_INDEX(x) ( x - opt_button_1 )
typedef struct pixma_sane_t typedef struct pixma_sane_t
{ {
struct pixma_sane_t *next; struct pixma_sane_t *next;
@ -103,6 +106,7 @@ typedef struct pixma_sane_t
SANE_Status last_read_status; /* valid if !idle && !scanning */ SANE_Status last_read_status; /* valid if !idle && !scanning */
option_descriptor_t opt[opt_last]; option_descriptor_t opt[opt_last];
char button_option_is_cached[BUTTON_GROUP_SIZE];
SANE_Range xrange, yrange; SANE_Range xrange, yrange;
SANE_Word dpi_list[9]; /* up to 9600 dpi */ SANE_Word dpi_list[9]; /* up to 9600 dpi */
SANE_String_Const mode_list[6]; SANE_String_Const mode_list[6];
@ -128,6 +132,13 @@ 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];
static void mark_all_button_options_cached ( struct pixma_sane_t * ss )
{
int i;
for (i = 0; i < (opt__group_5 - opt_button_1); i++ )
ss -> button_option_is_cached[i] = 1;
}
static SANE_Status config_attach_pixma(SANEI_Config * config, const char *devname) static SANE_Status config_attach_pixma(SANEI_Config * config, const char *devname)
{ {
int i; int i;
@ -272,16 +283,22 @@ update_button_state (pixma_sane_t * ss, SANE_Int * info)
switch (ev & ~PIXMA_EV_ACTION_MASK) switch (ev & ~PIXMA_EV_ACTION_MASK)
{ {
case PIXMA_EV_BUTTON1: case PIXMA_EV_BUTTON1:
b1 = (ev & PIXMA_EV_ACTION_MASK) + 1; b1 = 1;
break; break;
case PIXMA_EV_BUTTON2: case PIXMA_EV_BUTTON2:
b2 = (ev & PIXMA_EV_ACTION_MASK) + 1; b2 = 1;
break; break;
} }
if (b1 != OVAL (opt_button_1).w || b2 != OVAL (opt_button_2).w) if (b1 != OVAL (opt_button_1).w || b2 != OVAL (opt_button_2).w)
{
*info |= SANE_INFO_RELOAD_OPTIONS; *info |= SANE_INFO_RELOAD_OPTIONS;
OVAL (opt_button_1).w = b1; OVAL (opt_button_1).w = b1;
OVAL (opt_button_2).w = b2; OVAL (opt_button_2).w = b2;
OVAL (opt_original).w = GET_EV_ORIGINAL(ev);
OVAL (opt_target).w = GET_EV_TARGET(ev);
}
mark_all_button_options_cached(ss);
} }
static SANE_Bool static SANE_Bool
@ -598,11 +615,17 @@ control_option (pixma_sane_t * ss, SANE_Int n,
{ {
int result, i; int result, i;
const pixma_config_t *cfg; const pixma_config_t *cfg;
SANE_Int dummy;
/* info may be null, better to set a dummy here then test everywhere */
if (info == NULL)
info = &dummy;
cfg = pixma_get_config (ss->s); cfg = pixma_get_config (ss->s);
/* PDBG (pixma_dbg (4, "*control_option***** n = %u, a = %u\n", n, a)); */ /* PDBG (pixma_dbg (4, "*control_option***** n = %u, a = %u\n", n, a)); */
/* first deal with options that require special treatment */
result = SANE_STATUS_UNSUPPORTED; result = SANE_STATUS_UNSUPPORTED;
switch (n) switch (n)
{ {
@ -638,8 +661,18 @@ control_option (pixma_sane_t * ss, SANE_Int n,
return SANE_STATUS_INVAL; return SANE_STATUS_INVAL;
} }
break; break;
case opt_button_1:
case opt_button_2:
case opt_original:
case opt_target:
/* poll scanner if option is not cached */
if (! ss->button_option_is_cached[ BUTTON_GROUP_INDEX(n) ] )
update_button_state (ss, info);
/* mark this option as read */
ss->button_option_is_cached[ BUTTON_GROUP_INDEX(n) ] = 0;
} }
/* now deal with getting and setting of options */
switch (SOD (n).type) switch (SOD (n).type)
{ {
case SANE_TYPE_BOOL: case SANE_TYPE_BOOL:
@ -659,6 +692,7 @@ control_option (pixma_sane_t * ss, SANE_Int n,
if (result != SANE_STATUS_GOOD) if (result != SANE_STATUS_GOOD)
return result; return result;
/* deal with dependencies between options */
switch (n) switch (n)
{ {
case opt_custom_gamma: case opt_custom_gamma:
@ -1271,7 +1305,7 @@ sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only)
SANE_Status SANE_Status
sane_open (SANE_String_Const name, SANE_Handle * h) sane_open (SANE_String_Const name, SANE_Handle * h)
{ {
unsigned i, nscanners; unsigned i, j, nscanners;
int error = 0; int error = 0;
pixma_sane_t *ss = NULL; pixma_sane_t *ss = NULL;
const pixma_config_t *cfg; const pixma_config_t *cfg;
@ -1331,7 +1365,8 @@ sane_open (SANE_String_Const name, SANE_Handle * h)
ss->rpipe = -1; ss->rpipe = -1;
ss->idle = SANE_TRUE; ss->idle = SANE_TRUE;
ss->scanning = SANE_FALSE; ss->scanning = SANE_FALSE;
for (j=0; j < BUTTON_GROUP_SIZE; j++)
ss->button_option_is_cached[j] = 0;
error = pixma_open (i, &ss->s); error = pixma_open (i, &ss->s);
if (error < 0) if (error < 0)
{ {
@ -1731,12 +1766,22 @@ type button button-update
type int button-1 type int button-1
default 0 default 0
title Button 1 title Button 1
cap soft_select soft_detect advanced cap soft_detect advanced
type int button-2 type int button-2
default 0 default 0
title Button 2 title Button 2
cap soft_select soft_detect advanced cap soft_detect advanced
type int original
default 0
title Type of original to scan
cap soft_detect advanced
type int target
default 0
title Target operation type
cap soft_detect advanced
rem ------------------------------------------- rem -------------------------------------------
type group type group
@ -1762,5 +1807,5 @@ END SANE_Option_Descriptor
/* pixma_sane_options.c generated by /* pixma_sane_options.c generated by
* scripts/pixma_gen_options.py < pixma.c > pixma_sane_options.c * scripts/pixma_gen_options.py < pixma.c > pixma_sane_options.c
* *and* formatted */ */
#include "pixma_sane_options.c" #include "pixma_sane_options.c"

Wyświetl plik

@ -152,12 +152,18 @@ typedef uint32_t uint32_t;
#define PIXMA_CAP_EXPERIMENT (1 << 31) #define PIXMA_CAP_EXPERIMENT (1 << 31)
/**@}*/ /**@}*/
/** \name Button events returned by pixma_wait_event() */ /** \name Button events and related information returned by pixma_wait_event() */
/**@{*/ /**@{*/
#define PIXMA_EV_NONE 0 #define PIXMA_EV_NONE 0
#define PIXMA_EV_ACTION_MASK (0xff) #define PIXMA_EV_ACTION_MASK (0xffff)
#define PIXMA_EV_BUTTON1 (1 << 8) #define PIXMA_EV_BUTTON1 (1 << 16)
#define PIXMA_EV_BUTTON2 (2 << 8) #define PIXMA_EV_BUTTON2 (2 << 16)
#define PIXMA_EV_TARGET_MASK (0xff)
#define PIXMA_EV_ORIGINAL_MASK (0xff00)
#define GET_EV_TARGET(x) (x & PIXMA_EV_TARGET_MASK)
#define GET_EV_ORIGINAL(x) ( (x & PIXMA_EV_ORIGINAL_MASK) >> 8 )
/**@}*/ /**@}*/
/** @} end of API group */ /** @} end of API group */

Wyświetl plik

@ -915,9 +915,9 @@ handle_interrupt (pixma_t * s, int timeout)
if (buf[9] & 2) if (buf[9] & 2)
query_status (s); query_status (s);
if (buf[0] & 2) if (buf[0] & 2)
s->events = PIXMA_EV_BUTTON2 | buf[1]; /* b/w scan */ s->events = PIXMA_EV_BUTTON2 | buf[1] | ((buf[0] & 0xf0) << 4); /* b/w scan */
if (buf[0] & 1) if (buf[0] & 1)
s->events = PIXMA_EV_BUTTON1 | buf[1]; /* color scan */ s->events = PIXMA_EV_BUTTON1 | buf[1] | ((buf[0] & 0xf0) << 4); /* color scan */
return 1; return 1;
} }

Wyświetl plik

@ -1040,9 +1040,9 @@ handle_interrupt (pixma_t * s, int timeout)
if (buf[9] & 2) if (buf[9] & 2)
query_status (s); query_status (s);
if (buf[0] & 2) if (buf[0] & 2)
s->events = PIXMA_EV_BUTTON2 | buf[1]; /* b/w scan */ s->events = PIXMA_EV_BUTTON2 | buf[1] | ((buf[0] & 0xf0) << 4); /* b/w scan */
if (buf[0] & 1) if (buf[0] & 1)
s->events = PIXMA_EV_BUTTON1 | buf[1]; /* color scan */ s->events = PIXMA_EV_BUTTON1 | buf[1] | ((buf[0] & 0xf0) << 4); /* color scan */
return 1; return 1;
} }

Wyświetl plik

@ -1,27 +1,29 @@
/* Automatically generated from pixma_sane.c */ /* Automatically generated from pixma_sane.c */
static const SANE_Range constraint_gamma_table = { 0, 255, 0 }; static const SANE_Range constraint_gamma_table =
static const SANE_Range constraint_gamma = { SANE_FIX (0.3), SANE_FIX (5), { 0,255,0 };
SANE_FIX (0) }; static const SANE_Range constraint_gamma =
static const SANE_Range constraint_threshold = { 0, 100, 1 }; { SANE_FIX(0.3),SANE_FIX(5),SANE_FIX(0) };
static const SANE_Range constraint_threshold_curve = { 0, 127, 1 }; static const SANE_Range constraint_threshold =
{ 0,100,1 };
static const SANE_Range constraint_threshold_curve =
{ 0,127,1 };
static int
find_string_in_list (SANE_String_Const str, const SANE_String_Const * list) static
int find_string_in_list(SANE_String_Const str, const SANE_String_Const *list)
{ {
int i; int i;
for (i = 0; list[i] && strcmp (str, list[i]) != 0; i++) for (i = 0; list[i] && strcmp(str, list[i]) != 0; i++) {}
{
}
return i; return i;
} }
static int static
build_option_descriptors (struct pixma_sane_t *ss) int build_option_descriptors(struct pixma_sane_t *ss)
{ {
SANE_Option_Descriptor *sod; SANE_Option_Descriptor *sod;
option_descriptor_t *opt; option_descriptor_t *opt;
memset (OPT_IN_CTX, 0, sizeof (OPT_IN_CTX)); memset(OPT_IN_CTX, 0, sizeof(OPT_IN_CTX));
opt = &(OPT_IN_CTX[opt_opt_num_opts]); opt = &(OPT_IN_CTX[opt_opt_num_opts]);
sod = &opt->sod; sod = &opt->sod;
@ -30,8 +32,8 @@ build_option_descriptors (struct pixma_sane_t *ss)
sod->desc = SANE_DESC_NUM_OPTIONS; sod->desc = SANE_DESC_NUM_OPTIONS;
sod->name = ""; sod->name = "";
sod->unit = SANE_UNIT_NONE; sod->unit = SANE_UNIT_NONE;
sod->size = 1 * sizeof (SANE_Word); sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_DETECT; sod->cap = SANE_CAP_SOFT_DETECT;
sod->constraint_type = SANE_CONSTRAINT_NONE; sod->constraint_type = SANE_CONSTRAINT_NONE;
OPT_IN_CTX[opt_opt_num_opts].info = 0; OPT_IN_CTX[opt_opt_num_opts].info = 0;
opt->def.w = opt_last; opt->def.w = opt_last;
@ -40,7 +42,7 @@ build_option_descriptors (struct pixma_sane_t *ss)
opt = &(OPT_IN_CTX[opt__group_1]); opt = &(OPT_IN_CTX[opt__group_1]);
sod = &opt->sod; sod = &opt->sod;
sod->type = SANE_TYPE_GROUP; sod->type = SANE_TYPE_GROUP;
sod->title = SANE_I18N ("Scan mode"); sod->title = SANE_I18N("Scan mode");
sod->desc = sod->title; sod->desc = sod->title;
opt = &(OPT_IN_CTX[opt_resolution]); opt = &(OPT_IN_CTX[opt_resolution]);
@ -50,8 +52,8 @@ build_option_descriptors (struct pixma_sane_t *ss)
sod->desc = SANE_DESC_SCAN_RESOLUTION; sod->desc = SANE_DESC_SCAN_RESOLUTION;
sod->name = "resolution"; sod->name = "resolution";
sod->unit = SANE_UNIT_DPI; sod->unit = SANE_UNIT_DPI;
sod->size = 1 * sizeof (SANE_Word); sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_AUTOMATIC; sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_AUTOMATIC;
sod->constraint_type = SANE_CONSTRAINT_WORD_LIST; sod->constraint_type = SANE_CONSTRAINT_WORD_LIST;
sod->constraint.word_list = ss->dpi_list; sod->constraint.word_list = ss->dpi_list;
OPT_IN_CTX[opt_resolution].info = SANE_INFO_RELOAD_PARAMS; OPT_IN_CTX[opt_resolution].info = SANE_INFO_RELOAD_PARAMS;
@ -66,37 +68,37 @@ build_option_descriptors (struct pixma_sane_t *ss)
sod->name = "mode"; sod->name = "mode";
sod->unit = SANE_UNIT_NONE; sod->unit = SANE_UNIT_NONE;
sod->size = 31; sod->size = 31;
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_AUTOMATIC; sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_AUTOMATIC;
sod->constraint_type = SANE_CONSTRAINT_STRING_LIST; sod->constraint_type = SANE_CONSTRAINT_STRING_LIST;
sod->constraint.string_list = ss->mode_list; sod->constraint.string_list = ss->mode_list;
OPT_IN_CTX[opt_mode].info = SANE_INFO_RELOAD_PARAMS; OPT_IN_CTX[opt_mode].info = SANE_INFO_RELOAD_PARAMS;
opt->def.s = SANE_I18N (ss->mode_list[0]); opt->def.s = SANE_I18N(ss->mode_list[0]);
opt->val.w = find_string_in_list (opt->def.s, sod->constraint.string_list); opt->val.w = find_string_in_list(opt->def.s, sod->constraint.string_list);
opt = &(OPT_IN_CTX[opt_source]); opt = &(OPT_IN_CTX[opt_source]);
sod = &opt->sod; sod = &opt->sod;
sod->type = SANE_TYPE_STRING; sod->type = SANE_TYPE_STRING;
sod->title = SANE_TITLE_SCAN_SOURCE; sod->title = SANE_TITLE_SCAN_SOURCE;
sod->desc = SANE_I18N ("Selects the scan source (such as a document-feeder). Set source before mode and resolution. Resets mode and resolution to auto values."); sod->desc = SANE_I18N("Selects the scan source (such as a document-feeder). Set source before mode and resolution. Resets mode and resolution to auto values.");
sod->name = "source"; sod->name = "source";
sod->unit = SANE_UNIT_NONE; sod->unit = SANE_UNIT_NONE;
sod->size = 31; sod->size = 31;
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT;
sod->constraint_type = SANE_CONSTRAINT_STRING_LIST; sod->constraint_type = SANE_CONSTRAINT_STRING_LIST;
sod->constraint.string_list = ss->source_list; sod->constraint.string_list = ss->source_list;
OPT_IN_CTX[opt_source].info = 0; OPT_IN_CTX[opt_source].info = 0;
opt->def.s = SANE_I18N ("Flatbed"); opt->def.s = SANE_I18N("Flatbed");
opt->val.w = find_string_in_list (opt->def.s, sod->constraint.string_list); opt->val.w = find_string_in_list(opt->def.s, sod->constraint.string_list);
opt = &(OPT_IN_CTX[opt_button_controlled]); opt = &(OPT_IN_CTX[opt_button_controlled]);
sod = &opt->sod; sod = &opt->sod;
sod->type = SANE_TYPE_BOOL; sod->type = SANE_TYPE_BOOL;
sod->title = SANE_I18N ("Button-controlled scan"); sod->title = SANE_I18N("Button-controlled scan");
sod->desc = SANE_I18N ("When enabled, scan process will not start immediately. To proceed, press \"SCAN\" button (for MP150) or \"COLOR\" button (for other models). To cancel, press \"GRAY\" button."); sod->desc = SANE_I18N("When enabled, scan process will not start immediately. To proceed, press \"SCAN\" button (for MP150) or \"COLOR\" button (for other models). To cancel, press \"GRAY\" button.");
sod->name = "button-controlled"; sod->name = "button-controlled";
sod->unit = SANE_UNIT_NONE; sod->unit = SANE_UNIT_NONE;
sod->size = sizeof (SANE_Word); sod->size = sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_INACTIVE; sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_INACTIVE;
sod->constraint_type = SANE_CONSTRAINT_NONE; sod->constraint_type = SANE_CONSTRAINT_NONE;
OPT_IN_CTX[opt_button_controlled].info = 0; OPT_IN_CTX[opt_button_controlled].info = 0;
opt->def.w = SANE_FALSE; opt->def.w = SANE_FALSE;
@ -105,7 +107,7 @@ build_option_descriptors (struct pixma_sane_t *ss)
opt = &(OPT_IN_CTX[opt__group_2]); opt = &(OPT_IN_CTX[opt__group_2]);
sod = &opt->sod; sod = &opt->sod;
sod->type = SANE_TYPE_GROUP; sod->type = SANE_TYPE_GROUP;
sod->title = SANE_I18N ("Gamma"); sod->title = SANE_I18N("Gamma");
sod->desc = sod->title; sod->desc = sod->title;
opt = &(OPT_IN_CTX[opt_custom_gamma]); opt = &(OPT_IN_CTX[opt_custom_gamma]);
@ -115,9 +117,8 @@ build_option_descriptors (struct pixma_sane_t *ss)
sod->desc = SANE_DESC_CUSTOM_GAMMA; sod->desc = SANE_DESC_CUSTOM_GAMMA;
sod->name = "custom-gamma"; sod->name = "custom-gamma";
sod->unit = SANE_UNIT_NONE; sod->unit = SANE_UNIT_NONE;
sod->size = sizeof (SANE_Word); sod->size = sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_AUTOMATIC sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_AUTOMATIC|SANE_CAP_INACTIVE;
| SANE_CAP_INACTIVE;
sod->constraint_type = SANE_CONSTRAINT_NONE; sod->constraint_type = SANE_CONSTRAINT_NONE;
OPT_IN_CTX[opt_custom_gamma].info = 0; OPT_IN_CTX[opt_custom_gamma].info = 0;
opt->def.w = SANE_TRUE; opt->def.w = SANE_TRUE;
@ -130,9 +131,8 @@ build_option_descriptors (struct pixma_sane_t *ss)
sod->desc = SANE_DESC_GAMMA_VECTOR; sod->desc = SANE_DESC_GAMMA_VECTOR;
sod->name = "gamma-table"; sod->name = "gamma-table";
sod->unit = SANE_UNIT_NONE; sod->unit = SANE_UNIT_NONE;
sod->size = 4096 * sizeof (SANE_Word); sod->size = 4096 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_AUTOMATIC sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_AUTOMATIC|SANE_CAP_INACTIVE;
| SANE_CAP_INACTIVE;
sod->constraint_type = SANE_CONSTRAINT_RANGE; sod->constraint_type = SANE_CONSTRAINT_RANGE;
sod->constraint.range = &constraint_gamma_table; sod->constraint.range = &constraint_gamma_table;
OPT_IN_CTX[opt_gamma_table].info = 0; OPT_IN_CTX[opt_gamma_table].info = 0;
@ -140,23 +140,22 @@ build_option_descriptors (struct pixma_sane_t *ss)
opt = &(OPT_IN_CTX[opt_gamma]); opt = &(OPT_IN_CTX[opt_gamma]);
sod = &opt->sod; sod = &opt->sod;
sod->type = SANE_TYPE_FIXED; sod->type = SANE_TYPE_FIXED;
sod->title = SANE_I18N ("Gamma function exponent"); sod->title = SANE_I18N("Gamma function exponent");
sod->desc = SANE_I18N ("Changes intensity of midtones"); sod->desc = SANE_I18N("Changes intensity of midtones");
sod->name = "gamma"; sod->name = "gamma";
sod->unit = SANE_UNIT_NONE; sod->unit = SANE_UNIT_NONE;
sod->size = 1 * sizeof (SANE_Word); sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_AUTOMATIC sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_AUTOMATIC|SANE_CAP_INACTIVE;
| SANE_CAP_INACTIVE;
sod->constraint_type = SANE_CONSTRAINT_RANGE; sod->constraint_type = SANE_CONSTRAINT_RANGE;
sod->constraint.range = &constraint_gamma; sod->constraint.range = &constraint_gamma;
OPT_IN_CTX[opt_gamma].info = 0; OPT_IN_CTX[opt_gamma].info = 0;
opt->def.w = SANE_FIX (AUTO_GAMMA); opt->def.w = SANE_FIX(AUTO_GAMMA);
opt->val.w = SANE_FIX (AUTO_GAMMA); opt->val.w = SANE_FIX(AUTO_GAMMA);
opt = &(OPT_IN_CTX[opt__group_3]); opt = &(OPT_IN_CTX[opt__group_3]);
sod = &opt->sod; sod = &opt->sod;
sod->type = SANE_TYPE_GROUP; sod->type = SANE_TYPE_GROUP;
sod->title = SANE_I18N ("Geometry"); sod->title = SANE_I18N("Geometry");
sod->desc = sod->title; sod->desc = sod->title;
opt = &(OPT_IN_CTX[opt_tl_x]); opt = &(OPT_IN_CTX[opt_tl_x]);
@ -166,13 +165,13 @@ build_option_descriptors (struct pixma_sane_t *ss)
sod->desc = SANE_DESC_SCAN_TL_X; sod->desc = SANE_DESC_SCAN_TL_X;
sod->name = "tl-x"; sod->name = "tl-x";
sod->unit = SANE_UNIT_MM; sod->unit = SANE_UNIT_MM;
sod->size = 1 * sizeof (SANE_Word); sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_AUTOMATIC; sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_AUTOMATIC;
sod->constraint_type = SANE_CONSTRAINT_RANGE; sod->constraint_type = SANE_CONSTRAINT_RANGE;
sod->constraint.range = &ss->xrange; sod->constraint.range = &ss->xrange;
OPT_IN_CTX[opt_tl_x].info = SANE_INFO_RELOAD_PARAMS; OPT_IN_CTX[opt_tl_x].info = SANE_INFO_RELOAD_PARAMS;
opt->def.w = SANE_FIX (0); opt->def.w = SANE_FIX(0);
opt->val.w = SANE_FIX (0); opt->val.w = SANE_FIX(0);
opt = &(OPT_IN_CTX[opt_tl_y]); opt = &(OPT_IN_CTX[opt_tl_y]);
sod = &opt->sod; sod = &opt->sod;
@ -181,13 +180,13 @@ build_option_descriptors (struct pixma_sane_t *ss)
sod->desc = SANE_DESC_SCAN_TL_Y; sod->desc = SANE_DESC_SCAN_TL_Y;
sod->name = "tl-y"; sod->name = "tl-y";
sod->unit = SANE_UNIT_MM; sod->unit = SANE_UNIT_MM;
sod->size = 1 * sizeof (SANE_Word); sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_AUTOMATIC; sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_AUTOMATIC;
sod->constraint_type = SANE_CONSTRAINT_RANGE; sod->constraint_type = SANE_CONSTRAINT_RANGE;
sod->constraint.range = &ss->yrange; sod->constraint.range = &ss->yrange;
OPT_IN_CTX[opt_tl_y].info = SANE_INFO_RELOAD_PARAMS; OPT_IN_CTX[opt_tl_y].info = SANE_INFO_RELOAD_PARAMS;
opt->def.w = SANE_FIX (0); opt->def.w = SANE_FIX(0);
opt->val.w = SANE_FIX (0); opt->val.w = SANE_FIX(0);
opt = &(OPT_IN_CTX[opt_br_x]); opt = &(OPT_IN_CTX[opt_br_x]);
sod = &opt->sod; sod = &opt->sod;
@ -196,8 +195,8 @@ build_option_descriptors (struct pixma_sane_t *ss)
sod->desc = SANE_DESC_SCAN_BR_X; sod->desc = SANE_DESC_SCAN_BR_X;
sod->name = "br-x"; sod->name = "br-x";
sod->unit = SANE_UNIT_MM; sod->unit = SANE_UNIT_MM;
sod->size = 1 * sizeof (SANE_Word); sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_AUTOMATIC; sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_AUTOMATIC;
sod->constraint_type = SANE_CONSTRAINT_RANGE; sod->constraint_type = SANE_CONSTRAINT_RANGE;
sod->constraint.range = &ss->xrange; sod->constraint.range = &ss->xrange;
OPT_IN_CTX[opt_br_x].info = SANE_INFO_RELOAD_PARAMS; OPT_IN_CTX[opt_br_x].info = SANE_INFO_RELOAD_PARAMS;
@ -211,8 +210,8 @@ build_option_descriptors (struct pixma_sane_t *ss)
sod->desc = SANE_DESC_SCAN_BR_Y; sod->desc = SANE_DESC_SCAN_BR_Y;
sod->name = "br-y"; sod->name = "br-y";
sod->unit = SANE_UNIT_MM; sod->unit = SANE_UNIT_MM;
sod->size = 1 * sizeof (SANE_Word); sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_AUTOMATIC; sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_AUTOMATIC;
sod->constraint_type = SANE_CONSTRAINT_RANGE; sod->constraint_type = SANE_CONSTRAINT_RANGE;
sod->constraint.range = &ss->yrange; sod->constraint.range = &ss->yrange;
OPT_IN_CTX[opt_br_y].info = SANE_INFO_RELOAD_PARAMS; OPT_IN_CTX[opt_br_y].info = SANE_INFO_RELOAD_PARAMS;
@ -222,30 +221,30 @@ build_option_descriptors (struct pixma_sane_t *ss)
opt = &(OPT_IN_CTX[opt__group_4]); opt = &(OPT_IN_CTX[opt__group_4]);
sod = &opt->sod; sod = &opt->sod;
sod->type = SANE_TYPE_GROUP; sod->type = SANE_TYPE_GROUP;
sod->title = SANE_I18N ("Buttons"); sod->title = SANE_I18N("Buttons");
sod->desc = sod->title; sod->desc = sod->title;
opt = &(OPT_IN_CTX[opt_button_update]); opt = &(OPT_IN_CTX[opt_button_update]);
sod = &opt->sod; sod = &opt->sod;
sod->type = SANE_TYPE_BUTTON; sod->type = SANE_TYPE_BUTTON;
sod->title = SANE_I18N ("Update button state"); sod->title = SANE_I18N("Update button state");
sod->desc = sod->title; sod->desc = sod->title;
sod->name = "button-update"; sod->name = "button-update";
sod->unit = SANE_UNIT_NONE; sod->unit = SANE_UNIT_NONE;
sod->size = 0; sod->size = 0;
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_ADVANCED; sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_ADVANCED;
sod->constraint_type = SANE_CONSTRAINT_NONE; sod->constraint_type = SANE_CONSTRAINT_NONE;
OPT_IN_CTX[opt_button_update].info = 0; OPT_IN_CTX[opt_button_update].info = 0;
opt = &(OPT_IN_CTX[opt_button_1]); opt = &(OPT_IN_CTX[opt_button_1]);
sod = &opt->sod; sod = &opt->sod;
sod->type = SANE_TYPE_INT; sod->type = SANE_TYPE_INT;
sod->title = SANE_I18N ("Button 1"); sod->title = SANE_I18N("Button 1");
sod->desc = sod->title; sod->desc = sod->title;
sod->name = "button-1"; sod->name = "button-1";
sod->unit = SANE_UNIT_NONE; sod->unit = SANE_UNIT_NONE;
sod->size = 1 * sizeof (SANE_Word); sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_ADVANCED; sod->cap = SANE_CAP_SOFT_DETECT|SANE_CAP_ADVANCED;
sod->constraint_type = SANE_CONSTRAINT_NONE; sod->constraint_type = SANE_CONSTRAINT_NONE;
OPT_IN_CTX[opt_button_1].info = 0; OPT_IN_CTX[opt_button_1].info = 0;
opt->def.w = 0; opt->def.w = 0;
@ -254,21 +253,49 @@ build_option_descriptors (struct pixma_sane_t *ss)
opt = &(OPT_IN_CTX[opt_button_2]); opt = &(OPT_IN_CTX[opt_button_2]);
sod = &opt->sod; sod = &opt->sod;
sod->type = SANE_TYPE_INT; sod->type = SANE_TYPE_INT;
sod->title = SANE_I18N ("Button 2"); sod->title = SANE_I18N("Button 2");
sod->desc = sod->title; sod->desc = sod->title;
sod->name = "button-2"; sod->name = "button-2";
sod->unit = SANE_UNIT_NONE; sod->unit = SANE_UNIT_NONE;
sod->size = 1 * sizeof (SANE_Word); sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_ADVANCED; sod->cap = SANE_CAP_SOFT_DETECT|SANE_CAP_ADVANCED;
sod->constraint_type = SANE_CONSTRAINT_NONE; sod->constraint_type = SANE_CONSTRAINT_NONE;
OPT_IN_CTX[opt_button_2].info = 0; OPT_IN_CTX[opt_button_2].info = 0;
opt->def.w = 0; opt->def.w = 0;
opt->val.w = 0; opt->val.w = 0;
opt = &(OPT_IN_CTX[opt_original]);
sod = &opt->sod;
sod->type = SANE_TYPE_INT;
sod->title = SANE_I18N("Type of original to scan");
sod->desc = sod->title;
sod->name = "original";
sod->unit = SANE_UNIT_NONE;
sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_DETECT|SANE_CAP_ADVANCED;
sod->constraint_type = SANE_CONSTRAINT_NONE;
OPT_IN_CTX[opt_original].info = 0;
opt->def.w = 0;
opt->val.w = 0;
opt = &(OPT_IN_CTX[opt_target]);
sod = &opt->sod;
sod->type = SANE_TYPE_INT;
sod->title = SANE_I18N("Target operation type");
sod->desc = sod->title;
sod->name = "target";
sod->unit = SANE_UNIT_NONE;
sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_DETECT|SANE_CAP_ADVANCED;
sod->constraint_type = SANE_CONSTRAINT_NONE;
OPT_IN_CTX[opt_target].info = 0;
opt->def.w = 0;
opt->val.w = 0;
opt = &(OPT_IN_CTX[opt__group_5]); opt = &(OPT_IN_CTX[opt__group_5]);
sod = &opt->sod; sod = &opt->sod;
sod->type = SANE_TYPE_GROUP; sod->type = SANE_TYPE_GROUP;
sod->title = SANE_I18N ("Extras"); sod->title = SANE_I18N("Extras");
sod->desc = sod->title; sod->desc = sod->title;
opt = &(OPT_IN_CTX[opt_threshold]); opt = &(OPT_IN_CTX[opt_threshold]);
@ -278,9 +305,8 @@ build_option_descriptors (struct pixma_sane_t *ss)
sod->desc = SANE_DESC_THRESHOLD; sod->desc = SANE_DESC_THRESHOLD;
sod->name = "threshold"; sod->name = "threshold";
sod->unit = SANE_UNIT_PERCENT; sod->unit = SANE_UNIT_PERCENT;
sod->size = 1 * sizeof (SANE_Word); sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_AUTOMATIC sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_AUTOMATIC|SANE_CAP_INACTIVE;
| SANE_CAP_INACTIVE;
sod->constraint_type = SANE_CONSTRAINT_RANGE; sod->constraint_type = SANE_CONSTRAINT_RANGE;
sod->constraint.range = &constraint_threshold; sod->constraint.range = &constraint_threshold;
OPT_IN_CTX[opt_threshold].info = 0; OPT_IN_CTX[opt_threshold].info = 0;
@ -290,13 +316,12 @@ build_option_descriptors (struct pixma_sane_t *ss)
opt = &(OPT_IN_CTX[opt_threshold_curve]); opt = &(OPT_IN_CTX[opt_threshold_curve]);
sod = &opt->sod; sod = &opt->sod;
sod->type = SANE_TYPE_INT; sod->type = SANE_TYPE_INT;
sod->title = SANE_I18N ("Threshold curve"); sod->title = SANE_I18N("Threshold curve");
sod->desc = SANE_I18N ("Dynamic threshold curve, from light to dark, normally 50-65"); sod->desc = SANE_I18N("Dynamic threshold curve, from light to dark, normally 50-65");
sod->name = "threshold-curve"; sod->name = "threshold-curve";
sod->unit = SANE_UNIT_NONE; sod->unit = SANE_UNIT_NONE;
sod->size = 1 * sizeof (SANE_Word); sod->size = 1 * sizeof(SANE_Word);
sod->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT | SANE_CAP_AUTOMATIC sod->cap = SANE_CAP_SOFT_SELECT|SANE_CAP_SOFT_DETECT|SANE_CAP_AUTOMATIC|SANE_CAP_INACTIVE;
| SANE_CAP_INACTIVE;
sod->constraint_type = SANE_CONSTRAINT_RANGE; sod->constraint_type = SANE_CONSTRAINT_RANGE;
sod->constraint.range = &constraint_threshold_curve; sod->constraint.range = &constraint_threshold_curve;
OPT_IN_CTX[opt_threshold_curve].info = 0; OPT_IN_CTX[opt_threshold_curve].info = 0;

Wyświetl plik

@ -1,17 +1,15 @@
/* Automatically generated from pixma_sane.c */ /* Automatically generated from pixma_sane.c */
typedef union typedef union {
{
SANE_Word w; SANE_Word w;
SANE_Int i; SANE_Int i;
SANE_Bool b; SANE_Bool b;
SANE_Fixed f; SANE_Fixed f;
SANE_String s; SANE_String s;
void *ptr; void *ptr;
} option_value_t; } option_value_t;
typedef enum typedef enum {
{
opt_opt_num_opts, opt_opt_num_opts,
opt__group_1, opt__group_1,
opt_resolution, opt_resolution,
@ -31,18 +29,22 @@ typedef enum
opt_button_update, opt_button_update,
opt_button_1, opt_button_1,
opt_button_2, opt_button_2,
opt_original,
opt_target,
opt__group_5, opt__group_5,
opt_threshold, opt_threshold,
opt_threshold_curve, opt_threshold_curve,
opt_last opt_last
} option_t; } option_t;
typedef struct
{ typedef struct {
SANE_Option_Descriptor sod; SANE_Option_Descriptor sod;
option_value_t val, def; option_value_t val,def;
SANE_Word info; SANE_Word info;
} option_descriptor_t; } option_descriptor_t;
struct pixma_sane_t; struct pixma_sane_t;
static int build_option_descriptors (struct pixma_sane_t *ss); static int build_option_descriptors(struct pixma_sane_t *ss);