add cache expiration time option

merge-requests/1/head
Stphane Voltz 2015-04-12 09:46:26 +02:00
rodzic a039e9efd1
commit 1549a56b75
3 zmienionych plików z 32 dodań i 2 usunięć

Wyświetl plik

@ -157,6 +157,15 @@ static const SANE_Range enhance_range = {
1 /* quantization */
};
/**
* range for expiration time
*/
static const SANE_Range expiration_range = {
-1, /* minimum */
30000, /* maximum */
1 /* quantization */
};
void
sanei_genesys_init_structs (Genesys_Device * dev)
{
@ -5899,6 +5908,17 @@ init_options (Genesys_Scanner * s)
}
#endif
/* expiration time for calibration cache entries */
s->opt[OPT_EXPIRATION_TIME].name = "expiration-time";
s->opt[OPT_EXPIRATION_TIME].title = SANE_I18N ("Calibration cache expiration time");
s->opt[OPT_EXPIRATION_TIME].desc = SANE_I18N ("Time (in minutes) before a cached calibration expires."
"A value of 0 means cache is not used used. A negative value means cache never expires.");
s->opt[OPT_EXPIRATION_TIME].type = SANE_TYPE_INT;
s->opt[OPT_EXPIRATION_TIME].unit = SANE_UNIT_NONE;
s->opt[OPT_EXPIRATION_TIME].constraint_type = SANE_CONSTRAINT_RANGE;
s->opt[OPT_EXPIRATION_TIME].constraint.range = &expiration_range;
s->val[OPT_EXPIRATION_TIME].w = 60; /* 60 minutes by default */
/* Powersave time (turn lamp off) */
s->opt[OPT_LAMP_OFF_TIME].name = "lamp-off-time";
s->opt[OPT_LAMP_OFF_TIME].title = SANE_I18N ("Lamp off time");
@ -7420,6 +7440,7 @@ set_option_value (Genesys_Scanner * s, int option, void *val,
RIE(set_calibration_value (s, option, val));
break;
case OPT_LAMP_OFF_TIME:
case OPT_EXPIRATION_TIME:
if (*(SANE_Word *) val != s->val[option].w)
{
s->val[option].w = *(SANE_Word *) val;

Wyświetl plik

@ -120,6 +120,7 @@ enum Genesys_Option
OPT_DISABLE_INTERPOLATION,
OPT_COLOR_FILTER,
OPT_CALIBRATION_FILE,
OPT_EXPIRATION_TIME,
OPT_SENSOR_GROUP,
OPT_SCAN_SW,

Wyświetl plik

@ -55,10 +55,11 @@ If you plug the scanner in another machine or use it with another account, calib
will have to be redone, unles you use the \-\-calibration\-file option.
If no home directory is defined,
USERAPPPROFILE will be used, then TMPDIR or TMP. If none of these directories exist, the backend will try
to write in the current working directory. Flatbed scanners alos make use of the calibration file as a cache
to write in the current working directory. Flatbed scanners also make use of the calibration file as a cache
to avoid calibration before each scan. Calibration file name is the name of the scanner model if only
one scanner is detected. In the case of several identical model, the file name will be the name
of the logical USB device name.
of the logical USB device name. The expiration time manages the time a calibration is valid in cache.
A value of -1 means forever, 0 means no cache.
.SH EXTRAS SCAN OPTIONS
@ -123,6 +124,13 @@ as root. It maybe used in case of sheet-fed scanners to share a calibration file
users.
.RE
.B \-\-expiration\-time
.RS
Specify the time (in minutes) a cached calibration is considered valid. If older than the given value, a new
calibration is done. A value of -1 means no expiration and cached value are kept forever unless cleared by
userwith the calibration clear option. A value of 0 means cache is disabled.
.RE
.PP
Additionally, several 'software' options are exposed by the backend. These
are reimplementations of features provided natively by larger scanners, but