diff options
Diffstat (limited to 'dynamite.c')
-rw-r--r-- | dynamite.c | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -118,6 +118,10 @@ cPluginDynamite::~cPluginDynamite() delete cDynamicDevice::idleHook; cDynamicDevice::idleHook = NULL; } + if (cDynamicDevice::attachHook != NULL) { + delete cDynamicDevice::attachHook; + cDynamicDevice::attachHook = NULL; + } if (cDynamicDevice::dvbprobe) { delete cDynamicDevice::dvbprobe; cDynamicDevice::dvbprobe = NULL; @@ -142,6 +146,8 @@ const char *cPluginDynamite::CommandLineHelp(void) " set program to be called on GetTS-timeout\n" " --free-device-slots=n\n" " leave n slots free for non-dynamic devices\n" + " --attach-hook=/path/to/program\n" + " set program to be called on device attach\n" " --idle-hook=/path/to/program\n" " set program to be called on SetIdle and reactivation\n" " --idle-timeout=m\n" @@ -159,6 +165,7 @@ bool cPluginDynamite::ProcessArgs(int argc, char *argv[]) {"GetTSTimeout", required_argument, 0, 't'}, {"GetTSTimeoutHandler", required_argument, 0, 'h'}, {"free-device-slots", required_argument, 0, 'f'}, + {"attach-hook", required_argument, 0, 'a'}, {"idle-hook", required_argument, 0, 'i'}, {"idle-timeout", required_argument, 0, 'I'}, {"idle-wakeup", required_argument, 0, 'W'}, @@ -167,7 +174,7 @@ bool cPluginDynamite::ProcessArgs(int argc, char *argv[]) while (true) { int option_index = 0; - int c = getopt_long(argc, argv, "udt:h:f:i:I:W:", options, &option_index); + int c = getopt_long(argc, argv, "udt:h:f:a:i:I:W:", options, &option_index); if (c == -1) break; switch (c) { @@ -211,6 +218,17 @@ bool cPluginDynamite::ProcessArgs(int argc, char *argv[]) } break; } + case 'a': + { + if (cDynamicDevice::attachHook != NULL) + delete cDynamicDevice::attachHook; + cDynamicDevice::attachHook = NULL; + if (optarg != NULL) { + cDynamicDevice::attachHook = new cString(optarg); + isyslog("dynamite: installing attach-hook %s", **cDynamicDevice::attachHook); + } + break; + } case 'i': { if (cDynamicDevice::idleHook != NULL) @@ -368,6 +386,15 @@ bool cPluginDynamite::SetupParse(const char *Name, const char *Value) else esyslog("dynamite: \"%d\" free device slots is out of range", tmp); } + else if (strcasecmp(Name, "AttachHook") == 0) { + if (cDynamicDevice::attachHook != NULL) + delete cDynamicDevice::attachHook; + cDynamicDevice::attachHook = NULL; + if (Value != NULL) { + cDynamicDevice::attachHook = new cString(Value); + isyslog("dynamite: installing attach-hook %s", **cDynamicDevice::attachHook); + } + } else if (strcasecmp(Name, "IdleHook") == 0) { if (cDynamicDevice::idleHook != NULL) delete cDynamicDevice::idleHook; |