summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Hanisch <dvb@flensrocker.de>2011-09-04 14:16:57 +0200
committerLars Hanisch <dvb@flensrocker.de>2011-09-04 14:16:57 +0200
commit0f4e514ea0a35f2fea6638fac2c2d85337aeb0d8 (patch)
treee3944769afb101f8d44c57b977d8efc9b5f2e2d2
parent86d5f945564ee3f6e30f29396c14ce6bcdc02146 (diff)
downloadvdr-plugin-dynamite-0f4e514ea0a35f2fea6638fac2c2d85337aeb0d8.tar.gz
vdr-plugin-dynamite-0f4e514ea0a35f2fea6638fac2c2d85337aeb0d8.tar.bz2
correct timeout evaluation for auto-idlev0.0.7b
-rw-r--r--HISTORY4
-rw-r--r--dynamicdevice.c9
-rw-r--r--dynamite.c2
3 files changed, 11 insertions, 4 deletions
diff --git a/HISTORY b/HISTORY
index ea0b105..f2e0dbf 100644
--- a/HISTORY
+++ b/HISTORY
@@ -176,3 +176,7 @@ VDR Plugin 'dynamite' Revision History
- add two new parameters to activate the auto-idle-mode
--idle-timout=m set unused devices after m minutes to idle
--idle-wakeup=h waheup idle devices after h hours
+
+2011-09-04: Version 0.0.7b
+
+- correct timeout evaluation for auto-idle
diff --git a/dynamicdevice.c b/dynamicdevice.c
index e0dc250..5191846 100644
--- a/dynamicdevice.c
+++ b/dynamicdevice.c
@@ -342,7 +342,7 @@ void cDynamicDevice::AutoIdle(void)
for (int i = 0; i < numDynamicDevices; i++) {
if (dynamicdevice[i]->devpath != NULL) {
if (dynamicdevice[i]->IsIdle()) {
- int hours = 3600 * (now - dynamicdevice[i]->idleSince);
+ int hours = (now - dynamicdevice[i]->idleSince) / 3600;
if ((dynamicdevice[i]->idleSince > 0) && (hours >= idleWakeupHours)) {
isyslog("dynamite: device %s idle for %d hours, waking up", dynamicdevice[i]->GetDevPath(), hours);
cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcService, *cString::sprintf("dynamite-SetNotIdle-v0.1 %s", dynamicdevice[i]->GetDevPath()));
@@ -350,9 +350,12 @@ void cDynamicDevice::AutoIdle(void)
}
}
else {
- int minutes = 60 * (now - dynamicdevice[i]->lastCloseDvr);
+ int minutes = (now - dynamicdevice[i]->lastCloseDvr) / 60;
if ((dynamicdevice[i]->lastCloseDvr > 0) && (minutes >= idleTimeoutMinutes)) {
- isyslog("dynamite: device %s unused for %d minutes, set to idle", dynamicdevice[i]->GetDevPath(), minutes);
+ if (dynamicdevice[i]->lastCloseDvr > 0)
+ isyslog("dynamite: device %s unused for %d minutes, set to idle", dynamicdevice[i]->GetDevPath(), minutes);
+ else
+ isyslog("dynamite: device %s never used , set to idle", dynamicdevice[i]->GetDevPath());
cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcService, *cString::sprintf("dynamite-SetIdle-v0.1 %s", dynamicdevice[i]->GetDevPath()));
}
}
diff --git a/dynamite.c b/dynamite.c
index 12637c5..fd2a813 100644
--- a/dynamite.c
+++ b/dynamite.c
@@ -10,7 +10,7 @@
#include "menu.h"
#include "monitor.h"
-static const char *VERSION = "0.0.7a";
+static const char *VERSION = "0.0.7b";
static const char *DESCRIPTION = tr("attach/detach devices on the fly");
static const char *MAINMENUENTRY = NULL;