m_iLastActive = GetTimeMs();
m_handler->HandleCommand(command);
if (m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC)
+ {
+ if (m_deviceStatus != CEC_DEVICE_STATUS_PRESENT)
+ {
+ CStdString strLog;
+ strLog.Format("device %s (%x) status changed to present after command %s", GetLogicalAddressName(), (uint8_t)GetLogicalAddress(), ToString(command.opcode));
+ AddLog(CEC_LOG_DEBUG, strLog);
+ }
m_deviceStatus = CEC_DEVICE_STATUS_PRESENT;
+ }
m_condition.Signal();
return true;
}
}
}
+ m_handler->InitHandler();
+
CStdString strLog;
strLog.Format("%s (%X): vendor = %s (%06x)", GetLogicalAddressName(), m_iLogicalAddress, ToString(m_vendor), m_vendor);
m_processor->AddLog(CEC_LOG_DEBUG, strLog.c_str());
#include "SLCommandHandler.h"
#include "../devices/CECBusDevice.h"
+#include "../devices/CECPlaybackDevice.h"
#include "../CECProcessor.h"
using namespace CEC;
response.PushBack(0x02);
response.PushBack(0x05);
- return m_busDevice->GetProcessor()->Transmit(response);
+ m_busDevice->GetProcessor()->Transmit(response);
+ TransmitLGVendorId(command.destination, command.initiator);
+ return true;
}
else if (command.parameters.size >= 1 &&
command.parameters[0] == 0x04)
{
- /* enable SL */
- cec_command response;
- cec_command::Format(response, command.destination, command.initiator, CEC_OPCODE_VENDOR_COMMAND);
- response.PushBack(0x05);
- response.PushBack(0x04);
-
- return m_busDevice->GetProcessor()->Transmit(response);
+ CCECBusDevice *primary = m_busDevice->GetProcessor()->m_busDevices[m_busDevice->GetProcessor()->GetLogicalAddresses().primary];
+ if (primary->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE || primary->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE)
+ {
+ ((CCECPlaybackDevice *)primary)->SetDeckStatus(CEC_DECK_INFO_OTHER_STATUS_LG);
+ ((CCECPlaybackDevice *)primary)->TransmitDeckStatus(command.initiator);
+ }
+ return true;
}
else if (command.parameters.size == 1 &&
command.parameters[0] == 0xa0)
{
- /* enable SL */
- cec_command response;
- cec_command::Format(response, command.destination, command.initiator, CEC_OPCODE_VENDOR_COMMAND);
- response.parameters.PushBack((uint8_t) (((uint64_t)CEC_VENDOR_LG >> 16) & 0xFF));
- response.parameters.PushBack((uint8_t) (((uint64_t)CEC_VENDOR_LG >> 8) & 0xFF));
- response.parameters.PushBack((uint8_t) ((uint64_t)CEC_VENDOR_LG & 0xFF));
-
- return m_busDevice->GetProcessor()->Transmit(response);
+ TransmitLGVendorId(command.destination, command.initiator);
+ return true;
}
return false;
}
+bool CSLCommandHandler::TransmitLGVendorId(const cec_logical_address iInitiator, const cec_logical_address iDestination)
+{
+ cec_command response;
+ cec_command::Format(response, iInitiator, iDestination, CEC_OPCODE_VENDOR_COMMAND);
+ response.parameters.PushBack((uint8_t) (((uint64_t)CEC_VENDOR_LG >> 16) & 0xFF));
+ response.parameters.PushBack((uint8_t) (((uint64_t)CEC_VENDOR_LG >> 8) & 0xFF));
+ response.parameters.PushBack((uint8_t) ((uint64_t)CEC_VENDOR_LG & 0xFF));
+
+ return m_busDevice->GetProcessor()->Transmit(response);
+}
+
bool CSLCommandHandler::HandleGiveDeviceVendorId(const cec_command &command)
{
/* imitate LG devices */
case CEC_OPCODE_VENDOR_COMMAND:
bHandled = HandleVendorCommand(command);
break;
+ case CEC_OPCODE_DEVICE_VENDOR_ID:
+ {
+ if (command.initiator == m_busDevice->GetLogicalAddress())
+ {
+ TransmitLGVendorId(m_busDevice->GetProcessor()->GetLogicalAddresses().primary, command.initiator);
+ bHandled = true;
+ }
+ }
+ break;
default:
break;
}
return bHandled;
}
-
void CSLCommandHandler::HandlePoll(const cec_logical_address iInitiator, const cec_logical_address iDestination)
{
CCECCommandHandler::HandlePoll(iInitiator, iDestination);
return true;
}
+
+bool CSLCommandHandler::InitHandler(void)
+{
+ if (m_busDevice->GetLogicalAddress() != CECDEVICE_TV)
+ return true;
+
+ /* LG TVs only route keypresses when the deck status is set to 0x20 */
+ cec_logical_addresses addr = m_busDevice->GetProcessor()->GetLogicalAddresses();
+ for (uint8_t iPtr = 0; iPtr < 15; iPtr++)
+ {
+ if (addr[iPtr])
+ {
+ CCECBusDevice *device = m_busDevice->GetProcessor()->m_busDevices[iPtr];
+ if (device && (device->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE ||
+ device->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE))
+ {
+ ((CCECPlaybackDevice *)device)->SetDeckStatus(CEC_DECK_INFO_OTHER_STATUS_LG);
+ ((CCECPlaybackDevice *)device)->TransmitDeckStatus(CECDEVICE_TV);
+ }
+ }
+ }
+ return true;
+}