summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY5
-rw-r--r--README11
-rw-r--r--dynamicdevice.h2
-rw-r--r--dynamite.c36
4 files changed, 37 insertions, 17 deletions
diff --git a/HISTORY b/HISTORY
index c415997..3ade3e3 100644
--- a/HISTORY
+++ b/HISTORY
@@ -103,3 +103,8 @@ VDR Plugin 'dynamite' Revision History
- move reading of udev properties from the monitor to the attacher,
so that they are recognized on devices present at startup.
+
+2011-02-26: Version 0.0.5k-rc1
+
+- while in cDvbDeviceProbe create only as much cDynamicDevice-objects as needed
+- create dummy-device-probe only if specified on command line option "--dummy-probe"
diff --git a/README b/README
index e8e6c96..a417076 100644
--- a/README
+++ b/README
@@ -161,6 +161,11 @@ Parameters in setup.conf
dynamite.DefaultGetTSTimeout = 0
dynamite.GetTSTimeoutHandler = /path/to/program
+Commandline Arguments
+---------------------
+--log-udev log all udev events to syslog (useful for diagnostics)
+--dummy-probe start dummy-device probe (useful for experiments)
+
"GetTS" watchdog
----------------
Some DVB cards are known to be unstable - sometimes their driver just hangs
@@ -172,11 +177,11 @@ will automatically detach this device if its GetTSPacket method returns
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.
+You can use the GetTSTimeoutHandler set in setup.conf for this.
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!
+
example for udev rule:
ACTION=="add", SUBSYSTEM=="dvb", ENV{DVB_DEVICE_TYPE}=="frontend", ENV{dynamite_timeout}="10", ENV{dynamite_timeout_handler_arg}="%k"
@@ -194,6 +199,4 @@ me how to do this...
TODO
----
-* implement interface for other plugins to use the udev monitor
-* enumerate udev-properties on devices found at startup
* implement some OSD functionality for detaching, locking etc.
diff --git a/dynamicdevice.h b/dynamicdevice.h
index 2f90a73..36fb12d 100644
--- a/dynamicdevice.h
+++ b/dynamicdevice.h
@@ -23,9 +23,9 @@ private:
static int numDynamicDevices;
static cMutex arrayMutex;
static cDynamicDevice *dynamicdevice[MAXDEVICES];
- static int IndexOf(const char *DevPath, int &NextFreeIndex);
public:
static cDvbDeviceProbe *dvbprobe;
+ static int IndexOf(const char *DevPath, int &NextFreeIndex);
static int NumDynamicDevices(void) { return numDynamicDevices; }
///< Returns the total number of dynamic devices.
static bool ProcessQueuedCommands(void);
diff --git a/dynamite.c b/dynamite.c
index 01d79f3..c3c80c1 100644
--- a/dynamite.c
+++ b/dynamite.c
@@ -8,7 +8,7 @@
#include "dynamicdevice.h"
#include "monitor.h"
-static const char *VERSION = "0.0.5j";
+static const char *VERSION = "0.0.5k-rc1";
static const char *DESCRIPTION = "attach/detach devices on the fly";
static const char *MAINMENUENTRY = NULL;
@@ -18,10 +18,16 @@ private:
public:
virtual bool Probe(int Adapter, int Frontend)
{
- if (firstProbe) {
- firstProbe = false;
- while (cDevice::NumDevices() < MAXDVBDEVICES)
- new cDynamicDevice;
+ cString devpath = cString::sprintf("/dev/dvb/adapter%d/frontend%d", Adapter, Frontend);
+ int freeIndex = -1;
+ if (cDynamicDevice::IndexOf(*devpath, freeIndex) >= 0) // already attached - should not happen
+ return true;
+ if (freeIndex < 0) {
+ if ((cDevice::NumDevices() >= MAXDEVICES) || (cDynamicDevice::NumDynamicDevices() >= MAXDEVICES)) {
+ esyslog("dynamite: too many dvb-devices, vdr supports only %d devices - increase MAXDEVICES and recompile vdr", MAXDEVICES);
+ return false;
+ }
+ new cDynamicDevice;
}
isyslog("dynamite: grab dvb device %d/%d", Adapter, Frontend);
cDynamicDevice::AttachDevice(*cString::sprintf("/dev/dvb/adapter%d/frontend%d", Adapter, Frontend));
@@ -76,15 +82,15 @@ public:
};
cPluginDynamite::cPluginDynamite(void)
-:getTSTimeoutHandler(NULL)
+:probe(NULL)
+,getTSTimeoutHandler(NULL)
{
cDynamicDevice::dynamite = this;
cDynamicDevice::dvbprobe = new cDynamiteDvbDeviceProbe;
- // make sure we're the first one you cares for dvbdevices
+ // make sure we're the first one who cares for dvbdevices
cDvbDeviceProbe *firstDvbProbe = DvbDeviceProbes.First();
if (firstDvbProbe != cDynamicDevice::dvbprobe)
DvbDeviceProbes.Move(cDynamicDevice::dvbprobe, firstDvbProbe);
- probe = new cDynamiteDeviceProbe;
cUdevMonitor::AddFilter("dvb", new cUdevDvbFilter());
}
@@ -102,7 +108,8 @@ cPluginDynamite::~cPluginDynamite()
const char *cPluginDynamite::CommandLineHelp(void)
{
- return " --log-udev log all udev events to syslog (useful for diagnostics)\n";
+ return " --log-udev log all udev events to syslog (useful for diagnostics)\n"
+ " --dummy-probe start dummy-device probe";
}
bool cPluginDynamite::ProcessArgs(int argc, char *argv[])
@@ -110,6 +117,8 @@ bool cPluginDynamite::ProcessArgs(int argc, char *argv[])
for (int i = 0; i < argc; i++) {
if (strcmp(argv[i], "--log-udev") == 0)
cUdevMonitor::AddFilter(NULL, new cUdevLogFilter());
+ if ((strcmp(argv[i], "--dummy-probe") == 0) && (probe == NULL))
+ probe = new cDynamiteDeviceProbe;
}
return true;
}
@@ -117,8 +126,11 @@ bool cPluginDynamite::ProcessArgs(int argc, char *argv[])
bool cPluginDynamite::Initialize(void)
{
// create dynamic devices
- while (cDevice::NumDevices() < MAXDEVICES)
- new cDynamicDevice;
+ if (cDevice::NumDevices() < MAXDEVICES) {
+ isyslog("dynamite: creating dynamic device slots as much as possible");
+ while (cDevice::NumDevices() < MAXDEVICES)
+ new cDynamicDevice;
+ }
if (!cDynamicDevice::ProcessQueuedCommands())
esyslog("dynamite: can't process all queued commands");
return true;
@@ -184,7 +196,7 @@ bool cPluginDynamite::SetupParse(const char *Name, const char *Value)
getTSTimeoutHandler = NULL;
if (Value != NULL) {
getTSTimeoutHandler = new cString(Value);
- isyslog("dynamite: installed GetTSTimeoutHandler %s", **getTSTimeoutHandler);
+ isyslog("dynamite: installing GetTSTimeoutHandler %s", **getTSTimeoutHandler);
}
}
else