X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fadapter%2FPulse-Eight%2FUSBCECAdapterCommunication.cpp;h=80f7714a3af1f9651476d143257598ede46ca8c1;hb=3b106c7d018681dec102db878a9ca4cbd213c1e2;hp=b524dd8082f53bb120873ee44dfd318e0c40d14f;hpb=3ead056c503f92e9c4352c41d51e613d4fa7b00e;p=deb_libcec.git diff --git a/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp b/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp index b524dd8..80f7714 100644 --- a/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp +++ b/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp @@ -222,7 +222,8 @@ void CUSBCECAdapterCommunication::Close(void) m_adapterMessageQueue->Clear(); /* stop and delete the write thread */ - m_eepromWriteThread->Stop(); + if (m_eepromWriteThread) + m_eepromWriteThread->Stop(); DELETE_AND_NULL(m_eepromWriteThread); /* stop and delete the ping thread */ @@ -481,8 +482,14 @@ bool CUSBCECAdapterCommunication::CheckAdapter(uint32_t iTimeoutMs /* = CEC_DEFA else bReturn = true; - /* try to read the build date */ - m_commands->RequestBuildDate(); + if (m_commands->GetFirmwareVersion() >= 2) + { + /* try to read the build date */ + m_commands->RequestBuildDate(); + + /* try to read the adapter type */ + m_commands->RequestAdapterType(); + } SetInitialised(bReturn); return bReturn; @@ -569,6 +576,17 @@ uint32_t CUSBCECAdapterCommunication::GetFirmwareBuildDate(void) return iBuildDate; } +cec_adapter_type CUSBCECAdapterCommunication::GetAdapterType(void) +{ + cec_adapter_type type(ADAPTERTYPE_UNKNOWN); + if (m_commands) + type = (cec_adapter_type)m_commands->GetPersistedAdapterType(); + if (type == ADAPTERTYPE_UNKNOWN && IsOpen()) + type = (cec_adapter_type)m_commands->RequestAdapterType(); + + return type; +} + bool CUSBCECAdapterCommunication::ProvidesExtendedResponse(void) { uint32_t iBuildDate(0);