+ if (command.parameters.size == 2)
+ {
+ uint16_t iAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
+ CCECBusDevice *device = m_processor->GetDeviceByPhysicalAddress(iAddress);
+ if (device)
+ device->MarkAsActiveSource();
+
+ {
+ CLockObject lock(m_SLMutex);
+ m_bActiveSourceSent = false;
+ }
+
+ return COMMAND_HANDLED;
+ }
+
+ return CEC_ABORT_REASON_INVALID_OPERAND;
+
+}
+
+int CSLCommandHandler::HandleDeviceVendorId(const cec_command &command)
+{
+ SetVendorId(command);
+
+ if (!SLInitialised() && command.initiator == CECDEVICE_TV)
+ {
+ CCECBusDevice *destination = m_processor->GetDevice(command.destination);
+ if (destination && (destination->GetLogicalAddress() == CECDEVICE_BROADCAST || destination->IsHandledByLibCEC()))
+ {
+ cec_logical_address initiator = destination->GetLogicalAddress();
+ if (initiator == CECDEVICE_BROADCAST)
+ initiator = m_processor->GetPrimaryDevice()->GetLogicalAddress();
+
+ cec_command response;
+ cec_command::Format(response, initiator, command.initiator, CEC_OPCODE_FEATURE_ABORT);
+ Transmit(response, false, true);
+ return COMMAND_HANDLED;
+ }
+ }
+
+ return CCECCommandHandler::HandleDeviceVendorId(command);
+}
+
+int CSLCommandHandler::HandleVendorCommand(const cec_command &command)
+{
+ if (!m_processor->IsHandledByLibCEC(command.destination))
+ return true;
+
+ if (command.parameters.size == 1 &&
+ command.parameters[0] == SL_COMMAND_UNKNOWN_01)
+ {
+ HandleVendorCommand01(command);
+ return COMMAND_HANDLED;
+ }
+ else if (command.parameters.size == 2 &&
+ command.parameters[0] == SL_COMMAND_POWER_ON)
+ {
+ HandleVendorCommandPowerOn(command);
+ return COMMAND_HANDLED;
+ }
+ else if (command.parameters.size == 2 &&
+ command.parameters[0] == SL_COMMAND_CONNECT_REQUEST)
+ {
+ HandleVendorCommandSLConnect(command);
+ return COMMAND_HANDLED;
+ }
+ else if (command.parameters.size == 1 &&
+ command.parameters[0] == SL_COMMAND_REQUEST_POWER_STATUS)
+ {
+ HandleVendorCommandPowerOnStatus(command);
+ return COMMAND_HANDLED;
+ }
+
+ return CCECCommandHandler::HandleVendorCommand(command);
+}
+
+void CSLCommandHandler::HandleVendorCommand01(const cec_command &command)
+{
+ m_processor->GetPrimaryDevice()->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
+ TransmitVendorCommand0205(command.destination, command.initiator);
+
+ CCECBusDevice* dev = m_processor->GetDevice(command.destination);
+ if (dev && dev->IsHandledByLibCEC() && dev->IsActiveSource())
+ dev->TransmitActiveSource(false);
+}
+
+void CSLCommandHandler::TransmitVendorCommand0205(const cec_logical_address iSource, const cec_logical_address iDestination)
+{
+ cec_command response;
+ cec_command::Format(response, iSource, iDestination, CEC_OPCODE_VENDOR_COMMAND);
+ response.PushBack(SL_COMMAND_UNKNOWN_02);
+ response.PushBack(SL_COMMAND_TYPE_HDDRECORDER);
+
+ Transmit(response, false, true);
+ SetSLInitialised();
+}
+
+void CSLCommandHandler::HandleVendorCommandPowerOn(const cec_command &command)
+{
+ if (command.initiator != CECDEVICE_TV)
+ return;
+
+ CCECBusDevice *device = m_processor->GetPrimaryDevice();