From: Lars Op den Kamp Date: Tue, 3 Jan 2012 12:58:03 +0000 (+0100) Subject: cec: only switch handlers once when using the generic handler X-Git-Tag: upstream/2.2.0~1^2~42^2~12 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=cf4931be43a04e39ae7041e115f5a07cec530031;p=deb_libcec.git cec: only switch handlers once when using the generic handler --- diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index a2ce01d..044cd9c 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -655,6 +655,7 @@ bool CCECBusDevice::ReplaceHandler(bool bActivateSource /* = true */) break; } + m_handler->SetVendorId(m_vendor); m_handler->InitHandler(); if (bActivateSource && m_processor->GetLogicalAddresses().IsSet(m_iLogicalAddress) && m_processor->IsInitialised()) diff --git a/src/lib/implementations/ANCommandHandler.h b/src/lib/implementations/ANCommandHandler.h index 0207a63..8966c1a 100644 --- a/src/lib/implementations/ANCommandHandler.h +++ b/src/lib/implementations/ANCommandHandler.h @@ -42,9 +42,6 @@ namespace CEC virtual ~CANCommandHandler(void) {}; virtual bool HandleCommand(const cec_command &command); - - virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_SAMSUNG; }; - protected: virtual bool HandleVendorRemoteButtonDown(const cec_command &command); }; diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 336baba..9f442be 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -48,7 +48,8 @@ CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice) : m_bHandlerInited(false), m_iUseCounter(0), m_expectedResponse(CEC_OPCODE_NONE), - m_bOPTSendDeckStatusUpdateOnActiveSource(true) + m_bOPTSendDeckStatusUpdateOnActiveSource(true), + m_vendorId(CEC_VENDOR_UNKNOWN) { } diff --git a/src/lib/implementations/CECCommandHandler.h b/src/lib/implementations/CECCommandHandler.h index 70763c8..afd1315 100644 --- a/src/lib/implementations/CECCommandHandler.h +++ b/src/lib/implementations/CECCommandHandler.h @@ -48,7 +48,8 @@ namespace CEC virtual ~CCECCommandHandler(void); virtual bool HandleCommand(const cec_command &command); - virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_UNKNOWN; }; + virtual cec_vendor_id GetVendorId(void) { return m_vendorId; }; + virtual void SetVendorId(cec_vendor_id vendorId) { m_vendorId = vendorId; } virtual void HandlePoll(const cec_logical_address iInitiator, const cec_logical_address iDestination); virtual bool HandleReceiveFailed(void); @@ -142,6 +143,7 @@ namespace CEC uint8_t m_iUseCounter; cec_opcode m_expectedResponse; bool m_bOPTSendDeckStatusUpdateOnActiveSource; + cec_vendor_id m_vendorId; CMutex m_receiveMutex; CCondition m_condition; }; diff --git a/src/lib/implementations/SLCommandHandler.cpp b/src/lib/implementations/SLCommandHandler.cpp index 31376e5..7a357d3 100644 --- a/src/lib/implementations/SLCommandHandler.cpp +++ b/src/lib/implementations/SLCommandHandler.cpp @@ -54,6 +54,7 @@ CSLCommandHandler::CSLCommandHandler(CCECBusDevice *busDevice) : m_bSLEnabled(false), m_bPowerStateReset(false) { + m_vendorId = CEC_VENDOR_LG; CCECBusDevice *primary = m_processor->GetPrimaryDevice(); /* imitate LG devices */ diff --git a/src/lib/implementations/SLCommandHandler.h b/src/lib/implementations/SLCommandHandler.h index 8243d98..e398dc8 100644 --- a/src/lib/implementations/SLCommandHandler.h +++ b/src/lib/implementations/SLCommandHandler.h @@ -40,7 +40,6 @@ namespace CEC public: CSLCommandHandler(CCECBusDevice *busDevice); virtual ~CSLCommandHandler(void) {}; - virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_LG; }; virtual void HandlePoll(const cec_logical_address iInitiator, const cec_logical_address iDestination); virtual bool HandleReceiveFailed(void); diff --git a/src/lib/implementations/VLCommandHandler.cpp b/src/lib/implementations/VLCommandHandler.cpp index dfef4a0..6a6bad2 100644 --- a/src/lib/implementations/VLCommandHandler.cpp +++ b/src/lib/implementations/VLCommandHandler.cpp @@ -39,6 +39,7 @@ using namespace CEC; CVLCommandHandler::CVLCommandHandler(CCECBusDevice *busDevice) : CCECCommandHandler(busDevice) { + m_vendorId = CEC_VENDOR_PANASONIC; m_bOPTSendDeckStatusUpdateOnActiveSource = false; } diff --git a/src/lib/implementations/VLCommandHandler.h b/src/lib/implementations/VLCommandHandler.h index 9ed71cb..cff1da4 100644 --- a/src/lib/implementations/VLCommandHandler.h +++ b/src/lib/implementations/VLCommandHandler.h @@ -40,7 +40,6 @@ namespace CEC public: CVLCommandHandler(CCECBusDevice *busDevice); virtual ~CVLCommandHandler(void) {}; - virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_PANASONIC; }; virtual bool InitHandler(void); }; };