repositories
/
deb_libcec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cec: don't send deck status updates when sending an active source message for samsung
[deb_libcec.git]
/
src
/
lib
/
implementations
/
CECCommandHandler.cpp
diff --git
a/src/lib/implementations/CECCommandHandler.cpp
b/src/lib/implementations/CECCommandHandler.cpp
index c72155cccdb3a9efc616297ef5b4efe11de6e0f4..9f442be160d6ebf52711cc507c15e932dbb791f7 100644
(file)
--- a/
src/lib/implementations/CECCommandHandler.cpp
+++ b/
src/lib/implementations/CECCommandHandler.cpp
@@
-46,7
+46,10
@@
CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice) :
m_iTransmitWait(CEC_DEFAULT_TRANSMIT_WAIT),
m_iTransmitRetries(CEC_DEFAULT_TRANSMIT_RETRIES),
m_bHandlerInited(false),
m_iTransmitWait(CEC_DEFAULT_TRANSMIT_WAIT),
m_iTransmitRetries(CEC_DEFAULT_TRANSMIT_RETRIES),
m_bHandlerInited(false),
- m_iUseCounter(0)
+ m_iUseCounter(0),
+ m_expectedResponse(CEC_OPCODE_NONE),
+ m_bOPTSendDeckStatusUpdateOnActiveSource(true),
+ m_vendorId(CEC_VENDOR_UNKNOWN)
{
}
{
}
@@
-59,7
+62,7
@@
CCECCommandHandler::~CCECCommandHandler(void)
bool CCECCommandHandler::HandleCommand(const cec_command &command)
{
bool CCECCommandHandler::HandleCommand(const cec_command &command)
{
- bool bHandled(true)
, bHandlerChanged(false)
;
+ bool bHandled(true);
MarkBusy();
CStdString strLog;
MarkBusy();
CStdString strLog;
@@
-80,49
+83,61
@@
bool CCECCommandHandler::HandleCommand(const cec_command &command)
HandleSetMenuLanguage(command);
break;
case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS:
HandleSetMenuLanguage(command);
break;
case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS:
- HandleGivePhysicalAddress(command);
+ if (m_processor->IsInitialised())
+ HandleGivePhysicalAddress(command);
break;
case CEC_OPCODE_GIVE_OSD_NAME:
break;
case CEC_OPCODE_GIVE_OSD_NAME:
- HandleGiveOSDName(command);
+ if (m_processor->IsInitialised())
+ HandleGiveOSDName(command);
break;
case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID:
break;
case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID:
- HandleGiveDeviceVendorId(command);
+ if (m_processor->IsInitialised())
+ HandleGiveDeviceVendorId(command);
break;
case CEC_OPCODE_DEVICE_VENDOR_ID:
break;
case CEC_OPCODE_DEVICE_VENDOR_ID:
-
bHandlerChanged =
HandleDeviceVendorId(command);
+ HandleDeviceVendorId(command);
break;
case CEC_OPCODE_VENDOR_COMMAND_WITH_ID:
HandleDeviceVendorCommandWithId(command);
break;
case CEC_OPCODE_GIVE_DECK_STATUS:
break;
case CEC_OPCODE_VENDOR_COMMAND_WITH_ID:
HandleDeviceVendorCommandWithId(command);
break;
case CEC_OPCODE_GIVE_DECK_STATUS:
- HandleGiveDeckStatus(command);
+ if (m_processor->IsInitialised())
+ HandleGiveDeckStatus(command);
break;
case CEC_OPCODE_DECK_CONTROL:
HandleDeckControl(command);
break;
case CEC_OPCODE_MENU_REQUEST:
break;
case CEC_OPCODE_DECK_CONTROL:
HandleDeckControl(command);
break;
case CEC_OPCODE_MENU_REQUEST:
- HandleMenuRequest(command);
+ if (m_processor->IsInitialised())
+ HandleMenuRequest(command);
break;
case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS:
break;
case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS:
- HandleGiveDevicePowerStatus(command);
+ if (m_processor->IsInitialised())
+ HandleGiveDevicePowerStatus(command);
break;
case CEC_OPCODE_GET_CEC_VERSION:
break;
case CEC_OPCODE_GET_CEC_VERSION:
- HandleGetCecVersion(command);
+ if (m_processor->IsInitialised())
+ HandleGetCecVersion(command);
break;
case CEC_OPCODE_USER_CONTROL_PRESSED:
break;
case CEC_OPCODE_USER_CONTROL_PRESSED:
- HandleUserControlPressed(command);
+ if (m_processor->IsInitialised())
+ HandleUserControlPressed(command);
break;
case CEC_OPCODE_USER_CONTROL_RELEASE:
break;
case CEC_OPCODE_USER_CONTROL_RELEASE:
- HandleUserControlRelease(command);
+ if (m_processor->IsInitialised())
+ HandleUserControlRelease(command);
break;
case CEC_OPCODE_GIVE_AUDIO_STATUS:
break;
case CEC_OPCODE_GIVE_AUDIO_STATUS:
- HandleGiveAudioStatus(command);
+ if (m_processor->IsInitialised())
+ HandleGiveAudioStatus(command);
break;
case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS:
break;
case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS:
- HandleGiveSystemAudioModeStatus(command);
+ if (m_processor->IsInitialised())
+ HandleGiveSystemAudioModeStatus(command);
break;
case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST:
break;
case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST:
- HandleSystemAudioModeRequest(command);
+ if (m_processor->IsInitialised())
+ HandleSystemAudioModeRequest(command);
break;
case CEC_OPCODE_REPORT_AUDIO_STATUS:
HandleReportAudioStatus(command);
break;
case CEC_OPCODE_REPORT_AUDIO_STATUS:
HandleReportAudioStatus(command);
@@
-134,7
+149,8
@@
bool CCECCommandHandler::HandleCommand(const cec_command &command)
HandleSetSystemAudioMode(command);
break;
case CEC_OPCODE_REQUEST_ACTIVE_SOURCE:
HandleSetSystemAudioMode(command);
break;
case CEC_OPCODE_REQUEST_ACTIVE_SOURCE:
- HandleRequestActiveSource(command);
+ if (m_processor->IsInitialised())
+ HandleRequestActiveSource(command);
break;
case CEC_OPCODE_SET_STREAM_PATH:
HandleSetStreamPath(command);
break;
case CEC_OPCODE_SET_STREAM_PATH:
HandleSetStreamPath(command);
@@
-146,7
+162,8
@@
bool CCECCommandHandler::HandleCommand(const cec_command &command)
HandleRoutingInformation(command);
break;
case CEC_OPCODE_STANDBY:
HandleRoutingInformation(command);
break;
case CEC_OPCODE_STANDBY:
- HandleStandby(command);
+ if (m_processor->IsInitialised())
+ HandleStandby(command);
break;
case CEC_OPCODE_ACTIVE_SOURCE:
HandleActiveSource(command);
break;
case CEC_OPCODE_ACTIVE_SOURCE:
HandleActiveSource(command);
@@
-175,10
+192,12
@@
bool CCECCommandHandler::HandleCommand(const cec_command &command)
break;
}
break;
}
- if (bHandled
&& !bHandlerChanged
)
+ if (bHandled)
{
CLockObject lock(&m_receiveMutex);
{
CLockObject lock(&m_receiveMutex);
- m_condition.Signal();
+ if (m_expectedResponse == CEC_OPCODE_NONE ||
+ m_expectedResponse == command.opcode)
+ m_condition.Signal();
}
MarkReady();
}
MarkReady();
@@
-733,7
+752,7
@@
bool CCECCommandHandler::TransmitRequestCecVersion(const cec_logical_address iIn
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GET_CEC_VERSION);
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GET_CEC_VERSION);
- return Transmit(command);
+ return Transmit(command
, true, CEC_OPCODE_CEC_VERSION
);
}
bool CCECCommandHandler::TransmitRequestMenuLanguage(const cec_logical_address iInitiator, const cec_logical_address iDestination)
}
bool CCECCommandHandler::TransmitRequestMenuLanguage(const cec_logical_address iInitiator, const cec_logical_address iDestination)
@@
-741,7
+760,7
@@
bool CCECCommandHandler::TransmitRequestMenuLanguage(const cec_logical_address i
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GET_MENU_LANGUAGE);
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GET_MENU_LANGUAGE);
- return Transmit(command);
+ return Transmit(command
, true, CEC_OPCODE_SET_MENU_LANGUAGE
);
}
bool CCECCommandHandler::TransmitRequestOSDName(const cec_logical_address iInitiator, const cec_logical_address iDestination)
}
bool CCECCommandHandler::TransmitRequestOSDName(const cec_logical_address iInitiator, const cec_logical_address iDestination)
@@
-749,7
+768,7
@@
bool CCECCommandHandler::TransmitRequestOSDName(const cec_logical_address iIniti
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_OSD_NAME);
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_OSD_NAME);
- return Transmit(command);
+ return Transmit(command
, true, CEC_OPCODE_SET_OSD_NAME
);
}
bool CCECCommandHandler::TransmitRequestPhysicalAddress(const cec_logical_address iInitiator, const cec_logical_address iDestination)
}
bool CCECCommandHandler::TransmitRequestPhysicalAddress(const cec_logical_address iInitiator, const cec_logical_address iDestination)
@@
-757,7
+776,7
@@
bool CCECCommandHandler::TransmitRequestPhysicalAddress(const cec_logical_addres
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_PHYSICAL_ADDRESS);
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_PHYSICAL_ADDRESS);
- return Transmit(command);
+ return Transmit(command
, true, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
);
}
bool CCECCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination)
}
bool CCECCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination)
@@
-765,7
+784,7
@@
bool CCECCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iI
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_DEVICE_POWER_STATUS);
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_DEVICE_POWER_STATUS);
- return Transmit(command);
+ return Transmit(command
, true, CEC_OPCODE_REPORT_POWER_STATUS
);
}
bool CCECCommandHandler::TransmitRequestVendorId(const cec_logical_address iInitiator, const cec_logical_address iDestination)
}
bool CCECCommandHandler::TransmitRequestVendorId(const cec_logical_address iInitiator, const cec_logical_address iDestination)
@@
-773,7
+792,7
@@
bool CCECCommandHandler::TransmitRequestVendorId(const cec_logical_address iInit
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
- return Transmit(command);
+ return Transmit(command
, true, CEC_OPCODE_DEVICE_VENDOR_ID
);
}
bool CCECCommandHandler::TransmitActiveSource(const cec_logical_address iInitiator, uint16_t iPhysicalAddress)
}
bool CCECCommandHandler::TransmitActiveSource(const cec_logical_address iInitiator, uint16_t iPhysicalAddress)
@@
-932,9
+951,10
@@
bool CCECCommandHandler::TransmitKeyRelease(const cec_logical_address iInitiator
return Transmit(command, bWait);
}
return Transmit(command, bWait);
}
-bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /* = true */)
+bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /* = true */
, cec_opcode expectedResponse /* = CEC_OPCODE_NONE */
)
{
bool bReturn(false);
{
bool bReturn(false);
+ MarkBusy();
command.transmit_timeout = m_iTransmitTimeout;
{
command.transmit_timeout = m_iTransmitTimeout;
{
@@
-944,6
+964,7
@@
bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /*
++m_iUseCounter;
while (!bReturn && ++iTries <= iMaxTries)
{
++m_iUseCounter;
while (!bReturn && ++iTries <= iMaxTries)
{
+ m_expectedResponse = expectedResponse;
if (m_processor->Transmit(command))
{
m_processor->AddLog(CEC_LOG_DEBUG, "command transmitted");
if (m_processor->Transmit(command))
{
m_processor->AddLog(CEC_LOG_DEBUG, "command transmitted");
@@
-955,10
+976,11
@@
bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /*
--m_iUseCounter;
}
--m_iUseCounter;
}
+ MarkReady();
return bReturn;
}
return bReturn;
}
-bool CCECCommandHandler::
InitHandler
(void)
+bool CCECCommandHandler::
ActivateSource
(void)
{
if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
{
{
if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
{