diff options
author | Lars Hanisch <dvb@flensrocker.de> | 2011-02-10 01:15:50 +0100 |
---|---|---|
committer | Lars Hanisch <dvb@flensrocker.de> | 2011-02-10 01:15:50 +0100 |
commit | ae8c622c7d0d8874cfcd6466ba8df454f0e07794 (patch) | |
tree | 6055e79f0e0ecb6fd6a4bcfa451b931fab507287 | |
parent | cad49874dc168a01fe63021329962309bbb8aed1 (diff) | |
download | vdr-plugin-dynamite-ae8c622c7d0d8874cfcd6466ba8df454f0e07794.tar.gz vdr-plugin-dynamite-ae8c622c7d0d8874cfcd6466ba8df454f0e07794.tar.bz2 |
add parsing of watchdog timeout set by udev rule
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | dynamicdevice.c | 16 | ||||
-rw-r--r-- | dynamicdevice.h | 3 | ||||
-rw-r--r-- | dynamite.c | 3 | ||||
-rw-r--r-- | monitor.c | 3 | ||||
-rw-r--r-- | patches/vdr-1.7.16-dynamite-subdevice.patch | 4 |
6 files changed, 31 insertions, 3 deletions
@@ -155,6 +155,11 @@ no data for this period of time. WARNING: You have to attach this device manually again! For now there's no automatism to reload the driver (or whatever is needed) to reanimate the device. +If you want to add a timeout only to specific devices you can do this with udev. +Add a rule which sets with ENV{dynamite_timeout}="10" the needed timeout value. +The udev-monitor in dynamite will evaluate this device-property. +For now this only works for attaching via udev-monitor! + Known issues ------------ If a device managed by this plugin is the primary device it cannot be diff --git a/dynamicdevice.c b/dynamicdevice.c index f918b22..c7841f0 100644 --- a/dynamicdevice.c +++ b/dynamicdevice.c @@ -2,6 +2,7 @@ #include <glob.h> #include <vdr/transfer.h> +cPlugin *cDynamicDevice::dynamite = NULL; int cDynamicDevice::defaultGetTSTimeout = 0; cDvbDeviceProbe *cDynamicDevice::dvbprobe = NULL; int cDynamicDevice::numDynamicDevices = 0; @@ -40,6 +41,21 @@ bool cDynamicDevice::ProcessQueuedCommands(void) DetachDevice(*dev->devpath); break; } + case ddpcService: + { + if (dynamite && (dev->devpath != NULL) && (**dev->devpath != NULL)) { + int len = strlen(*dev->devpath); + if (len > 0) { + char *data = strchr(const_cast<char*>(**dev->devpath), ' '); + if (data != NULL) { + data[0] = '\0'; + data++; + dynamite->Service(*dev->devpath, data); + } + } + } + break; + } } } cDynamicDeviceProbe::commandQueue.Clear(); diff --git a/dynamicdevice.h b/dynamicdevice.h index 1fe9831..e499774 100644 --- a/dynamicdevice.h +++ b/dynamicdevice.h @@ -2,6 +2,7 @@ #define __DYNAMITEDEVICE_H #include <vdr/dvbdevice.h> +#include <vdr/plugin.h> enum eDynamicDeviceReturnCode { ddrcSuccess, ddrcNoFreeDynDev, @@ -14,7 +15,9 @@ enum eDynamicDeviceReturnCode { ddrcSuccess, }; class cDynamicDevice : public cDevice { + friend class cPluginDynamite; private: + static cPlugin *dynamite; static int defaultGetTSTimeout; static int numDynamicDevices; @@ -8,7 +8,7 @@ #include "dynamicdevice.h" #include "monitor.h" -static const char *VERSION = "0.0.5e"; +static const char *VERSION = "0.0.5f"; static const char *DESCRIPTION = "attach/detach devices on the fly"; static const char *MAINMENUENTRY = NULL; @@ -76,6 +76,7 @@ public: cPluginDynamite::cPluginDynamite(void) { + cDynamicDevice::dynamite = this; cDynamicDevice::dvbprobe = new cDynamiteDvbDeviceProbe; // make sure we're the first one you cares for dvbdevices cDvbDeviceProbe *firstDvbProbe = DvbDeviceProbes.First(); @@ -216,6 +216,9 @@ void cUdevDvbFilter::Process(cUdevDevice &Device) if (!devname || cDynamicDevice::IsAttached(devname)) return; cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcAttach, devname); + const char *timeout = Device.GetPropertyValue("dynamite_timeout"); + if (timeout) + cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcService, *cString::sprintf("dynamite-SetGetTSTimeout-v0.1 %s %s", devname, timeout)); } } diff --git a/patches/vdr-1.7.16-dynamite-subdevice.patch b/patches/vdr-1.7.16-dynamite-subdevice.patch index 16e7264..60b023b 100644 --- a/patches/vdr-1.7.16-dynamite-subdevice.patch +++ b/patches/vdr-1.7.16-dynamite-subdevice.patch @@ -154,7 +154,7 @@ index 681049b..c758390 100644 + DynamicDeviceProbes.Del(this, false); +} diff --git a/device.h b/device.h -index cb3bc2c..8364e73 100644 +index cb3bc2c..fc0e5c5 100644 --- a/device.h +++ b/device.h @@ -163,7 +163,6 @@ private: @@ -241,7 +241,7 @@ index cb3bc2c..8364e73 100644 + +#define __DYNAMIC_DEVICE_PROBE + -+enum eDynamicDeviceProbeCommand { ddpcAttach, ddpcDetach }; ++enum eDynamicDeviceProbeCommand { ddpcAttach, ddpcDetach, ddpcService }; + +class cDynamicDeviceProbe : public cListObject { + friend class cDynamicDevice; |