From: Lars Op den Kamp Date: Tue, 21 Feb 2012 12:10:49 +0000 (+0100) Subject: cec: added Toshiba's vendor id, and set the device ID of the primary device to Toshib... X-Git-Tag: upstream/2.2.0~1^2~33^2~39 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=26555d6bbea6ae577653bc05df8162e8d00e6151;p=deb_libcec.git cec: added Toshiba's vendor id, and set the device ID of the primary device to Toshiba's and transmit it when starting --- diff --git a/include/cectypes.h b/include/cectypes.h index 5f25b94..5b05b13 100644 --- a/include/cectypes.h +++ b/include/cectypes.h @@ -620,6 +620,7 @@ typedef enum cec_vendor_id CEC_VENDOR_YAMAHA = 0x00A0DE, CEC_VENDOR_PHILIPS = 0x00903E, CEC_VENDOR_SONY = 0x080046, + CEC_VENDOR_TOSHIBA = 0x000039, CEC_VENDOR_UNKNOWN = 0 } cec_vendor_id; diff --git a/project/libcec.vcxproj b/project/libcec.vcxproj index 0ca4cca..3c1e89b 100644 --- a/project/libcec.vcxproj +++ b/project/libcec.vcxproj @@ -36,6 +36,7 @@ + @@ -66,6 +67,7 @@ + diff --git a/project/libcec.vcxproj.filters b/project/libcec.vcxproj.filters index a85f501..56f1a46 100644 --- a/project/libcec.vcxproj.filters +++ b/project/libcec.vcxproj.filters @@ -128,6 +128,9 @@ adapter + + implementations + @@ -173,6 +176,9 @@ adapter + + implementations + diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 63009a8..ae0a013 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -1363,6 +1363,8 @@ const char *CCECProcessor::ToString(const cec_vendor_id vendor) return "Philips"; case CEC_VENDOR_SONY: return "Sony"; + case CEC_VENDOR_TOSHIBA: + return "Toshiba"; default: return "Unknown"; } diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 5df7c60..083775f 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -23,6 +23,7 @@ libcec_la_SOURCES = CECProcessor.cpp \ implementations/CECCommandHandler.cpp \ implementations/SLCommandHandler.cpp \ implementations/VLCommandHandler.cpp \ + implementations/RLCommandHandler.cpp \ platform/posix/serialport.cpp libcec_la_LDFLAGS = @LIBS@ -version-info @VERSION@ diff --git a/src/lib/devices/CECBusDevice.h b/src/lib/devices/CECBusDevice.h index 5428ec1..30ac2dc 100644 --- a/src/lib/devices/CECBusDevice.h +++ b/src/lib/devices/CECBusDevice.h @@ -40,12 +40,10 @@ namespace CEC { class CCECProcessor; class CCECCommandHandler; - class CSLCommandHandler; class CCECBusDevice { friend class CCECProcessor; - friend class CSLCommandHandler; public: CCECBusDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0); @@ -108,9 +106,10 @@ namespace CEC virtual bool TransmitKeypress(cec_user_control_code key, bool bWait = true); virtual bool TransmitKeyRelease(bool bWait = true); + bool ReplaceHandler(bool bActivateSource = true); + protected: void CheckVendorIdRequested(void); - bool ReplaceHandler(bool bActivateSource = true); void MarkBusy(void); void MarkReady(void); diff --git a/src/lib/implementations/RLCommandHandler.cpp b/src/lib/implementations/RLCommandHandler.cpp new file mode 100644 index 0000000..c7e4682 --- /dev/null +++ b/src/lib/implementations/RLCommandHandler.cpp @@ -0,0 +1,70 @@ +/* + * This file is part of the libCEC(R) library. + * + * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved. + * libCEC(R) is an original work, containing original code. + * + * libCEC(R) is a trademark of Pulse-Eight Limited. + * + * This program is dual-licensed; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + * Alternatively, you can license this library under a commercial license, + * please contact Pulse-Eight Licensing for more information. + * + * For more information contact: + * Pulse-Eight Licensing + * http://www.pulse-eight.com/ + * http://www.pulse-eight.net/ + */ + +#include "RLCommandHandler.h" +#include "../devices/CECBusDevice.h" +#include "../CECProcessor.h" +#include "../LibCEC.h" + +using namespace CEC; +using namespace PLATFORM; + +CRLCommandHandler::CRLCommandHandler(CCECBusDevice *busDevice) : + CCECCommandHandler(busDevice) +{ + m_vendorId = CEC_VENDOR_PANASONIC; + CCECBusDevice *primary = m_processor->GetPrimaryDevice(); + + /* imitate Panasonice devices */ + if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress()) + { + primary->SetVendorId(CEC_VENDOR_PANASONIC); + primary->ReplaceHandler(false); + } +} + +bool CRLCommandHandler::InitHandler(void) +{ + if (m_bHandlerInited) + return true; + m_bHandlerInited = true; + + if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV) + { + CCECBusDevice *primary = m_processor->GetPrimaryDevice(); + + /* send the vendor id */ + primary->TransmitVendorID(CECDEVICE_BROADCAST); + } + + return true; +} diff --git a/src/lib/implementations/RLCommandHandler.h b/src/lib/implementations/RLCommandHandler.h new file mode 100644 index 0000000..944a649 --- /dev/null +++ b/src/lib/implementations/RLCommandHandler.h @@ -0,0 +1,47 @@ +#pragma once +/* + * This file is part of the libCEC(R) library. + * + * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved. + * libCEC(R) is an original work, containing original code. + * + * libCEC(R) is a trademark of Pulse-Eight Limited. + * + * This program is dual-licensed; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + * Alternatively, you can license this library under a commercial license, + * please contact Pulse-Eight Licensing for more information. + * + * For more information contact: + * Pulse-Eight Licensing + * http://www.pulse-eight.com/ + * http://www.pulse-eight.net/ + */ + +#include "CECCommandHandler.h" +#include "../platform/util/timeutils.h" + +namespace CEC +{ + class CRLCommandHandler : public CCECCommandHandler + { + public: + CRLCommandHandler(CCECBusDevice *busDevice); + virtual ~CRLCommandHandler(void) {}; + + virtual bool InitHandler(void); + }; +};