From: Lars Op den Kamp Date: Thu, 26 Apr 2012 12:37:07 +0000 (+0200) Subject: cec-client: show the firmware build date if it's available in cec-client -l. fixed... X-Git-Tag: upstream/2.2.0~1^2~29^2^2~16 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=c36dd10675100ca44b11421ed977c7b987a478fb;p=deb_libcec.git cec-client: show the firmware build date if it's available in cec-client -l. fixed double delete on exit in cec-client -l --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 8838df6..1c92bb1 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -193,7 +193,7 @@ bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint m_configuration.iFirmwareBuildDate = m_communication->GetFirmwareBuildDate(); CStdString strLog; strLog.Format("connected to the CEC adapter. libCEC version = %s, client version = %s, firmware version = %d", ToString((cec_server_version)m_configuration.serverVersion), ToString((cec_client_version)m_configuration.clientVersion), m_configuration.iFirmwareVersion); - if (m_configuration.iFirmwareBuildDate > 0) + if (m_configuration.iFirmwareBuildDate != CEC_DEFAULT_FIRMWARE_BUILD_DATE) { time_t buildTime = (time_t)m_configuration.iFirmwareBuildDate; strLog.AppendFormat(", firmware build date: %s", asctime(gmtime(&buildTime))); @@ -1772,11 +1772,10 @@ bool CCECProcessor::GetDeviceInformation(const char *strPort, libcec_configurati if (!OpenConnection(strPort, CEC_SERIAL_DEFAULT_BAUDRATE, iTimeoutMs, false)) return false; - config->iFirmwareVersion = m_communication->GetFirmwareVersion(); - config->iPhysicalAddress = m_communication->GetPhysicalAddress(); + config->iFirmwareVersion = m_communication->GetFirmwareVersion(); + config->iPhysicalAddress = m_communication->GetPhysicalAddress(); + config->iFirmwareBuildDate = m_communication->GetFirmwareBuildDate(); - delete m_communication; - m_communication = NULL; return true; } diff --git a/src/testclient/main.cpp b/src/testclient/main.cpp index 65e99bc..2fa510e 100644 --- a/src/testclient/main.cpp +++ b/src/testclient/main.cpp @@ -204,14 +204,24 @@ void ListDevices(ICECAdapter *parser) for (int8_t iDevicePtr = 0; iDevicePtr < iDevicesFound; iDevicePtr++) { - strDeviceInfo.AppendFormat("device: %d\ncom port: %s\n", iDevicePtr + 1, devices[iDevicePtr].comm); + strDeviceInfo.AppendFormat("device: %d\ncom port: %s\n", iDevicePtr + 1, devices[iDevicePtr].comm); libcec_configuration config; config.Clear(); if (!parser->GetDeviceInformation(devices[iDevicePtr].comm, &config)) PrintToStdOut("WARNING: unable to open the device on port %s", devices[iDevicePtr].comm); else - strDeviceInfo.AppendFormat("firmware version: %d\n", config.iFirmwareVersion); + { + strDeviceInfo.AppendFormat("firmware version: %d\n", config.iFirmwareVersion); + + if (config.iFirmwareBuildDate != CEC_DEFAULT_FIRMWARE_BUILD_DATE) + { + time_t buildTime = (time_t)config.iFirmwareBuildDate; + strDeviceInfo.AppendFormat("firmware build date: %s", asctime(gmtime(&buildTime))); + strDeviceInfo = strDeviceInfo.Left((int)strDeviceInfo.length() - 1); // strip \n added by asctime + strDeviceInfo.append(" +0000"); + } + } strDeviceInfo.append("\n"); } PrintToStdOut(strDeviceInfo.c_str());