Merge branch 'canon_dr_add_sensor_function_number' into 'master'

canon_dr: Function-number support on Canon DR-3010C

See merge request sane-project/backends!843
734-support-for-canon-i-sensys-mf657cdw-mf650c-series
Ralph Little 2024-09-12 18:20:29 +00:00
commit 5c327b10e9
3 zmienionych plików z 29 dodań i 1 usunięć

Wyświetl plik

@ -247,6 +247,7 @@ putnbyte (unsigned char *pnt, unsigned int value, unsigned int nbytes)
#define get_R_PANEL_count_only(in) getbitfield(in+1, 1, 1)
#define get_R_PANEL_bypass_mode(in) getbitfield(in+1, 1, 2)
#define get_R_PANEL_enable_led(in) getbitfield(in+2, 1, 0)
#define get_R_PANEL_function_number(in) getbitfield(in+3, 0xf, 0)
#define get_R_PANEL_counter(in) getnbyte(in + 0x04, 4)
/*sensors*/

Wyświetl plik

@ -464,6 +464,7 @@
#define STRING_IMPRINTER_ADDON_BoI SANE_I18N("Black-on-Image")
#define STRING_IMPRINTER_ADDON_WoB SANE_I18N("White-on-Black")
/* Also set via config file. */
static int global_buffer_size;
static int global_buffer_size_default = 2 * 1024 * 1024;
@ -1564,6 +1565,7 @@ init_model (struct scanner *s)
s->fcal_dest = FCAL_DEST_SW;
s->sw_lut = 1;
s->invert_tly = 1;
s->has_function_number = 1;
/*only in Y direction, so we trash them in X*/
s->std_res_x[DPI_100]=0;
@ -3214,6 +3216,22 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
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){
opt->name = "adf-loaded";
opt->title = "ADF Loaded";
@ -3654,6 +3672,11 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
*val_p = s->total_counter;
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:
ret = read_sensors(s,OPT_ADF_LOADED);
*val_p = s->sensor_adf_loaded;
@ -4674,6 +4697,7 @@ read_panel(struct scanner *s,SANE_Int option)
s->panel_bypass_mode = get_R_PANEL_bypass_mode(in);
s->panel_enable_led = get_R_PANEL_enable_led(in);
s->panel_counter = get_R_PANEL_counter(in);
s->panel_function_number = get_R_PANEL_function_number(in);
ret = SANE_STATUS_GOOD;
}

Wyświetl plik

@ -78,6 +78,7 @@ enum scanner_Option
OPT_COUNTER,
OPT_ROLLERCOUNTER,
OPT_TOTALCOUNTER,
OPT_FUNCTION_NUMBER,
OPT_ADF_LOADED,
OPT_CARD_LOADED,
@ -250,6 +251,7 @@ struct scanner
int has_hwcrop;
int has_pre_imprinter;
int has_post_imprinter;
int has_function_number;
int can_read_sensors;
int can_read_panel;
int can_write_panel;
@ -445,13 +447,14 @@ struct scanner
int panel_bypass_mode;
int panel_enable_led;
int panel_counter;
int panel_function_number;
int sensor_adf_loaded;
int sensor_card_loaded;
int roller_counter;
int total_counter;
/* 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];
};