use expiration time option

- use expiration  time option value to managed cached entries
- changelog for genesys build #2506
merge-requests/1/head
Stphane Voltz 2015-04-12 10:14:50 +02:00
rodzic 1549a56b75
commit f6896e0de4
4 zmienionych plików z 16 dodań i 4 usunięć

Wyświetl plik

@ -1,3 +1,8 @@
2015-04-12 Stéphane Voltz <stef.dev@free.fr>
* doc/sane-genesys.man backend/genesys.[ch] backend/genesys_low.c:
fix calibration cleared when calibration file loaded,
add expiration time option for cache.
2015-04-07 Rolf Bensch <rolf at bensch hyphen online dot de> 2015-04-07 Rolf Bensch <rolf at bensch hyphen online dot de>
* backend/pixma_mp810.c: Canon Pixma MP990 TPU scan patch from Guillaume * backend/pixma_mp810.c: Canon Pixma MP990 TPU scan patch from Guillaume
Courtois. Courtois.

Wyświetl plik

@ -5320,6 +5320,9 @@ calc_parameters (Genesys_Scanner * s)
s->dev->settings.brightness=0; s->dev->settings.brightness=0;
} }
/* cache expiration time */
s->dev->settings.expiration_time=s->val[OPT_EXPIRATION_TIME].w;
return status; return status;
} }

Wyświetl plik

@ -1766,7 +1766,8 @@ int sanei_genesys_get_lowest_dpi(Genesys_Device *dev)
* A calibration cache is compatible if color mode and x dpi match the user * A calibration cache is compatible if color mode and x dpi match the user
* requested scan. In the case of CIS scanners, dpi isn't a criteria. * requested scan. In the case of CIS scanners, dpi isn't a criteria.
* flatbed cache entries are considred too old and then expires if they * flatbed cache entries are considred too old and then expires if they
* are older dans 1h, forcing calcibration at least once an hour. */ * are older than the expiration time option, forcing calibration at least once
* then given time. */
SANE_Status SANE_Status
sanei_genesys_is_compatible_calibration (Genesys_Device * dev, sanei_genesys_is_compatible_calibration (Genesys_Device * dev,
Genesys_Calibration_Cache * cache, Genesys_Calibration_Cache * cache,
@ -1832,13 +1833,13 @@ sanei_genesys_is_compatible_calibration (Genesys_Device * dev,
return SANE_STATUS_UNSUPPORTED; return SANE_STATUS_UNSUPPORTED;
} }
/* a cache entry expires after 60 minutes for non sheetfed scanners */ /* a cache entry expires after afetr expiration time for non sheetfed scanners */
/* this is not taken into account when overwriting cache entries */ /* this is not taken into account when overwriting cache entries */
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
if(for_overwrite == SANE_FALSE) if(for_overwrite == SANE_FALSE && dev->settings.expiration_time >=0)
{ {
gettimeofday (&time, NULL); gettimeofday (&time, NULL);
if ((time.tv_sec - cache->last_calibration > 60 * 60) if ((time.tv_sec - cache->last_calibration > dev->settings.expiration_time*60)
&& (dev->model->is_sheetfed == SANE_FALSE) && (dev->model->is_sheetfed == SANE_FALSE)
&& (dev->settings.scan_method == SCAN_METHOD_FLATBED)) && (dev->settings.scan_method == SCAN_METHOD_FLATBED))
{ {

Wyświetl plik

@ -707,6 +707,9 @@ typedef struct
/**< value for brightness enhancement in the [-100..100] range */ /**< value for brightness enhancement in the [-100..100] range */
int brightness; int brightness;
/**< cahe entries expiration time */
int expiration_time;
} Genesys_Settings; } Genesys_Settings;
typedef struct Genesys_Current_Setup typedef struct Genesys_Current_Setup