summaryrefslogtreecommitdiff
path: root/dynamicdevice.c
diff options
context:
space:
mode:
authorLars Hanisch <dvb@flensrocker.de>2011-12-04 14:09:59 +0100
committerLars Hanisch <dvb@flensrocker.de>2011-12-04 14:09:59 +0100
commitf140391bee64a89b7bd91230b1ea0b356cc43768 (patch)
tree2215f153838877d0bb162c34cda2fffa3159cd0e /dynamicdevice.c
parentf56577250ffac3ed2aa04b75ea4cfe2d0bf1d0e8 (diff)
downloadvdr-plugin-dynamite-f140391bee64a89b7bd91230b1ea0b356cc43768.tar.gz
vdr-plugin-dynamite-f140391bee64a89b7bd91230b1ea0b356cc43768.tar.bz2
allow disable of auto-idle per device via Service/SVDRP/udevv0.0.8d
Diffstat (limited to 'dynamicdevice.c')
-rw-r--r--dynamicdevice.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/dynamicdevice.c b/dynamicdevice.c
index dc44ed0..7327f55 100644
--- a/dynamicdevice.c
+++ b/dynamicdevice.c
@@ -338,6 +338,27 @@ eDynamicDeviceReturnCode cDynamicDevice::SetIdle(const char *DevPath, bool Idle)
return ddrcSuccess;
}
+eDynamicDeviceReturnCode cDynamicDevice::SetAutoIdle(const char *DevPath, bool Disable)
+{
+ if (!DevPath)
+ return ddrcNotSupported;
+
+ cMutexLock lock(&arrayMutex);
+ int freeIndex = -1;
+ int index = -1;
+ if (isnumber(DevPath))
+ index = strtol(DevPath, NULL, 10) - 1;
+ else
+ index = IndexOf(DevPath, freeIndex, -1);
+
+ if ((index < 0) || (index >= numDynamicDevices))
+ return ddrcNotFound;
+
+ isyslog("dynamite: %s auto-idle mode on device %s", (Disable ? "disable" : "enable"), DevPath);
+ dynamicdevice[index]->disableAutoIdle = Disable;
+ return ddrcSuccess;
+}
+
void cDynamicDevice::AutoIdle(void)
{
if (idleTimeoutMinutes <= 0)
@@ -347,7 +368,7 @@ void cDynamicDevice::AutoIdle(void)
bool wokeupSomeDevice = false;
int seconds = 0;
for (int i = 0; i < numDynamicDevices; i++) {
- if (dynamicdevice[i]->devpath != NULL) {
+ if ((dynamicdevice[i]->devpath != NULL) && !dynamicdevice[i]->disableAutoIdle) {
if (dynamicdevice[i]->IsIdle()) {
seconds = now - dynamicdevice[i]->idleSince;
if ((dynamicdevice[i]->idleSince > 0) && (seconds >= (idleWakeupHours * 3600))) {
@@ -440,7 +461,7 @@ cDynamicDevice::cDynamicDevice()
,getTSTimeoutHandlerArg(NULL)
,isDetachable(true)
,getTSTimeout(defaultGetTSTimeout)
-,restartSectionHandler(false)
+,disableAutoIdle(false)
{
index = numDynamicDevices;
if (numDynamicDevices < MAXDEVICES) {
@@ -479,6 +500,14 @@ void cDynamicDevice::ReadUdevProperties(void)
if (timeoutHandlerArg)
InternSetGetTSTimeoutHandlerArg(timeoutHandlerArg);
+ const char *disableAutoIdleArg = dev->GetPropertyValue("dynamite_disable_autoidle");
+ if (disableAutoIdleArg && ((strcmp(disableAutoIdleArg, "y") == 0)
+ || (strcmp(disableAutoIdleArg, "yes") == 0)
+ || (strcmp(disableAutoIdleArg, "true") == 0)
+ || (strcmp(disableAutoIdleArg, "disable") == 0)
+ || (strcmp(disableAutoIdleArg, "1") == 0)))
+ disableAutoIdle = true;
+
cUdevDevice *p = dev->GetParent();
if (p) {
const char *subsystem = p->GetSubsystem();
@@ -544,6 +573,7 @@ void cDynamicDevice::DeleteSubDevice()
}
isDetachable = true;
getTSTimeout = defaultGetTSTimeout;
+ disableAutoIdle = false;
}
bool cDynamicDevice::SetIdleDevice(bool Idle, bool TestOnly)