X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fimplementations%2FCECCommandHandler.cpp;h=23fd550b068ea9a2a4ee15550faadb6dbb2faa6e;hb=5827f4aa75371f5633afbc4fd98336a08f39352f;hp=5a3de0b690c7d4015a2b27144e69c6ab69d7ef46;hpb=6b1eea982ef9d4967ea7994f3c5e8dc246a5188c;p=deb_libcec.git diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 5a3de0b..23fd550 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -44,7 +44,8 @@ CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice) : m_processor(m_busDevice->GetProcessor()), m_iTransmitTimeout(CEC_DEFAULT_TRANSMIT_TIMEOUT), m_iTransmitWait(CEC_DEFAULT_TRANSMIT_WAIT), - m_iTransmitRetries(CEC_DEFAULT_TRANSMIT_RETRIES) + m_iTransmitRetries(CEC_DEFAULT_TRANSMIT_RETRIES), + m_bHandlerInited(false) { } @@ -158,6 +159,9 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command) case CEC_OPCODE_TEXT_VIEW_ON: HandleTextViewOn(command); break; + case CEC_OPCODE_FEATURE_ABORT: + HandleFeatureAbort(command); + break; default: UnhandledCommand(command); bHandled = false; @@ -221,6 +225,15 @@ bool CCECCommandHandler::HandleDeviceVendorId(const cec_command &command) return SetVendorId(command); } +bool CCECCommandHandler::HandleFeatureAbort(const cec_command &command) +{ + if (command.parameters.size == 2) + { + m_processor->m_busDevices[command.initiator]->SetUnsupportedFeature((cec_opcode)command.parameters[0]); + } + return true; +} + bool CCECCommandHandler::HandleGetCecVersion(const cec_command &command) { if (m_processor->IsStarted() && m_busDevice->MyLogicalAddressContains(command.destination)) @@ -299,7 +312,11 @@ bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command &command) { CCECBusDevice *device = GetDevice(command.destination); if (device) - return device->TransmitPhysicalAddress(); + { + device->SetActiveSource(); + return device->TransmitPhysicalAddress() && + device->TransmitActiveSource(); + } } return false; @@ -927,11 +944,16 @@ bool CCECCommandHandler::InitHandler(void) { if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV) { - CCECBusDevice *primary = m_processor->m_busDevices[m_processor->GetLogicalAddresses().primary]; + CCECBusDevice *primary = m_processor->GetPrimaryDevice(); primary->SetPowerStatus(CEC_POWER_STATUS_ON); primary->SetMenuState(CEC_MENU_STATE_ACTIVATED); - m_processor->SetActiveSource(); - primary->TransmitMenuState(m_busDevice->GetLogicalAddress()); + if (m_processor->GetPrimaryDevice()->GetPhysicalAddress(false) != 0xffff) + { + m_processor->SetActiveSource(); + primary->TransmitMenuState(m_busDevice->GetLogicalAddress()); + m_bHandlerInited = true; + } } + return true; }