X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FLibCEC.cpp;h=8838ff4157b48591a864082c436df100e9961e96;hb=dc6366e81f1ad7bad55b9ebeeb65937d7ed1c256;hp=331b11d3b7cbfedd485a56c3d1787446dd3b0ca6;hpb=0d800fe507054f9fc752ba70e5a9c14d95dcb87f;p=deb_libcec.git diff --git a/src/lib/LibCEC.cpp b/src/lib/LibCEC.cpp index 331b11d..8838ff4 100644 --- a/src/lib/LibCEC.cpp +++ b/src/lib/LibCEC.cpp @@ -102,16 +102,24 @@ bool CLibCEC::Open(const char *strPort, uint32_t iTimeoutMs /* = CEC_DEFAULT_CON void CLibCEC::Close(void) { + if (!m_cec) + return; + // unregister all clients - UnregisterClients(); + m_cec->UnregisterClients(); // close the connection - if (m_cec) - m_cec->Close(); + m_cec->Close(); } int8_t CLibCEC::FindAdapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */) { + if (!CUSBCECAdapterDetection::CanAutodetect()) + { + AddLog(CEC_LOG_WARNING, "libCEC has not been compiled with adapter detection code for this target, so the path to the COM port has to be provided to libCEC"); + return 0; + } + return CUSBCECAdapterDetection::FindAdapters(deviceList, iBufSize, strDevicePath); }