kopia lustrzana https://gitlab.com/sane-project/backends
Reworked due to review comments:
- re-ordered the new option into the block of enums for the panel - re-ordered the code to reflect the new value of OPT_FUNCTION_NUMBER - corrected size of variable panel_read to include the new option OPT_FUNCTION_NUMBER734-support-for-canon-i-sensys-mf657cdw-mf650c-series
rodzic
3f143af244
commit
94ce64e89a
|
@ -3216,6 +3216,22 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
|
||||||
opt->cap = SANE_CAP_INACTIVE;
|
opt->cap = SANE_CAP_INACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(option==OPT_FUNCTION_NUMBER){
|
||||||
|
opt->name = "function-number";
|
||||||
|
opt->title = "Function number";
|
||||||
|
opt->desc = "Function number set on panel";
|
||||||
|
opt->type = SANE_TYPE_INT;
|
||||||
|
opt->unit = SANE_UNIT_NONE;
|
||||||
|
opt->constraint_type = SANE_CONSTRAINT_RANGE;
|
||||||
|
opt->constraint.range = &s->counter_range;
|
||||||
|
s->counter_range.min=1;
|
||||||
|
s->counter_range.max=9;
|
||||||
|
s->counter_range.quant=1;
|
||||||
|
opt->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
|
||||||
|
if(!s->can_read_panel || !s->has_function_number)
|
||||||
|
opt->cap = SANE_CAP_INACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
if(option==OPT_ADF_LOADED){
|
if(option==OPT_ADF_LOADED){
|
||||||
opt->name = "adf-loaded";
|
opt->name = "adf-loaded";
|
||||||
opt->title = "ADF Loaded";
|
opt->title = "ADF Loaded";
|
||||||
|
@ -3238,22 +3254,6 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
|
||||||
opt->cap = SANE_CAP_INACTIVE;
|
opt->cap = SANE_CAP_INACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(option==OPT_FUNCTION_NUMBER){
|
|
||||||
opt->name = "function-number";
|
|
||||||
opt->title = "Function number";
|
|
||||||
opt->desc = "Function number set on panel";
|
|
||||||
opt->type = SANE_TYPE_INT;
|
|
||||||
opt->unit = SANE_UNIT_NONE;
|
|
||||||
opt->constraint_type = SANE_CONSTRAINT_RANGE;
|
|
||||||
opt->constraint.range = &s->counter_range;
|
|
||||||
s->counter_range.min=1;
|
|
||||||
s->counter_range.max=9;
|
|
||||||
s->counter_range.quant=1;
|
|
||||||
opt->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
|
|
||||||
if(!s->can_read_panel || !s->has_function_number)
|
|
||||||
opt->cap = SANE_CAP_INACTIVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return opt;
|
return opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3672,6 +3672,11 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
|
||||||
*val_p = s->total_counter;
|
*val_p = s->total_counter;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
case OPT_FUNCTION_NUMBER:
|
||||||
|
ret = read_panel(s, OPT_FUNCTION_NUMBER);
|
||||||
|
*val_p = s->panel_function_number;
|
||||||
|
return ret;
|
||||||
|
|
||||||
case OPT_ADF_LOADED:
|
case OPT_ADF_LOADED:
|
||||||
ret = read_sensors(s,OPT_ADF_LOADED);
|
ret = read_sensors(s,OPT_ADF_LOADED);
|
||||||
*val_p = s->sensor_adf_loaded;
|
*val_p = s->sensor_adf_loaded;
|
||||||
|
@ -3681,11 +3686,6 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
|
||||||
ret = read_sensors(s,OPT_CARD_LOADED);
|
ret = read_sensors(s,OPT_CARD_LOADED);
|
||||||
*val_p = s->sensor_card_loaded;
|
*val_p = s->sensor_card_loaded;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
case OPT_FUNCTION_NUMBER:
|
|
||||||
ret = read_panel(s, OPT_FUNCTION_NUMBER);
|
|
||||||
*val_p = s->panel_function_number;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (action == SANE_ACTION_SET_VALUE) {
|
else if (action == SANE_ACTION_SET_VALUE) {
|
||||||
|
|
|
@ -78,9 +78,9 @@ enum scanner_Option
|
||||||
OPT_COUNTER,
|
OPT_COUNTER,
|
||||||
OPT_ROLLERCOUNTER,
|
OPT_ROLLERCOUNTER,
|
||||||
OPT_TOTALCOUNTER,
|
OPT_TOTALCOUNTER,
|
||||||
|
OPT_FUNCTION_NUMBER,
|
||||||
OPT_ADF_LOADED,
|
OPT_ADF_LOADED,
|
||||||
OPT_CARD_LOADED,
|
OPT_CARD_LOADED,
|
||||||
OPT_FUNCTION_NUMBER,
|
|
||||||
|
|
||||||
/* must come last: */
|
/* must come last: */
|
||||||
NUM_OPTIONS
|
NUM_OPTIONS
|
||||||
|
@ -454,7 +454,7 @@ struct scanner
|
||||||
int total_counter;
|
int total_counter;
|
||||||
|
|
||||||
/* values which are used to track the frontend's access to sensors */
|
/* values which are used to track the frontend's access to sensors */
|
||||||
char panel_read[OPT_COUNTER - OPT_START + 1];
|
char panel_read[OPT_FUNCTION_NUMBER - OPT_START + 1];
|
||||||
char sensors_read[OPT_CARD_LOADED - OPT_ADF_LOADED + 1];
|
char sensors_read[OPT_CARD_LOADED - OPT_ADF_LOADED + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue