From: Lars Op den Kamp Date: Sun, 6 Nov 2011 12:27:42 +0000 (+0100) Subject: cec: keep a power and menu state pew device X-Git-Tag: upstream/2.2.0~1^2~105 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1844f5f7c26c85d4037fa89deb2f24e3cfbd0d72;p=deb_libcec.git cec: keep a power and menu state pew device --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 5eed4a8..07698ad 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -151,6 +151,7 @@ bool CCECProcessor::TryLogicalAddress(cec_logical_address address, const char *s /* only set our OSD name for the primary device */ if (m_logicalAddresses.empty()) m_busDevices[address]->m_strDeviceName = m_strDeviceName; + m_busDevices[address]->m_powerStatus = CEC_POWER_STATUS_ON; m_logicalAddresses.set(address); // TODO diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 3d1a7cd..8b6c54d 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -44,6 +44,7 @@ CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogi m_iLogicalAddress(iLogicalAddress), m_powerStatus(CEC_POWER_STATUS_UNKNOWN), m_processor(processor), + m_bMenuActive(true), m_iVendorClass(CEC_VENDOR_UNKNOWN), m_iLastActive(0), m_cecVersion(CEC_VERSION_1_3A) @@ -300,16 +301,16 @@ bool CCECBusDevice::ReportDeckStatus(cec_logical_address dest) return false; } -bool CCECBusDevice::ReportMenuState(cec_logical_address dest, bool bActive /* = true */) +bool CCECBusDevice::ReportMenuState(cec_logical_address dest) { - if (bActive) + if (m_bMenuActive) AddLog(CEC_LOG_NOTICE, "<< reporting menu state as active"); else AddLog(CEC_LOG_NOTICE, "<< reporting menu state as inactive"); cec_command command; cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_MENU_STATUS); - command.parameters.push_back(bActive ? (uint8_t) CEC_MENU_STATE_ACTIVATED : (uint8_t) CEC_MENU_STATE_DEACTIVATED); + command.parameters.push_back(m_bMenuActive ? (uint8_t) CEC_MENU_STATE_ACTIVATED : (uint8_t) CEC_MENU_STATE_DEACTIVATED); return m_processor->Transmit(command); } @@ -330,12 +331,13 @@ bool CCECBusDevice::ReportOSDName(cec_logical_address dest) bool CCECBusDevice::ReportPowerState(cec_logical_address dest) { - AddLog(CEC_LOG_NOTICE, "<< reporting \"On\" power status"); + CStdString strLog; + strLog.Format("<< reporting power status '%d'", m_powerStatus); + AddLog(CEC_LOG_NOTICE, strLog); cec_command command; cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_REPORT_POWER_STATUS); -// command.parameters.push_back(bOn ? (uint8_t) CEC_POWER_STATUS_ON : (uint8_t) CEC_POWER_STATUS_STANDBY); - command.parameters.push_back((uint8_t) CEC_POWER_STATUS_ON); + command.parameters.push_back((uint8_t) m_powerStatus); return m_processor->Transmit(command); } diff --git a/src/lib/devices/CECBusDevice.h b/src/lib/devices/CECBusDevice.h index ef2db21..5a5229d 100644 --- a/src/lib/devices/CECBusDevice.h +++ b/src/lib/devices/CECBusDevice.h @@ -83,7 +83,7 @@ namespace CEC virtual bool ReportCECVersion(cec_logical_address dest); virtual bool ReportDeckStatus(cec_logical_address dest); - virtual bool ReportMenuState(cec_logical_address dest, bool bActive = true); + virtual bool ReportMenuState(cec_logical_address dest); virtual bool ReportOSDName(cec_logical_address dest); virtual bool ReportPowerState(cec_logical_address dest); virtual bool ReportVendorID(cec_logical_address dest); @@ -103,6 +103,7 @@ namespace CEC CCECProcessor *m_processor; CCECCommandHandler *m_handler; cec_vendor m_vendor; + bool m_bMenuActive; uint8_t m_iVendorClass; uint64_t m_iLastActive; cec_version m_cecVersion;