added the type of adapter to libcec_configuration, and display the type in cec-client...
[deb_libcec.git] / src / lib / adapter / Pulse-Eight / USBCECAdapterCommunication.cpp
index 70e45ac6c30e00e06987cf9c001f67cf55c68028..80f7714a3af1f9651476d143257598ede46ca8c1 100644 (file)
@@ -482,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;
@@ -570,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);