kopia lustrzana https://gitlab.com/sane-project/backends
make calibration cache expire after one hour
rodzic
413f0df3a1
commit
ea95ab9b7f
|
@ -3952,6 +3952,9 @@ gl847_is_compatible_calibration (Genesys_Device * dev,
|
||||||
Genesys_Calibration_Cache * cache,
|
Genesys_Calibration_Cache * cache,
|
||||||
int for_overwrite)
|
int for_overwrite)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_SYS_TIME_H
|
||||||
|
struct timeval time;
|
||||||
|
#endif
|
||||||
SANE_Status status;
|
SANE_Status status;
|
||||||
|
|
||||||
DBG (DBG_proc, "gl847_is_compatible_calibration\n");
|
DBG (DBG_proc, "gl847_is_compatible_calibration\n");
|
||||||
|
@ -3971,6 +3974,19 @@ gl847_is_compatible_calibration (Genesys_Device * dev,
|
||||||
if (dev->current_setup.half_ccd != cache->used_setup.half_ccd)
|
if (dev->current_setup.half_ccd != cache->used_setup.half_ccd)
|
||||||
return SANE_STATUS_UNSUPPORTED;
|
return SANE_STATUS_UNSUPPORTED;
|
||||||
|
|
||||||
|
/* a cache entry expires after 60 minutes for non sheetfed scanners */
|
||||||
|
#ifdef HAVE_SYS_TIME_H
|
||||||
|
gettimeofday (&time, NULL);
|
||||||
|
if ((time.tv_sec - cache->last_calibration > 60 * 60)
|
||||||
|
&& (dev->model->is_sheetfed == SANE_FALSE)
|
||||||
|
&& (dev->settings.scan_method == SCAN_METHOD_FLATBED))
|
||||||
|
{
|
||||||
|
DBG (DBG_proc,
|
||||||
|
"gl847_is_compatible_calibration: expired entry, non compatible cache\n");
|
||||||
|
return SANE_STATUS_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
DBG (DBG_proc, "gl847_is_compatible_calibration: completed\n");
|
DBG (DBG_proc, "gl847_is_compatible_calibration: completed\n");
|
||||||
|
|
||||||
return SANE_STATUS_GOOD;
|
return SANE_STATUS_GOOD;
|
||||||
|
|
Ładowanie…
Reference in New Issue