if (command.parameters.size == 2)
{
uint16_t iAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
+ m_processor->GetDevices()->SetActiveSource(iAddress);
CCECBusDevice *device = m_processor->GetDeviceByPhysicalAddress(iAddress);
if (device)
- {
device->MarkAsActiveSource();
- return COMMAND_HANDLED;
- }
+
+ m_processor->GetDevices()->SignalAll(command.opcode);
+ return COMMAND_HANDLED;
}
return CEC_ABORT_REASON_INVALID_OPERAND;
int CCECCommandHandler::HandleImageViewOn(const cec_command &command)
{
CCECBusDevice *device = GetDevice(command.destination);
- if (device && (device->GetCurrentStatus() == CEC_DEVICE_STATUS_PRESENT ||
- device->GetCurrentStatus() == CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC))
+ if (device && device->GetCurrentStatus() == CEC_DEVICE_STATUS_PRESENT)
{
if (device->GetCurrentPowerStatus() == CEC_POWER_STATUS_STANDBY ||
device->GetCurrentPowerStatus() == CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY)
device->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
+ CCECBusDevice* tv = GetDevice(CECDEVICE_TV);
+ if (tv)
+ tv->OnImageViewOnSent(false);
}
return COMMAND_HANDLED;
}
/* one of the device handled by libCEC has been made active */
CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamAddress);
- if (device && device->IsHandledByLibCEC())
+ if (device)
{
- device->ActivateSource();
+ if (device->IsHandledByLibCEC())
+ device->ActivateSource();
+ else
+ device->MarkAsActiveSource();
return COMMAND_HANDLED;
}
+ else
+ {
+ cec_logical_address previousSource = m_processor->GetActiveSource(false);
+ CCECBusDevice* device = m_processor->GetDevice(previousSource);
+ if (device && device->GetCurrentPhysicalAddress() != iStreamAddress)
+ device->MarkAsInactiveSource();
+ }
}
return CEC_ABORT_REASON_INVALID_OPERAND;
{
// we're not marked as active source, but the tv sends keypresses to us, so assume it forgot to activate us
if (!device->IsActiveSource() && command.initiator == CECDEVICE_TV)
- device->ActivateSource();
+ device->MarkAsActiveSource();
}
return COMMAND_HANDLED;
bool bTvPresent = (tv && tv->GetStatus() == CEC_DEVICE_STATUS_PRESENT);
bool bActiveSourceFailed(false);
if (bTvPresent)
- {
- if (tv->GetCurrentPowerStatus() != CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON)
- bActiveSourceFailed = !m_busDevice->TransmitImageViewOn();
- }
+ bActiveSourceFailed = !m_busDevice->TransmitImageViewOn();
else
LIB_CEC->AddLog(CEC_LOG_DEBUG, "TV not present, not sending 'image view on'");