X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECProcessor.cpp;h=96e82ce626ff4f23f3e3287b0ead0cd26f2797df;hb=0eb7639ed29e68a004e3eee32d53395d98252657;hp=cf7b5b4ec62f0d046483464d8528c09bdf55b9e3;hpb=41e3372ac4ad2de0d20e19e9dc9c8776220451b1;p=deb_libcec.git diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index cf7b5b4..96e82ce 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -189,7 +189,7 @@ bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint { CLibCEC::AddLog(CEC_LOG_ERROR, "could not open a connection (try %d)", ++iConnectTry); m_communication->Close(); - Sleep(500); + CEvent::Sleep(1000); } if (bReturn) @@ -1439,9 +1439,31 @@ void CCECBusScan::WaitUntilIdle(void) } } -bool CCECProcessor::StartBootloader(void) +bool CCECProcessor::StartBootloader(const char *strPort /* = NULL */) { - return m_communication->StartBootloader(); + if (!m_communication && strPort) + { + bool bReturn(false); + IAdapterCommunication *comm = new CUSBCECAdapterCommunication(this, strPort); + CTimeout timeout(10000); + int iConnectTry(0); + while (timeout.TimeLeft() > 0 && (bReturn = comm->Open(NULL, (timeout.TimeLeft() / CEC_CONNECT_TRIES)), true) == false) + { + CLibCEC::AddLog(CEC_LOG_ERROR, "could not open a connection (try %d)", ++iConnectTry); + comm->Close(); + Sleep(500); + } + if (comm->IsOpen()) + { + bReturn = comm->StartBootloader(); + delete comm; + } + return bReturn; + } + else + { + return m_communication->StartBootloader(); + } } bool CCECProcessor::PingAdapter(void) @@ -1581,6 +1603,11 @@ bool CCECProcessor::SetConfiguration(const libcec_configuration *configuration) else return SetHDMIPort(m_configuration.baseDevice, m_configuration.iHDMIPort); } + else if (m_configuration.bActivateSource == 1 && IsRunning() && !IsActiveSource(m_logicalAddresses.primary)) + { + // activate the source if we're not already the active source + SetActiveSource(m_configuration.deviceTypes.types[0]); + } return true; }