Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
opdenkamp committed Jan 28, 2017
2 parents 39ec280 + 0a97062 commit d54093a
Show file tree
Hide file tree
Showing 22 changed files with 138 additions and 40 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "support"]
path = support
url = https://github.com/Pulse-Eight/libcec-support.git
[submodule "src/dotnet"]
path = src/dotnet
url = https://github.com/Pulse-Eight/cec-dotnet.git
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.9)

set(LIBCEC_VERSION_MAJOR 4)
set(LIBCEC_VERSION_MINOR 0)
set(LIBCEC_VERSION_PATCH 1)
set(LIBCEC_VERSION_PATCH 2)

# cec-client
add_subdirectory(src/cec-client)
Expand Down
16 changes: 16 additions & 0 deletions debian/changelog.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
libcec (4.0.2.1~#DIST#) #DIST#; urgency=medium

* fixed:
* windows: device detection. credits: @Portisch
* don't automatically assume that an AVR is active in some situations
* don't take Panasonic's vendor id when emulating an AVR
* drm EDID parser not compiled in. credits @gdachs
* python: have Swig generate Python threading support
* python: only pass unsigned
* python: allow empty callback parameters
* python: install demo app as executable
* python: correct install path. credits @Lo0k @mkreisl. #284 #288 #289 #291
* python: possible crash when passing an invalid callback

-- Pulse-Eight Packaging <[email protected]> Mon, 23 Jan 2017 16:28:00 +0100

libcec (4.0.1.1~#DIST#) #DIST#; urgency=medium

* fixed:
Expand Down
2 changes: 1 addition & 1 deletion debian/libcec4-dev.install
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
usr/include
usr/lib/pkgconfig
usr/lib/*/pkgconfig
usr/lib/*/*.so
2 changes: 1 addition & 1 deletion debian/python-libcec.install
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
usr/lib/python*/dist-packages/cec/*
usr/bin/*.py
usr/bin/pyCecClient
8 changes: 7 additions & 1 deletion docs/README.osx.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
## Apple OS X

### MacPorts

libCEC is available through [MacPorts] (https://www.macports.org/) and has been tested on OS X 10.9 through 10.12

### Prerequisites
To compile libCEC on OS X, you'll need the following dependencies:
* [p8-platform] (https://github.com/Pulse-Eight/platform) 2.0 or later
* [cmake 2.6 or better] (http://www.cmake.org/)
* a supported C++ 11 compiler
* a supported C++ 11 compiler. Support for C++11 was added in OS X 10.9
* xcode 3.2.6 or later
* optional: [Python 3.4 or later] (https://www.python.org/) and [Swig] (http://www.swig.org/) to generate Python bindings
* optional: libX11 and xrandr to read the sink's EDID, used to determine the PC's HDMI physical address

### Compilation
To compile, execute the following command:
Expand Down
36 changes: 34 additions & 2 deletions project/libCEC.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,11 @@ Section "CEC Debug Client" SecCecClient

; Copy to the installation directory
SetOutPath "$INSTDIR"
File "..\build\x86\*.exe"
File "..\build\x86\cec-client.exe"
File "..\build\x86\cecc-client.exe"
SetOutPath "$INSTDIR\x64"
File /nonfatal "..\build\amd64\*.exe"
File /nonfatal "..\build\amd64\cec-client.exe"
File /nonfatal "..\build\amd64\cecc-client.exe"

!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetOutPath "$INSTDIR"
Expand All @@ -162,6 +164,35 @@ Section "CEC Debug Client" SecCecClient

SectionEnd

Section "libCEC Tray" SecDotNet
SetShellVarContext current
SectionIn 1 3

; Copy to the installation directory
SetOutPath "$INSTDIR"
File "..\build\x86\CecSharpTester.exe"
File "..\build\x86\cec-tray.exe"
SetOutPath "$INSTDIR\x64"
File /nonfatal "..\build\amd64\CecSharpTester.exe"
File /nonfatal "..\build\amd64\cec-tray.exe"

!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetOutPath "$INSTDIR"

CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
${If} ${RunningX64}
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\cec-tray.lnk" "$INSTDIR\x64\cec-tray.exe" \
"" "$INSTDIR\x64\cec-tray.exe" 0 SW_SHOWNORMAL \
"" "Start libCEC Tray (x64)."
${Else}
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\cec-tray.lnk" "$INSTDIR\cec-tray.exe" \
"" "$INSTDIR\cec-tray.exe" 0 SW_SHOWNORMAL \
"" "Start libCEC Tray."
${EndIf}
!insertmacro MUI_STARTMENU_WRITE_END

SectionEnd

Section "Python bindings" SecPythonCec
SetShellVarContext current
SectionIn 1 3
Expand Down Expand Up @@ -319,6 +350,7 @@ Section "Uninstall"
${If} ${RunningX64}
Delete "$SMPROGRAMS\$StartMenuFolder\libCEC Tray (x64).lnk"
${EndIf}
Delete "$SMPROGRAMS\$StartMenuFolder\cec-tray.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk"
${If} ${RunningX64}
Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk"
Expand Down
1 change: 1 addition & 0 deletions src/dotnet
Submodule dotnet added at 180cbe
5 changes: 3 additions & 2 deletions 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 Expand Up @@ -164,7 +165,7 @@ else()
${CMAKE_INSTALL_PREFIX}/include)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libcec.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/pkgconfig)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()

# install headers
Expand Down
28 changes: 17 additions & 11 deletions src/libcec/SwigHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
*/

#define SWIG_FILE_WITH_INIT
#define SWIG_PYTHON_THREADS
#define SWIG_PYTHON_USE_GIL
#define LIBCEC_SWIG_EXPORTS

#include "cectypes.h"
Expand Down Expand Up @@ -99,29 +101,33 @@ namespace CEC
* Call a python callback (if set)
* @param callback the callback to call
* @param arglist the arguments to pass to the callback
* @return 1 when processed, 0 otherwise
* @return 0 if the callback failed, the result returned by python otherwise
*/
int CallPythonCallback(enum libcecSwigCallback callback, PyObject* arglist)
{
assert(callback < NB_PYTHON_CB);
assert(arglist);
int retval = 0;

if (!m_callbacks[callback])
return 0;
if (callback >= NB_PYTHON_CB || !m_callbacks[callback])
return retval;

PyObject* result = NULL;
if (m_callbacks[callback] && arglist)
if (m_callbacks[callback])
{
/** call the callback */
result = PyEval_CallObject(m_callbacks[callback], arglist);

/** unref the argument and result */
Py_DECREF(arglist);
if (result)
if (!!arglist)
Py_DECREF(arglist);
if (!!result)
{
if (PyInt_Check(result))
retval = (int)PyInt_AsLong(result);
Py_XDECREF(result);
}
}

return 1;
return retval;
}

/**
Expand Down Expand Up @@ -180,7 +186,7 @@ namespace CEC
{
PyGILState_STATE gstate = PyGILState_Ensure();
int retval = CallPythonCallback(param, PYTHON_CB_MENU_STATE,
Py_BuildValue("(i)", state));
Py_BuildValue("(I)", state));
PyGILState_Release(gstate);
return retval;
}
Expand All @@ -189,7 +195,7 @@ namespace CEC
{
PyGILState_STATE gstate = PyGILState_Ensure();
CallPythonCallback(param, PYTHON_CB_SOURCE_ACTIVATED,
Py_BuildValue("(I,i)", logicalAddress, activated ? 1 : 0));
Py_BuildValue("(I,I)", logicalAddress, activated));
PyGILState_Release(gstate);
}

Expand Down
6 changes: 3 additions & 3 deletions src/libcec/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ uint16_t CUSBCECAdapterCommunication::GetPhysicalAddress(void)
uint16_t iPA(0);

// try to get the PA from ADL
#if defined(HAS_ADL_EDID_PARSER)
#if defined(HAVE_ADL_EDID_PARSER)
{
LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s - trying to get the physical address via ADL", __FUNCTION__);
CADLEdidParser adl;
Expand All @@ -678,7 +678,7 @@ uint16_t CUSBCECAdapterCommunication::GetPhysicalAddress(void)
#endif

// try to get the PA from the nvidia driver
#if defined(HAS_NVIDIA_EDID_PARSER)
#if defined(HAVE_NVIDIA_EDID_PARSER)
if (iPA == 0)
{
LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s - trying to get the physical address via nvidia driver", __FUNCTION__);
Expand All @@ -689,7 +689,7 @@ uint16_t CUSBCECAdapterCommunication::GetPhysicalAddress(void)
#endif

// try to get the PA from the intel driver
#if defined(HAS_DRM_EDID_PARSER)
#if defined(HAVE_DRM_EDID_PARSER)
if (iPA == 0)
{
LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s - trying to get the physical address via drm files", __FUNCTION__);
Expand Down
12 changes: 7 additions & 5 deletions src/libcec/adapter/Pulse-Eight/USBCECAdapterDetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,15 @@ static bool GetComPortFromDevNode(DEVINST hDevInst, char* strPortName, unsigned

static bool GetPidVidFromDeviceName(const std::string strDevName, int* vid, int* pid)
{
size_t iPidPos = strDevName.find("PID_");
size_t iVidPos = strDevName.find("VID_");
if (iPidPos == std::string::npos || iVidPos == std::string::npos || (strDevName.find("&MI_") != std::string::npos && strDevName.find("&MI_00") == std::string::npos))
std::string strDevNameUpper(strDevName);
StringUtils::ToUpper(strDevNameUpper);
size_t iPidPos = strDevNameUpper.find("PID_");
size_t iVidPos = strDevNameUpper.find("VID_");
if (iPidPos == std::string::npos || iVidPos == std::string::npos || (strDevNameUpper.find("&MI_") != std::string::npos && strDevNameUpper.find("&MI_00") == std::string::npos))
return false;

std::string strVendorId(strDevName.substr(iVidPos + 4, 4));
std::string strProductId(strDevName.substr(iPidPos + 4, 4));
std::string strVendorId(strDevNameUpper.substr(iVidPos + 4, 4));
std::string strProductId(strDevNameUpper.substr(iPidPos + 4, 4));

sscanf(strVendorId.c_str(), "%x", vid);
sscanf(strProductId.c_str(), "%x", pid);
Expand Down
11 changes: 8 additions & 3 deletions src/libcec/cmake/CheckPlatformSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ else()
# Swig
find_package(SWIG)
if (PYTHONLIBS_FOUND AND SWIG_FOUND)
set(CMAKE_SWIG_FLAGS "")
set(CMAKE_SWIG_FLAGS "-threads")
set(HAVE_PYTHON 1)
if ("${PYTHONLIBS_VERSION_STRING}" STREQUAL "")
message(STATUS "Python version not found, defaulting to 2.7")
Expand All @@ -194,10 +194,15 @@ else()
DESTINATION python/cec
RENAME __init__.py)
else()
if(EXISTS "/etc/lsb-release")
SET(PYTHON_PKG_DIR "dist-packages")
else()
SET(PYTHON_PKG_DIR "site-packages")
endif()
install(TARGETS ${SWIG_MODULE_cec_REAL_NAME}
DESTINATION lib/python${PYTHON_VERSION}/dist-packages/cec)
DESTINATION lib/python${PYTHON_VERSION}/${PYTHON_PKG_DIR}/cec)
install(FILES ${CMAKE_BINARY_DIR}/src/libcec/cec.py
DESTINATION lib/python${PYTHON_VERSION}/dist-packages/cec
DESTINATION lib/python${PYTHON_VERSION}/${PYTHON_PKG_DIR}/cec
RENAME __init__.py)
endif()
endif()
Expand Down
4 changes: 2 additions & 2 deletions src/libcec/cmake/DisplayPlatformSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ else()
endif()

if (HAVE_AOCEC_API)
message(STATUS "AOCEC support: yes")
message(STATUS "AOCEC support: yes")
else()
message(STATUS "AOCEC support: no")
message(STATUS "AOCEC support: no")
endif()

if (HAVE_PYTHON)
Expand Down
2 changes: 1 addition & 1 deletion src/libcec/implementations/CECCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ int CCECCommandHandler::HandleUserControlPressed(const cec_command &command)
else if (command.parameters[0] != CEC_USER_CONTROL_CODE_POWER_OFF_FUNCTION)
{
// we're not marked as active source, but the tv sends keypresses to us, so assume it forgot to activate us
if (!device->IsActiveSource() && command.initiator == CECDEVICE_TV)
if (!device->IsActiveSource() && command.initiator == CECDEVICE_TV && command.destination != CECDEVICE_AUDIOSYSTEM)
device->MarkAsActiveSource();
}

Expand Down
3 changes: 2 additions & 1 deletion src/libcec/implementations/VLCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ bool CVLCommandHandler::InitHandler(void)
/* use the VL commandhandler for the primary device that is handled by libCEC */
if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
{
if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress() &&
primary->GetLogicalAddress() != CECDEVICE_AUDIOSYSTEM)
{
libcec_configuration config;
m_processor->GetPrimaryClient()->GetCurrentConfiguration(config);
Expand Down
4 changes: 4 additions & 0 deletions src/libcec/platform/adl/adl-edid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include "env.h"
#include "adl-edid.h"

#if defined(HAVE_ADL_EDID_PARSER)

// for dlsym and friends
#if defined(__WINDOWS__)
#include <p8-platform/windows/dlfcn-win32.h>
Expand Down Expand Up @@ -203,3 +205,5 @@ uint16_t CADLEdidParser::GetPhysicalAddress(void)

return iPA;
}

#endif
2 changes: 1 addition & 1 deletion src/libcec/platform/adl/adl-edid.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/

#include "env.h"
#define HAS_ADL_EDID_PARSER
#define HAVE_ADL_EDID_PARSER

#include "platform/util/edid.h"

Expand Down
6 changes: 5 additions & 1 deletion src/libcec/platform/nvidia/nv-edid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
*/

#include "env.h"
#include "nv-edid.h"

#if defined(HAVE_NVIDIA_EDID_PARSER)

#include <p8-platform/os.h>
#include "nv-edid.h"
#include <stdio.h>

using namespace P8PLATFORM;
Expand Down Expand Up @@ -66,3 +68,5 @@ uint16_t CNVEdidParser::GetPhysicalAddress(void)

return iPA;
}

#endif
2 changes: 1 addition & 1 deletion src/libcec/platform/nvidia/nv-edid.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/

#include "env.h"
#define HAS_NVIDIA_EDID_PARSER
#define HAVE_NVIDIA_EDID_PARSER

#include "platform/util/edid.h"

Expand Down
7 changes: 4 additions & 3 deletions src/pyCecClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ find_package(PythonLibs)

if (PYTHONLIBS_FOUND)
if (WIN32)
install(FILES pyCecClient.py
install(PROGRAMS pyCecClient.py
DESTINATION python/.)
else()
install(FILES pyCecClient.py
DESTINATION bin/.)
install(PROGRAMS pyCecClient.py
DESTINATION bin/.
RENAME pyCecClient)
endif()
endif()
Loading

0 comments on commit d54093a

Please sign in to comment.