From: Lars Op den Kamp Date: Tue, 6 Dec 2011 20:27:50 +0000 (+0100) Subject: cec: fix simplink reconnect via the TV source selector (after vendor command 0x03) X-Git-Tag: upstream/2.2.0~1^2~44^2~28 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=9a0d7b9f744c551930928fee6d3dac0d90507cd1;p=deb_libcec.git cec: fix simplink reconnect via the TV source selector (after vendor command 0x03) --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 84b9baf..d995345 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -329,8 +329,7 @@ bool CCECProcessor::SetActiveSource(cec_device_type type /* = CEC_DEVICE_TYPE_RE } } - bReturn = m_busDevices[CECDEVICE_TV]->PowerOn() && - m_busDevices[addr]->TransmitActiveSource() && + bReturn = m_busDevices[addr]->TransmitActiveSource() && SetStreamPath(m_busDevices[addr]->GetPhysicalAddress(false)); if (bReturn && (m_busDevices[addr]->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE || diff --git a/src/lib/implementations/SLCommandHandler.cpp b/src/lib/implementations/SLCommandHandler.cpp index 7cf4399..f9892d8 100644 --- a/src/lib/implementations/SLCommandHandler.cpp +++ b/src/lib/implementations/SLCommandHandler.cpp @@ -43,7 +43,7 @@ using namespace CEC; #define SL_COMMAND_UNKNOWN_03 0x05 #define SL_COMMAND_REQUEST_POWER_STATUS 0xa0 -#define SL_COMMAND_POWER_ON 0x0300 +#define SL_COMMAND_POWER_ON 0x03 #define SL_COMMAND_CONNECT_REQUEST 0x04 #define SL_COMMAND_CONNECT_ACCEPT 0x05 @@ -63,6 +63,12 @@ bool CSLCommandHandler::HandleVendorCommand(const cec_command &command) HandleVendorCommand01(command); return true; } + else if (command.parameters.size == 2 && + command.parameters[0] == SL_COMMAND_POWER_ON) + { + HandleVendorCommand03(command); + return true; + } else if (command.parameters.size == 2 && command.parameters[0] == SL_COMMAND_CONNECT_REQUEST) { @@ -110,6 +116,23 @@ void CSLCommandHandler::HandleVendorCommand01(const cec_command &command) m_processor->m_busDevices[command.destination]->TransmitPowerState(command.initiator); } +void CSLCommandHandler::HandleVendorCommand03(const cec_command &command) +{ + CCECBusDevice *device = m_processor->m_busDevices[m_processor->GetLogicalAddresses().primary]; + if (device) + { + device->SetPowerStatus(CEC_POWER_STATUS_ON); + device->TransmitPowerState(command.initiator); + device->TransmitPhysicalAddress(); + TransmitPowerOn(device->GetLogicalAddress(), command.initiator); + if (device->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE || + device->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE) + { + ((CCECPlaybackDevice *)device)->TransmitDeckStatus(command.initiator); + } + } +} + void CSLCommandHandler::HandleVendorCommand04(const cec_command &command) { cec_command response; @@ -184,6 +207,7 @@ bool CSLCommandHandler::HandleCommand(const cec_command &command) m_bVendorIdSent = true; TransmitLGVendorId(m_processor->GetLogicalAddresses().primary, CECDEVICE_BROADCAST); } + m_processor->m_busDevices[m_processor->GetLogicalAddresses().primary]->SetPowerStatus(CEC_POWER_STATUS_STANDBY); m_bSLEnabled = false; } bHandled = true; @@ -235,9 +259,6 @@ bool CSLCommandHandler::InitHandler(void) if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV) { - primary->TransmitVendorID(CECDEVICE_TV); - primary->TransmitPhysicalAddress(); - /* LG TVs don't always reply to CEC version requests, so just set it to 1.3a */ m_busDevice->SetCecVersion(CEC_VERSION_1_3A); } @@ -263,7 +284,6 @@ bool CSLCommandHandler::InitHandler(void) device->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE)) { ((CCECPlaybackDevice *)device)->SetDeckStatus(CEC_DECK_INFO_OTHER_STATUS_LG); - TransmitDeckStatus(CECDEVICE_TV); } } } @@ -275,12 +295,13 @@ bool CSLCommandHandler::InitHandler(void) bool CSLCommandHandler::TransmitPowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination) { if (iDestination != CECDEVICE_BROADCAST && - m_processor->m_busDevices[iDestination]->GetVendorId(false) == CEC_VENDOR_LG); + iDestination != CECDEVICE_TV && + m_processor->m_busDevices[iDestination]->GetVendorId(false) == CEC_VENDOR_LG) { cec_command command; cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_VENDOR_COMMAND); - command.parameters.PushBack((uint8_t) (((uint16_t)SL_COMMAND_POWER_ON >> 8) & 0xFF)); - command.parameters.PushBack((uint8_t) ((uint16_t)SL_COMMAND_POWER_ON & 0xFF)); + command.parameters.PushBack((uint8_t)SL_COMMAND_POWER_ON); + command.parameters.PushBack(0x00); return Transmit(command); } diff --git a/src/lib/implementations/SLCommandHandler.h b/src/lib/implementations/SLCommandHandler.h index b40c2ef..6a91df4 100644 --- a/src/lib/implementations/SLCommandHandler.h +++ b/src/lib/implementations/SLCommandHandler.h @@ -51,6 +51,7 @@ namespace CEC protected: virtual void HandleVendorCommand01(const cec_command &command); + virtual void HandleVendorCommand03(const cec_command &command); virtual void HandleVendorCommand04(const cec_command &command); virtual void HandleVendorCommandA0(const cec_command &command);