From: Lars Op den Kamp Date: Fri, 23 Mar 2012 09:57:37 +0000 (+0100) Subject: cec: added the firmware version to libcec_configuration (read-only). bumped server... X-Git-Tag: upstream/2.2.0~1^2~31^2~52 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e69d8f191784c77c156ffec90db50767f91421e3;p=deb_libcec.git cec: added the firmware version to libcec_configuration (read-only). bumped server version to 1.6.0. fixed 'unknown server version' message on startup. bugzid: 631 --- diff --git a/include/cectypes.h b/include/cectypes.h index e0b586f..451b2ab 100644 --- a/include/cectypes.h +++ b/include/cectypes.h @@ -966,6 +966,7 @@ typedef enum cec_client_version CEC_CLIENT_VERSION_1_5_1 = 0x1501, CEC_CLIENT_VERSION_1_5_2 = 0x1502, CEC_CLIENT_VERSION_1_5_3 = 0x1503, + CEC_CLIENT_VERSION_1_6_0 = 0x1600 } cec_client_version; typedef enum cec_server_version @@ -974,7 +975,8 @@ typedef enum cec_server_version CEC_SERVER_VERSION_1_5_0 = 0x1500, CEC_SERVER_VERSION_1_5_1 = 0x1501, CEC_SERVER_VERSION_1_5_2 = 0x1502, - CEC_SERVER_VERSION_1_5_3 = 0x1503 + CEC_SERVER_VERSION_1_5_3 = 0x1503, + CEC_SERVER_VERSION_1_6_0 = 0x1600 } cec_server_version; typedef struct libcec_configuration @@ -1004,6 +1006,7 @@ typedef struct libcec_configuration ICECCallbacks * callbacks; /*!< the callback methods to use. set this to NULL when not using callbacks */ cec_logical_addresses logicalAddresses; /*!< the current logical addresses. read-only. added in 1.5.3 */ + uint16_t iFirmwareVersion; /*!< the firmware version of the adapter. in 1.6.0 */ #ifdef __cplusplus void Clear(void) @@ -1033,6 +1036,7 @@ typedef struct libcec_configuration bPowerOffOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY; bSendInactiveSource = CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE; logicalAddresses.Clear(); + iFirmwareVersion = 0; callbackParam = NULL; callbacks = NULL; diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 83e9ee8..5000e04 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -59,7 +59,7 @@ CCECProcessor::CCECProcessor(CLibCEC *controller, libcec_configuration *configur { CreateBusDevices(); m_configuration.Clear(); - m_configuration.serverVersion = configuration->serverVersion; + m_configuration.serverVersion = CEC_SERVER_VERSION_1_6_0; SetConfiguration(configuration); if (m_configuration.tvVendor != CEC_VENDOR_UNKNOWN) @@ -77,7 +77,7 @@ CCECProcessor::CCECProcessor(CLibCEC *controller, const char *strDeviceName, con m_iLastTransmission(0) { m_configuration.Clear(); - m_configuration.serverVersion = CEC_SERVER_VERSION_1_5_2; + m_configuration.serverVersion = CEC_SERVER_VERSION_1_6_0; // client version < 1.5.0 m_configuration.clientVersion = (uint32_t)CEC_CLIENT_VERSION_PRE_1_5; @@ -192,7 +192,10 @@ bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint } if (bReturn) - CLibCEC::AddLog(CEC_LOG_NOTICE, "connected to the CEC adapter. firmware version = %d, client version = %s", m_communication->GetFirmwareVersion(), ToString((cec_client_version)m_configuration.clientVersion)); + { + m_configuration.iFirmwareVersion = m_communication->GetFirmwareVersion(); + CLibCEC::AddLog(CEC_LOG_NOTICE, "connected to the CEC adapter. firmware version = %d, client version = %s", m_configuration.iFirmwareVersion, ToString((cec_client_version)m_configuration.clientVersion)); + } if (m_configuration.bGetSettingsFromROM == 1) m_communication->GetConfiguration(&m_configuration); @@ -1380,6 +1383,10 @@ const char *CCECProcessor::ToString(const cec_client_version version) return "1.5.1"; case CEC_CLIENT_VERSION_1_5_2: return "1.5.2"; + case CEC_CLIENT_VERSION_1_5_3: + return "1.5.3"; + case CEC_CLIENT_VERSION_1_6_0: + return "1.6.0"; default: return "Unknown"; } @@ -1397,6 +1404,10 @@ const char *CCECProcessor::ToString(const cec_server_version version) return "1.5.1"; case CEC_SERVER_VERSION_1_5_2: return "1.5.2"; + case CEC_SERVER_VERSION_1_5_3: + return "1.5.3"; + case CEC_SERVER_VERSION_1_6_0: + return "1.6.0"; default: return "Unknown"; } @@ -1649,6 +1660,10 @@ bool CCECProcessor::GetCurrentConfiguration(libcec_configuration *configuration) if (configuration->clientVersion >= CEC_CLIENT_VERSION_1_5_3) configuration->logicalAddresses = m_configuration.logicalAddresses; + // client version 1.6.0 + if (configuration->clientVersion >= CEC_CLIENT_VERSION_1_5_3) + configuration->logicalAddresses = m_configuration.logicalAddresses; + return true; } diff --git a/src/lib/adapter/AdapterCommunication.h b/src/lib/adapter/AdapterCommunication.h index 15f0c9c..400b321 100644 --- a/src/lib/adapter/AdapterCommunication.h +++ b/src/lib/adapter/AdapterCommunication.h @@ -135,7 +135,7 @@ namespace CEC virtual bool PingAdapter(void) = 0; /*! - * @return The firmware version of this CEC adapter. + * @return The firmware version of this CEC adapter, or 0 if it's unknown. */ virtual uint16_t GetFirmwareVersion(void) = 0;