summaryrefslogtreecommitdiff
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
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
-rw-r--r--HISTORY4
-rw-r--r--README20
-rw-r--r--dynamicdevice.c34
-rw-r--r--dynamicdevice.h3
-rw-r--r--dynamite.c38
-rw-r--r--menu.c9
-rw-r--r--po/cs_CZ.po8
-rw-r--r--po/de_DE.po8
-rw-r--r--po/it_IT.po8
9 files changed, 124 insertions, 8 deletions
diff --git a/HISTORY b/HISTORY
index 1a6c73b..3372c18 100644
--- a/HISTORY
+++ b/HISTORY
@@ -200,3 +200,7 @@ VDR Plugin 'dynamite' Revision History
2011-10-27: Version 0.0.8c
- correct call of the idle hook
+
+2011-12-04: Version 0.0.8d
+
+- allow disable of auto-idle per device via Service/SVDRP/udev
diff --git a/README b/README
index defaafa..2e43776 100644
--- a/README
+++ b/README
@@ -128,6 +128,14 @@ SetIdle /dev/path/to/device
SetNotIdle /dev/path/to/device
Revoke the idle state of the device
+"dynamite-DisableAutoIdle-v0.1"
+DisableAutoIdle /dev/path/to/device
+ Disables the auto-idle feature on this device
+
+"dynamite-EnableAutoIdle-v0.1"
+EnableAutoIdle /dev/path/to/device
+ Enables the auto-idle feature on this device if the timeout configured
+
(no Service-interface)
LSTD
Lists all devices managed by this plugin. The first column is an id,
@@ -189,6 +197,7 @@ The main menu item "dynamite" offers the following possibilities:
- scan for new DVB devices
- detach device
- lock/unlock device
+- disable/enable auto-idle of device
- switch device to idle
Signals emitted via cPluginManager::CallAllServices
@@ -252,6 +261,9 @@ OpenDvr got called at all).
After a minimum of "idle-wakeup" hours the device will be reactivated so it can
be used by the EIT scanner or similar modules. The wakeup cannot be disabled,
only a minimum of one hour can be specified.
+If there are problems with the auto-idle mode on some devices but you want to use
+it on your other devices you can disable it per device via "Service", SVDRP or
+udev (see below).
"GetTS" watchdog
----------------
@@ -276,6 +288,7 @@ ACTION=="add", SUBSYSTEM=="dvb", ENV{DVB_DEVICE_TYPE}=="frontend" \
, ENV{dynamite_cardindex}="5" \
, ENV{dynamite_timeout}="10" \
, ENV{dynamite_timeout_handler_arg}="%k"
+ , ENV{dynamite_disable_autoidle}="no"
After the device is detached and dynamite.GetTSTimeoutHandler in setup.conf is set
to a path, this program is called. If the udev-property "dynamite_timeout_handler_arg"
@@ -287,7 +300,7 @@ Attaching of devices can be controlled with some udev device properties which ca
set by a udev rule (see example above).
dynamite_attach
- "no", "n", "0", "ignore": don't attach this device, every other string will be like "yes"
+ "no", "n", "0", "ignore": don't attach this device, any other string will be like "yes"
dynamite_instanceid
n: attach only at vdr with matching instance id
@@ -295,6 +308,11 @@ dynamite_instanceid
dynamite_cardindex
n: if possible attach at slot with given cardindex
+dynamite_disable_autoidle
+ "yes", "y", "disable", "true", "1": disable the auto-idle feature on this device, any other
+ string or missing of this property will activate the
+ auto-idle feature if configured
+
dynamite_timeout
n: set GetTS timeout in seconds on this device
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)
diff --git a/dynamicdevice.h b/dynamicdevice.h
index 500c40b..e8acb9d 100644
--- a/dynamicdevice.h
+++ b/dynamicdevice.h
@@ -42,6 +42,7 @@ public:
static eDynamicDeviceReturnCode DetachDevice(const char *DevPath, bool Force);
static eDynamicDeviceReturnCode SetLockDevice(const char *DevPath, bool Lock);
static eDynamicDeviceReturnCode SetIdle(const char *DevPath, bool Idle);
+ static eDynamicDeviceReturnCode SetAutoIdle(const char *DevPath, bool Disable);
static void AutoIdle(void);
static eDynamicDeviceReturnCode SetGetTSTimeout(const char *DevPath, int Seconds);
static void SetDefaultGetTSTimeout(int Seconds);
@@ -55,7 +56,7 @@ private:
bool isDetachable;
time_t getTSWatchdog;
int getTSTimeout;
- bool restartSectionHandler;
+ bool disableAutoIdle;
time_t lastCloseDvr; // for auto-idle
time_t idleSince;
void ReadUdevProperties(void);
diff --git a/dynamite.c b/dynamite.c
index 2519ab9..e1bd370 100644
--- a/dynamite.c
+++ b/dynamite.c
@@ -10,7 +10,7 @@
#include "menu.h"
#include "monitor.h"
-static const char *VERSION = "0.0.8c";
+static const char *VERSION = "0.0.8d";
static const char *DESCRIPTION = tr("attach/detach devices on the fly");
static const char *MAINMENUENTRY = NULL;
@@ -425,6 +425,16 @@ bool cPluginDynamite::Service(const char *Id, void *Data)
cDynamicDevice::SetIdle((const char*)Data, false);
return true;
}
+ if (strcmp(Id, "dynamite-DisableAutoIdle-v0.1") == 0) {
+ if (Data != NULL)
+ cDynamicDevice::SetAutoIdle((const char*)Data, true);
+ return true;
+ }
+ if (strcmp(Id, "dynamite-EnableAutoIdle-v0.1") == 0) {
+ if (Data != NULL)
+ cDynamicDevice::SetAutoIdle((const char*)Data, false);
+ return true;
+ }
if (strcmp(Id, "dynamite-SetGetTSTimeout-v0.1") == 0) {
if (Data != NULL) {
int replyCode;
@@ -517,6 +527,10 @@ const char **cPluginDynamite::SVDRPHelpPages(void)
" and can close all its handles",
"SetNotIdle /dev/path/to/device\n"
" Revoke the idle state of the device",
+ "DisableAutoIdle /dev/path/to/device\n"
+ " disables the auto-idle mode on this device if configured",
+ "EnableAutoIdle /dev/path/to/device\n"
+ " enables the auto-idle mode on this device if configured",
"LSTD\n"
" Lists all devices managed by this plugin. The first column is an id,\n"
" the second column is the devicepath passed with ATTD\n"
@@ -633,6 +647,28 @@ cString cPluginDynamite::SVDRPCommand(const char *Command, const char *Option, i
}
}
+ int autoidle = 0;
+ if (strcasecmp(Command, "DisableAutoIdle") == 0)
+ autoidle = 1;
+ else if (strcasecmp(Command, "EnableAutoIdle") == 0)
+ autoidle = 2;
+ if (autoidle > 0) {
+ switch (cDynamicDevice::SetAutoIdle(Option, (autoidle == 1))) {
+ case ddrcSuccess:
+ return cString::sprintf("%s auto-idle mode on device %s", (autoidle == 1 ? "disabled" : "enabled"), Option);
+ case ddrcNotFound:
+ {
+ ReplyCode = 550;
+ return cString::sprintf("device %s not found", Option);
+ }
+ default:
+ {
+ ReplyCode = 550;
+ return cString::sprintf("can't %s auto-idle mode on device %s and I don't know why...", (autoidle == 1 ? "disable" : "enable"), Option);
+ }
+ }
+ }
+
if ((strcasecmp(Command, "SGTT") == 0) || (strcasecmp(Command, "SetGetTSTimeout") == 0)) {
cString ret;
int len = strlen(Option);
diff --git a/menu.c b/menu.c
index 2039965..1c7b13c 100644
--- a/menu.c
+++ b/menu.c
@@ -37,6 +37,8 @@ enum eMenuAction { maList,
maDetach,
maLock,
maUnlock,
+ maDisableAutoIdle,
+ maEnableAutoIdle,
maSetIdle
};
@@ -69,6 +71,11 @@ public:
isyslog("dynamite: menu action: %slock device %s", (action == maUnlock ? "un" : ""), DevPath);
cDynamicDevice::SetLockDevice(DevPath, action == maLock);
break;
+ case maDisableAutoIdle:
+ case maEnableAutoIdle:
+ isyslog("dynamite: menu action: %s auto-idle mode on device %s", (action == maDisableAutoIdle ? "disable" : "enable"), DevPath);
+ cDynamicDevice::SetAutoIdle(DevPath, action == maDisableAutoIdle);
+ break;
case maSetIdle:
isyslog("dynamite: menu action: set idle mode on device %s", DevPath);
cDynamicDevice::SetIdle(DevPath, true);
@@ -87,6 +94,8 @@ cDynamiteMainMenu::cDynamiteMainMenu(void)
Add(new cDynamiteMenuItem(maDetach, tr("detach device")));
Add(new cDynamiteMenuItem(maLock, tr("disable detach of device")));
Add(new cDynamiteMenuItem(maUnlock, tr("enable detach of device")));
+ Add(new cDynamiteMenuItem(maDisableAutoIdle, tr("disable auto-idle mode of device")));
+ Add(new cDynamiteMenuItem(maEnableAutoIdle, tr("enable auto-idle mode of device")));
Add(new cDynamiteMenuItem(maSetIdle, tr("switch device to idle")));
}
diff --git a/po/cs_CZ.po b/po/cs_CZ.po
index 846f67c..fe83dfc 100644
--- a/po/cs_CZ.po
+++ b/po/cs_CZ.po
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: cs_CZ\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2011-09-21 17:42+0200\n"
+"POT-Creation-Date: 2011-12-04 13:57+0100\n"
"PO-Revision-Date: 2011-10-31 16:27+0100\n"
"Last-Translator: Radek Stastny <dedkus@gmail.com>\n"
"Language-Team: \n"
@@ -37,5 +37,11 @@ msgstr "blokovat odpojení zařízení"
msgid "enable detach of device"
msgstr "povolit odpojení zařízení"
+msgid "disable auto-idle mode of device"
+msgstr "disable auto-idle mode of device"
+
+msgid "enable auto-idle mode of device"
+msgstr "enable auto-idle mode of device"
+
msgid "switch device to idle"
msgstr "nevyužívat zařízení"
diff --git a/po/de_DE.po b/po/de_DE.po
index e114a90..db81954 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: de_DE\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2011-09-21 17:42+0200\n"
+"POT-Creation-Date: 2011-12-04 13:57+0100\n"
"PO-Revision-Date: 2011-03-26 16:27+0100\n"
"Last-Translator: Lars Hanisch <dvb@flensrocker.de>\n"
"Language-Team: Deutsch <kde-i18n-de@kde.org>\n"
@@ -42,5 +42,11 @@ msgstr "Gerät vor Aushängen schützen"
msgid "enable detach of device"
msgstr "Gerät zum Aushängen freigeben"
+msgid "disable auto-idle mode of device"
+msgstr "Auto-Idle deaktivieren für Gerät"
+
+msgid "enable auto-idle mode of device"
+msgstr "Auto-Idle aktivieren für Gerät"
+
msgid "switch device to idle"
msgstr "Gerät schlafen legen"
diff --git a/po/it_IT.po b/po/it_IT.po
index 6fd476d..9a3ce0a 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2011-09-21 17:42+0200\n"
+"POT-Creation-Date: 2011-12-04 13:57+0100\n"
"PO-Revision-Date: 2011-07-09 23:22+0100\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: \n"
@@ -45,5 +45,11 @@ msgstr "Disabilita scollegamento dispositivi"
msgid "enable detach of device"
msgstr "Abilita scollegamento dispositivi"
+msgid "disable auto-idle mode of device"
+msgstr "disable auto-idle mode of device"
+
+msgid "enable auto-idle mode of device"
+msgstr "enable auto-idle mode of device"
+
msgid "switch device to idle"
msgstr "Imposta dispositivo in attesa"