Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new RainShadow adapter #286

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/README.linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,17 @@ Pass the argument `-DHAVE_AOCEC_API=1` to the cmake command in the compilation i
cmake -DHAVE_AOCEC_API=1 ..
```

### RainShadow
Pass the argument `-DHAVE_RAINSHADOW_API=1` to the cmake command in the compilation instructions:
```
cmake -DHAVE_RAINSHADOW_API=1 ..
```

### TDA995x
Pass the argument `-DHAVE_TDA995X_API=1` to the cmake command in the compilation instructions:
```
cmake -DHAVE_TDA995X_API=1 ..
```

### Debian / Ubuntu .deb packaging
See [docs/README.debian.md](README.debian.md).
See [docs/README.debian.md](README.debian.md).
13 changes: 12 additions & 1 deletion include/cectypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,16 @@ namespace CEC {
*/
#define CEC_AOCEC_VIRTUAL_COM "AOCEC"

/*!
* the path to use for the RainShadow HDMI CEC device
*/
#define CEC_RAINSHADOW_PATH "/dev/ttyACM0"

/*!
* the name of the virtual COM port to use for the RainShadow' CEC wire
*/
#define CEC_RAINSHADOW_VIRTUAL_COM "RainShadow"

/*!
* Mimimum client version
*/
Expand Down Expand Up @@ -861,7 +871,8 @@ typedef enum cec_adapter_type
ADAPTERTYPE_RPI = 0x100,
ADAPTERTYPE_TDA995x = 0x200,
ADAPTERTYPE_EXYNOS = 0x300,
ADAPTERTYPE_AOCEC = 0x500
ADAPTERTYPE_AOCEC = 0x500,
ADAPTERTYPE_RAINSHADOW = 0x700
} cec_adapter_type;

/** force exporting through swig */
Expand Down
3 changes: 2 additions & 1 deletion src/libcec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ set(CEC_SOURCES_IMPLEMENTATIONS implementations/ANCommandHandler.cpp

# /platform/*
set(CEC_SOURCES_PLATFORM platform/adl/adl-edid.cpp
platform/nvidia/nv-edid.cpp)
platform/nvidia/nv-edid.cpp
platform/drm/drm-edid.cpp)

# headers
set(CEC_EXT_HEADERS ${PROJECT_SOURCE_DIR}/../../include/cec.h
Expand Down
25 changes: 23 additions & 2 deletions src/libcec/adapter/AdapterFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
#include "AOCEC/AOCECAdapterCommunication.h"
#endif

#if defined(HAVE_RAINSHADOW_API)
#include "RainShadow/RainAdapterDetection.h"
#include "RainShadow/RainAdapterCommunication.h"
#endif

using namespace CEC;

int8_t CAdapterFactory::FindAdapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */)
Expand Down Expand Up @@ -143,8 +148,19 @@ int8_t CAdapterFactory::DetectAdapters(cec_adapter_descriptor *deviceList, uint8
}
#endif

#if defined(HAVE_RAINSHADOW_API)
if (!CRainAdapterDetection::CanAutodetect())
{
if (m_lib)
m_lib->AddLog(CEC_LOG_WARNING, "libCEC has not been compiled with detection code for the RAINSHADOW USB-CEC Adapter, so the path to the COM port has to be provided to libCEC if this adapter is being used");
}
else
iAdaptersFound += CRainAdapterDetection::FindAdapters(&deviceList[iAdaptersFound], iBufSize, strDevicePath);
#else
m_lib->AddLog(CEC_LOG_WARNING, "libCEC has not been compiled with support for the RainShadow USB-CEC Adapter");
#endif

#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_AOCEC_API)
#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_AOCEC_API) && !defined(HAVE_RAINSHADOW_API)
#error "libCEC doesn't have support for any type of adapter. please check your build system or configuration"
#endif

Expand All @@ -168,6 +184,11 @@ IAdapterCommunication *CAdapterFactory::GetInstance(const char *strPort, uint16_
return new CAOCECAdapterCommunication(m_lib->m_cec);
#endif

#if defined(HAVE_RAINSHADOW_API)
if (CRainAdapterDetection::isItMe(strPort))
return new CRainAdapterCommunication(m_lib->m_cec, strPort, iBaudRate);
#endif

#if defined(HAVE_RPI_API)
if (!strcmp(strPort, CEC_RPI_VIRTUAL_COM))
return new CRPiCECAdapterCommunication(m_lib->m_cec);
Expand All @@ -177,7 +198,7 @@ IAdapterCommunication *CAdapterFactory::GetInstance(const char *strPort, uint16_
return new CUSBCECAdapterCommunication(m_lib->m_cec, strPort, iBaudRate);
#endif

#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_EXYNOS_API) && !defined(HAVE_AOCEC_API)
#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_EXYNOS_API) && !defined(HAVE_AOCEC_API) && !defined(HAVE_RAINSHADOW_API)
return NULL;
#endif
}
Expand Down
38 changes: 38 additions & 0 deletions src/libcec/adapter/RainShadow/Rain.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#pragma once
/*
* This file is part of the libCEC(R) library.
*
* libCEC RainShadow Code Copyright (C) 2017 Gerald Dachs
* based heavily on:
* libCEC Exynos Code Copyright (C) 2014 Valentin Manea
* libCEC(R) is Copyright (C) 2011-2015 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 <[email protected]>
* http://www.pulse-eight.com/
* http://www.pulse-eight.net/
*/


#define CEC_MAX_FRAME_SIZE 16
Loading