diff -Nru vdr-plugin-cecremote-1.4.0+git20161110/cecremote.cc vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/cecremote.cc --- vdr-plugin-cecremote-1.4.0+git20161110/cecremote.cc 2016-11-10 15:15:59.000000000 +0000 +++ vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/cecremote.cc 2017-10-03 11:28:11.000000000 +0000 @@ -15,6 +15,7 @@ #include // We need this for cecloader.h #include +#include using namespace std; #include @@ -259,6 +260,10 @@ cec_logical_address addr; eKeys k; + // Allow some delay before the first connection to the CEC Adapter. + if (mStartupDelay > 0) { + sleep(mStartupDelay); + } Connect(); Dsyslog("cCECRemote start worker thread"); @@ -414,7 +419,8 @@ cThread("CEC receiver"), mProcessedSerial(-1), mDevicesFound(0), - mInExec(false) + mInExec(false), + mDeferredStartup(false) { mPlugin = plugin; mCECAdapter = NULL; @@ -428,6 +434,7 @@ mDeviceTypes = options.mDeviceTypes; mShutdownOnStandby = options.mShutdownOnStandby; mPowerOffOnStandby = options.mPowerOffOnStandby; + mStartupDelay = options.mStartupDelay; SetDescription("CEC Action Thread"); @@ -438,12 +445,17 @@ void cCECRemote::Startup() { - Csyslog("cCECRemote Startup"); - - if (mPlugin->GetStartManually()) { - PushCmdQueue(mOnManualStart); + if (mCECAdapter == NULL) { + Csyslog("cCECRemote Delayed Startup"); + mDeferredStartup = true; + } + else { + Csyslog("cCECRemote Startup"); + if (mPlugin->GetStartManually()) { + PushCmdQueue(mOnManualStart); + } + PushCmdQueue(mOnStart); } - PushCmdQueue(mOnStart); } void cCECRemote::Connect() @@ -545,6 +557,7 @@ mCECAdapter = NULL; return; } + Csyslog("END cCECRemote::Open OK"); cec_logical_addresses devices = mCECAdapter->GetActiveDevices(); for (int j = 0; j < 16; j++) @@ -571,6 +584,11 @@ } } Csyslog("END cCECRemote::Initialize"); + + if (mDeferredStartup) { + mDeferredStartup = false; + Startup(); + } } void cCECRemote::Disconnect() diff -Nru vdr-plugin-cecremote-1.4.0+git20161110/cecremote.h vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/cecremote.h --- vdr-plugin-cecremote-1.4.0+git20161110/cecremote.h 2016-11-10 15:15:59.000000000 +0000 +++ vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/cecremote.h 2017-10-03 11:28:11.000000000 +0000 @@ -48,12 +48,12 @@ void Reconnect(void); void Stop(void); void Startup(void); - ICECAdapter *mCECAdapter; private: static const char *VDRNAME; int mCECLogLevel; int mProcessedSerial; + int mStartupDelay; uint8_t mDevicesFound; uint8_t mHDMIPort; cec_logical_address mBaseDevice; @@ -77,6 +77,7 @@ bool mShutdownOnStandby; bool mPowerOffOnStandby; bool mInExec; + bool mDeferredStartup; cPluginCecremote *mPlugin; void Connect(void); diff -Nru vdr-plugin-cecremote-1.4.0+git20161110/cecremoteplugin.cc vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/cecremoteplugin.cc --- vdr-plugin-cecremote-1.4.0+git20161110/cecremoteplugin.cc 2016-11-10 15:15:59.000000000 +0000 +++ vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/cecremoteplugin.cc 2017-10-03 11:28:11.000000000 +0000 @@ -23,7 +23,7 @@ namespace cecplugin { -static const char *VERSION = "1.4.1"; +static const char *VERSION = "1.4.2"; static const char *DESCRIPTION = "Send/Receive CEC commands"; static const char *MAINMENUENTRY = "CECremote"; diff -Nru vdr-plugin-cecremote-1.4.0+git20161110/configfileparser.cc vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/configfileparser.cc --- vdr-plugin-cecremote-1.4.0+git20161110/configfileparser.cc 2016-11-10 15:15:59.000000000 +0000 +++ vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/configfileparser.cc 2017-10-03 11:28:11.000000000 +0000 @@ -67,7 +67,7 @@ const char *cConfigFileParser::XML_COMMAND = "command"; const char *cConfigFileParser::XML_INITIATOR = "initiator"; const char *cConfigFileParser::XML_RTCDETECT = "rtcdetect"; - +const char *cConfigFileParser::XML_STARTUPDELAY = "startupdelay"; /* * Parse */ @@ -565,6 +565,13 @@ throw cCECConfigException( getLineNumber(currentNode.offset_debug()), s); } + } else if (strcasecmp(currentNode.name(), XML_STARTUPDELAY) == 0) { + if (!textToInt(currentNode.text().as_string("0"), + mGlobalOptions.mStartupDelay)) { + string s = "Invalid numeric in startupdelay"; + throw cCECConfigException( + getLineNumber(currentNode.offset_debug()), s); + } } else { string s = "Invalid Node "; s += currentNode.name(); diff -Nru vdr-plugin-cecremote-1.4.0+git20161110/configfileparser.h vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/configfileparser.h --- vdr-plugin-cecremote-1.4.0+git20161110/configfileparser.h 2016-11-10 15:15:59.000000000 +0000 +++ vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/configfileparser.h 2017-10-03 11:28:11.000000000 +0000 @@ -50,6 +50,7 @@ int cec_debug; uint32_t mComboKeyTimeoutMs; int mHDMIPort; + int mStartupDelay; cec_logical_address mBaseDevice; cCmdQueue mOnStart; cCmdQueue mOnStop; @@ -67,6 +68,7 @@ cCECGlobalOptions() : cec_debug(7), mComboKeyTimeoutMs(1000), mHDMIPort(CEC_DEFAULT_HDMI_PORT), + mStartupDelay(0), mBaseDevice(CECDEVICE_UNKNOWN), mCECKeymap(cKeyMaps::DEFAULTKEYMAP), mVDRKeymap(cKeyMaps::DEFAULTKEYMAP), @@ -246,6 +248,7 @@ static const char *XML_COMMAND; static const char *XML_INITIATOR; static const char *XML_RTCDETECT; + static const char *XML_STARTUPDELAY; // Filename of the configuration file. const char* mXmlFile; diff -Nru vdr-plugin-cecremote-1.4.0+git20161110/contrib/cecremote_example.xml vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/contrib/cecremote_example.xml --- vdr-plugin-cecremote-1.4.0+git20161110/contrib/cecremote_example.xml 2016-11-10 15:15:59.000000000 +0000 +++ vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/contrib/cecremote_example.xml 2017-10-03 11:28:11.000000000 +0000 @@ -14,6 +14,7 @@ 2 false 2 + 1 false false diff -Nru vdr-plugin-cecremote-1.4.0+git20161110/debian/changelog vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/debian/changelog --- vdr-plugin-cecremote-1.4.0+git20161110/debian/changelog 2017-07-02 06:54:39.000000000 +0000 +++ vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/debian/changelog 2017-10-10 08:46:50.000000000 +0000 @@ -1,8 +1,9 @@ -vdr-plugin-cecremote (1.4.0+git20161110-0yavdr11~trusty) trusty; urgency=medium +vdr-plugin-cecremote (1.4.0+git20171003-2-c3d10df-0yavdr0~trusty) trusty; urgency=medium - * automatic rebuild + * new upstream snapshot + - Add startupdelay to global config - -- Alexander Grothe Sun, 02 Jul 2017 08:54:39 +0200 + -- Alexander Grothe Tue, 10 Oct 2017 10:37:16 +0200 vdr-plugin-cecremote (1.4.0+git20161110-0yavdr10~xenial) xenial; urgency=medium diff -Nru vdr-plugin-cecremote-1.4.0+git20161110/.gitignore vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/.gitignore --- vdr-plugin-cecremote-1.4.0+git20161110/.gitignore 2016-11-10 15:15:59.000000000 +0000 +++ vdr-plugin-cecremote-1.4.0+git20171003-2-c3d10df/.gitignore 2017-10-03 11:28:11.000000000 +0000 @@ -8,4 +8,7 @@ po/*.mo po/*.pot push.sh +.cproject +.project +.settings