├── .github └── workflows │ └── stale.yml ├── .gitignore ├── .gitmodules ├── AUTHORS ├── CMakeLists.txt ├── ChangeLog ├── Doxyfile ├── LICENSE.md ├── README.md ├── cmake ├── CrossCompile.cmake ├── PkgConfigHandler.cmake ├── UseMultiArch.cmake └── WindowsDebug.cmake ├── debian ├── cec-client.1 ├── cec-utils.install ├── cec-utils.manpages ├── changelog.in ├── compat ├── control ├── copyright ├── libcec-get-orig-source ├── libcec4-dev.install ├── libcec4.install ├── pulse-eight-usb-cec.udev ├── python-libcec.install ├── rules ├── source │ ├── format │ ├── lintian-overrides │ └── options └── watch ├── docs ├── README.debian.md ├── README.developers.md ├── README.linux.md ├── README.osx.md ├── README.raspberrypi.md └── README.windows.md ├── include ├── cec.h ├── cecc.h ├── ceccloader.h ├── cecloader.h ├── cectypes.h └── version.h.in ├── project ├── eventghost.nsi ├── favicon.ico ├── libCEC.nsi ├── libcec.sln └── nsis │ ├── cec-tray.nsh │ ├── eventghost.nsh │ ├── functions.nsh │ ├── libcec-pdb.nsh │ ├── libcec-version.nsh.in │ ├── sections.nsh │ ├── uninstall.nsh │ └── vc_redist.nsh ├── src ├── EventGhost │ └── egplugin_sources │ │ ├── PulseEight │ │ ├── __init__.py │ │ ├── cec.png │ │ ├── cec_classes.py │ │ └── controls.py │ │ └── info.py ├── cec-client │ ├── CMakeLists.txt │ ├── cec-client.cpp │ ├── curses │ │ ├── CursesControl.cpp │ │ └── CursesControl.h │ └── env.h.in ├── cecc-client │ ├── CMakeLists.txt │ ├── cecc-client.c │ └── env.h.in ├── dotnetlib │ ├── CecSharpTypes.h │ ├── CecSharpTypesUnmanaged.h │ ├── LibCecSharp.cpp │ ├── LibCecSharp │ │ ├── .gitignore │ │ ├── AssemblyInfo.cpp.in │ │ ├── LibCecSharp.rc.in │ │ ├── LibCecSharp.vcxproj │ │ ├── LibCecSharp.vcxproj.filters │ │ └── resource.h │ └── LibCecSharpCore │ │ ├── .gitignore │ │ ├── AssemblyInfo.cpp.in │ │ ├── LibCecSharpCore.vcxproj │ │ ├── LibCecSharpCore.vcxproj.filters │ │ ├── Resource.h │ │ └── app.rc ├── libcec │ ├── CECClient.cpp │ ├── CECClient.h │ ├── CECInputBuffer.h │ ├── CECProcessor.cpp │ ├── CECProcessor.h │ ├── CECTypeUtils.h │ ├── CMakeLists.txt │ ├── LibCEC.cpp │ ├── LibCEC.h │ ├── LibCECC.cpp │ ├── LibCECDll.cpp │ ├── SwigHelper.h │ ├── adapter │ │ ├── AOCEC │ │ │ ├── AOCEC.h │ │ │ ├── AOCECAdapterCommunication.cpp │ │ │ ├── AOCECAdapterCommunication.h │ │ │ ├── AOCECAdapterDetection.cpp │ │ │ └── AOCECAdapterDetection.h │ │ ├── AdapterCommunication.h │ │ ├── AdapterFactory.cpp │ │ ├── AdapterFactory.h │ │ ├── Exynos │ │ │ ├── ExynosCEC.h │ │ │ ├── ExynosCECAdapterCommunication.cpp │ │ │ ├── ExynosCECAdapterCommunication.h │ │ │ ├── ExynosCECAdapterDetection.cpp │ │ │ └── ExynosCECAdapterDetection.h │ │ ├── IMX │ │ │ ├── IMXCEC.h │ │ │ ├── IMXCECAdapterCommunication.cpp │ │ │ ├── IMXCECAdapterCommunication.h │ │ │ ├── IMXCECAdapterDetection.cpp │ │ │ └── IMXCECAdapterDetection.h │ │ ├── Linux │ │ │ ├── LinuxCECAdapterCommunication.cpp │ │ │ ├── LinuxCECAdapterCommunication.h │ │ │ ├── LinuxCECAdapterDetection.cpp │ │ │ └── LinuxCECAdapterDetection.h │ │ ├── Pulse-Eight │ │ │ ├── USBCECAdapterCommands.cpp │ │ │ ├── USBCECAdapterCommands.h │ │ │ ├── USBCECAdapterCommunication.cpp │ │ │ ├── USBCECAdapterCommunication.h │ │ │ ├── USBCECAdapterDetection.cpp │ │ │ ├── USBCECAdapterDetection.h │ │ │ ├── USBCECAdapterMessage.cpp │ │ │ ├── USBCECAdapterMessage.h │ │ │ ├── USBCECAdapterMessageQueue.cpp │ │ │ └── USBCECAdapterMessageQueue.h │ │ ├── RPi │ │ │ ├── RPiCECAdapterCommunication.cpp │ │ │ ├── RPiCECAdapterCommunication.h │ │ │ ├── RPiCECAdapterDetection.cpp │ │ │ ├── RPiCECAdapterDetection.h │ │ │ ├── RPiCECAdapterMessageQueue.cpp │ │ │ └── RPiCECAdapterMessageQueue.h │ │ ├── TDA995x │ │ │ ├── AdapterMessageQueue.h │ │ │ ├── TDA995xCECAdapterCommunication.cpp │ │ │ ├── TDA995xCECAdapterCommunication.h │ │ │ ├── TDA995xCECAdapterDetection.cpp │ │ │ └── TDA995xCECAdapterDetection.h │ │ └── Tegra │ │ │ ├── AdapterMessageQueue.h │ │ │ ├── TegraCECAdapterCommunication.cpp │ │ │ ├── TegraCECAdapterCommunication.h │ │ │ ├── TegraCECAdapterDetection.cpp │ │ │ ├── TegraCECAdapterDetection.h │ │ │ └── TegraCECDev.h │ ├── cmake │ │ ├── CheckPlatformSupport.cmake │ │ ├── DisplayPlatformSupport.cmake │ │ ├── LinkPlatformSupport.cmake │ │ ├── SetBuildInfo.cmake │ │ ├── __init__.py │ │ └── git-rev.sh │ ├── devices │ │ ├── CECAudioSystem.cpp │ │ ├── CECAudioSystem.h │ │ ├── CECBusDevice.cpp │ │ ├── CECBusDevice.h │ │ ├── CECDeviceMap.cpp │ │ ├── CECDeviceMap.h │ │ ├── CECPlaybackDevice.cpp │ │ ├── CECPlaybackDevice.h │ │ ├── CECRecordingDevice.cpp │ │ ├── CECRecordingDevice.h │ │ ├── CECTV.cpp │ │ ├── CECTV.h │ │ ├── CECTuner.cpp │ │ └── CECTuner.h │ ├── env.h.in │ ├── implementations │ │ ├── ANCommandHandler.cpp │ │ ├── ANCommandHandler.h │ │ ├── AQCommandHandler.cpp │ │ ├── AQCommandHandler.h │ │ ├── CECCommandHandler.cpp │ │ ├── CECCommandHandler.h │ │ ├── PHCommandHandler.cpp │ │ ├── PHCommandHandler.h │ │ ├── RHCommandHandler.cpp │ │ ├── RHCommandHandler.h │ │ ├── RLCommandHandler.cpp │ │ ├── RLCommandHandler.h │ │ ├── SLCommandHandler.cpp │ │ ├── SLCommandHandler.h │ │ ├── VLCommandHandler.cpp │ │ └── VLCommandHandler.h │ ├── libcec.i │ ├── libcec.pc.in │ ├── libcec.rc.in │ └── platform │ │ ├── X11 │ │ ├── randr-edid.cpp │ │ └── randr-edid.h │ │ ├── adl │ │ ├── adl-edid.cpp │ │ ├── adl-edid.h │ │ ├── adl_defines.h │ │ ├── adl_sdk.h │ │ └── adl_structures.h │ │ ├── drm │ │ ├── drm-edid.cpp │ │ └── drm-edid.h │ │ ├── nvidia │ │ ├── nv-edid.cpp │ │ └── nv-edid.h │ │ ├── posix │ │ ├── os-edid.cpp │ │ └── serialport.cpp │ │ ├── sockets │ │ └── serialport.h │ │ ├── util │ │ ├── baudrate.h │ │ └── edid.h │ │ └── windows │ │ ├── os-edid.cpp │ │ ├── serialport.cpp │ │ └── stdint.h └── pyCecClient │ ├── CMakeLists.txt │ └── pyCecClient.py ├── systemd ├── cec-active-source.service ├── cec-active-source.timer └── cec-poweroff-tv.service └── windows ├── build-all.cmd ├── build-lib.cmd ├── create-installer.cmd ├── eventghost.cmd ├── nsis-helper.cmd └── visual-studio.cmd /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: Close stale issues and pull requests 2 | 3 | on: 4 | schedule: 5 | - cron: '30 * * * *' 6 | 7 | jobs: 8 | stale: 9 | 10 | runs-on: ubuntu-latest 11 | permissions: 12 | issues: write 13 | pull-requests: write 14 | 15 | steps: 16 | - uses: actions/stale@v9 17 | with: 18 | repo-token: ${{ secrets.GITHUB_TOKEN }} 19 | days-before-stale: 90 20 | days-before-close: 1 21 | operations-per-run: 500 22 | stale-issue-message: "This issue has now been marked as stale because there hasn't been any activity for 90 days. Please test if this issue is still relevant when using the [latest version of libCEC](https://github.com/Pulse-Eight/libcec/releases/tag/libcec-7.0.0) and remove the stale label or add a comment to reset the stale state." 23 | stale-issue-label: 'stale' 24 | stale-pr-message: "This pull request has now been marked as stale because there hasn't been any activity for 90 days. Please check if this pull request is still relevant when using the [latest version of libCEC](https://github.com/Pulse-Eight/libcec/releases/tag/libcec-7.0.0) and remove the stale label or add a comment to reset the stale state." 25 | stale-pr-label: 'stale' 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.vscode 2 | /build 3 | /cmake-build 4 | /.cproject 5 | /.project 6 | /.settings 7 | /compile 8 | *.dll 9 | *.exe 10 | *.exp 11 | *.ilk 12 | *.lib 13 | *.manifest 14 | *.metagen 15 | *.ncb 16 | *.opensdf 17 | *.pdb 18 | *.suo 19 | *.user 20 | *.aps 21 | *.swp 22 | env.h 23 | version.h 24 | .vs 25 | 26 | AssemblyInfo.cs 27 | AssemblyInfo.cpp 28 | 29 | *~ 30 | tags 31 | cscope.* 32 | 33 | /support/private 34 | 35 | /driver/p8usb-cec.cat 36 | /bootloader-driver/p8_usb_dfu.cat 37 | 38 | aclocal.m4 39 | autom4te.cache 40 | config.guess 41 | config.log 42 | config.status 43 | config.sub 44 | depcomp 45 | configure 46 | install-sh 47 | INSTALL 48 | libtool 49 | ltmain.sh 50 | Makefile 51 | Makefile.in 52 | missing 53 | config.h 54 | config.h.in 55 | config.h.in~ 56 | stamp-h1 57 | 58 | /debian/*.log 59 | /debian/*.substvars 60 | /debian/*.debhelper 61 | /debian/files 62 | /debian/cec-utils 63 | /debian/libcec-dev 64 | /debian/libcec 65 | /debian/libcec2 66 | /debian/tmp 67 | 68 | include/boost 69 | 70 | project/bin 71 | project/Debug/ 72 | project/*.exe 73 | project/Release/ 74 | project/ipch/ 75 | project/libcec.sdf 76 | project/obj 77 | project/Properties 78 | project/_* 79 | project/x64 80 | project/libcec/x64 81 | project/libcec/Debug 82 | project/libcec/Release 83 | project/testclient/x64 84 | project/testclient/Debug 85 | project/testclient/Release 86 | project/nsis/libcec-version.nsh 87 | 88 | project/RPi/toolchain 89 | project/RPi/firmware 90 | project/RPi/deps 91 | 92 | src/libcec/libcec.pc 93 | src/libcec/libcec.rc 94 | 95 | src/cec-config-gui/obj 96 | src/cec-config/cec-config 97 | src/cec-config/*.o 98 | src/cec-config/.deps 99 | 100 | src/libcec-wmc/bin 101 | src/libcec-wmc/obj 102 | 103 | /dpinst-x86.exe 104 | /dpinst-amd64.exe 105 | 106 | /documentation 107 | 108 | /src/EventGhost/egplugin_sources/PulseEight/cec 109 | /src/EventGhost/pulse_eight.egplugin 110 | 111 | /src/dotnetlib/LibCecSharp/LibCecSharp.rc 112 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/platform"] 2 | path = src/platform 3 | url = https://github.com/Pulse-Eight/platform 4 | [submodule "support"] 5 | path = support 6 | url = https://github.com/Pulse-Eight/libcec-support.git 7 | [submodule "src/dotnet"] 8 | path = src/dotnet 9 | url = https://github.com/Pulse-Eight/cec-dotnet.git 10 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Lars Op den Kamp 2 | Bob van Loosen 3 | Martin Ellis -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12.0) 2 | project(libcec) 3 | 4 | set(LIBCEC_VERSION_MAJOR 7) 5 | set(LIBCEC_VERSION_MINOR 0) 6 | set(LIBCEC_VERSION_PATCH 0) 7 | 8 | # cec-client 9 | add_subdirectory(src/cec-client) 10 | add_dependencies(cec-client cec) 11 | 12 | # cecc-client 13 | add_subdirectory(src/cecc-client) 14 | add_dependencies(cecc-client cec) 15 | 16 | # pyCecClient 17 | add_subdirectory(src/pyCecClient) 18 | 19 | # libCEC 20 | add_subdirectory(src/libcec) 21 | 22 | # version number 23 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/version.h.in 24 | ${CMAKE_CURRENT_SOURCE_DIR}/include/version.h) 25 | 26 | # windows specific files 27 | if(WIN32) 28 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/project/nsis/libcec-version.nsh.in 29 | ${CMAKE_CURRENT_SOURCE_DIR}/project/nsis/libcec-version.nsh) 30 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/dotnetlib/LibCecSharp/LibCecSharp.rc.in 31 | ${CMAKE_CURRENT_SOURCE_DIR}/src/dotnetlib/LibCecSharp/LibCecSharp.rc) 32 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/dotnetlib/LibCecSharp/AssemblyInfo.cpp.in 33 | ${CMAKE_CURRENT_SOURCE_DIR}/src/dotnetlib/LibCecSharp/AssemblyInfo.cpp) 34 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/dotnetlib/LibCecSharpCore/AssemblyInfo.cpp.in 35 | ${CMAKE_CURRENT_SOURCE_DIR}/src/dotnetlib/LibCecSharpCore/AssemblyInfo.cpp) 36 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/dotnet/src/LibCecTray/LibCECTray.csproj.in 37 | ${CMAKE_CURRENT_SOURCE_DIR}/src/dotnet/src/LibCecTray/LibCECTray.csproj) 38 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/dotnet/src/LibCecTray/Properties/AssemblyInfo.cs.in 39 | ${CMAKE_CURRENT_SOURCE_DIR}/src/dotnet/src/LibCecTray/Properties/AssemblyInfo.cs) 40 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/dotnet/src/CecSharpTester/netcore/CecSharpCoreTester.csproj.in 41 | ${CMAKE_CURRENT_SOURCE_DIR}/src/dotnet/src/CecSharpTester/netcore/CecSharpCoreTester.csproj) 42 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/dotnet/src/CecSharpTester/netfx/CecSharpTester.csproj.in 43 | ${CMAKE_CURRENT_SOURCE_DIR}/src/dotnet/src/CecSharpTester/netfx/CecSharpTester.csproj) 44 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/dotnet/src/CecSharpTester/netfx/Properties/AssemblyInfo.cs.in 45 | ${CMAKE_CURRENT_SOURCE_DIR}/src/dotnet/src/CecSharpTester/netfx/Properties/AssemblyInfo.cs) 46 | endif() 47 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | See debian/changelog.in 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Pulse-Eight logo](https://pulseeight.files.wordpress.com/2016/02/pulse-eight-logo-white-on-green.png?w=200) 2 | 3 | # About 4 | This library provides support for Pulse-Eight's USB-CEC adapter and other CEC capable hardware, like the Raspberry Pi. 5 | 6 | A list of FAQ (Frequently Asked Questions) can be found on [libCEC's FAQ page](http://libcec.pulse-eight.com/faq). 7 | 8 | .Net client applications, previously part of this repository, have been moved to [this repository](https://github.com/Pulse-Eight/cec-dotnet). 9 | 10 | # Supported platforms 11 | 12 | ## Linux & BSD 13 | See [docs/README.linux.md](docs/README.linux.md). 14 | 15 | ## Apple OS X 16 | See [docs/README.osx.md](docs/README.osx.md). 17 | 18 | ## Microsoft Windows 19 | See [docs/README.windows.md](docs/README.windows.md). 20 | 21 | # Supported hardware 22 | * [Pulse-Eight USB-CEC Adapter](https://www.pulse-eight.com/p/104/usb-hdmi-cec-adapter) 23 | * [Pulse-Eight Intel NUC CEC Adapter](https://www.pulse-eight.com/p/154/intel-nuc-hdmi-cec-adapter) 24 | * [Pulse-Eight CEC Adapter for Skull Canyon and Hades Canyon NUC systems](https://www.pulse-eight.com/p/207/skull-canyon-nuc-cec-adapter) 25 | * [Raspberry Pi](https://www.raspberrypi.org/) 26 | * Some Exynos SoCs 27 | * NXP TDA995x 28 | * Odroid C2 (Amlogic S905) 29 | 30 | # Developers 31 | See [docs/README.developers.md](docs/README.developers.md). 32 | 33 | # Vendor specific notes 34 | 35 | ## Panasonic 36 | * On Panasonic to enable media control buttons on bottom of the remote, you may have to change the operation mode. To change it, press bottom Power-button, keep it pressed, and press 7 3 Stop. After releasing Power-button, Play, Pause, etc should work in XBMC. 37 | 38 | ## Raspberry Pi 39 | * If your TV cannot detect the Raspberry Pi's CEC, or if the the Pi can't detect the TV, try adding the following line in `/boot/config.txt` and reboot the Pi: `hdmi_force_hotplug=1` 40 | -------------------------------------------------------------------------------- /cmake/CrossCompile.cmake: -------------------------------------------------------------------------------- 1 | SET(XCOMPILE_BASE_PATH "" CACHE STRING "Path to the compiler") 2 | SET(XCOMPILE_PREFIX "arm-bcm2708hardfp-linux-gnueabi-" CACHE STRING "Toolchain prefix") 3 | SET(XCOMPILE_LIB_PATH "" CACHE STRING "Path to the libraries") 4 | 5 | SET(CMAKE_SYSTEM_NAME Linux) 6 | SET(CMAKE_SYSTEM_VERSION 1) 7 | 8 | # specify the cross compiler 9 | SET(CMAKE_C_COMPILER ${XCOMPILE_BASE_PATH}/bin/${XCOMPILE_PREFIX}gcc) 10 | 11 | SET(CMAKE_CXX_COMPILER ${XCOMPILE_BASE_PATH}/bin/${XCOMPILE_PREFIX}g++) 12 | 13 | # where is the target environment 14 | SET(CMAKE_FIND_ROOT_PATH ${XCOMPILE_LIB_PATH}) 15 | 16 | -------------------------------------------------------------------------------- /cmake/UseMultiArch.cmake: -------------------------------------------------------------------------------- 1 | # - Multiarch support in object code library directories 2 | # 3 | # This module sets the following variable 4 | # CMAKE_INSTALL_LIBDIR to lib, lib64 or lib/x86_64-linux-gnu 5 | # depending on the platform; use this path 6 | # for platform-specific binaries. 7 | # 8 | # CMAKE_INSTALL_LIBDIR_NOARCH to lib or lib64 depending on the platform; 9 | # use this path for architecture-independent 10 | # files. 11 | # 12 | # Note that it will override the results of GNUInstallDirs if included after 13 | # that module. 14 | 15 | # Fedora uses lib64/ for 64-bit systems, Debian uses lib/x86_64-linux-gnu; 16 | # Fedora put module files in lib64/ too, but Debian uses lib/ for that 17 | if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" AND 18 | "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr") 19 | # Debian or Ubuntu? 20 | if (EXISTS "/etc/debian_version") 21 | set (_libdir_def "lib/${CMAKE_LIBRARY_ARCHITECTURE}") 22 | set (_libdir_noarch "lib") 23 | elseif (EXISTS "/etc/fedora-release" OR 24 | EXISTS "/etc/redhat-release" OR 25 | EXISTS "/etc/slackware-version") 26 | # 64-bit system? 27 | if (CMAKE_SIZEOF_VOID_P EQUAL 8) 28 | set (_libdir_noarch "lib64") 29 | else (CMAKE_SIZEOF_VOID_P EQUAL 8) 30 | set (_libdir_noarch "lib") 31 | endif (CMAKE_SIZEOF_VOID_P EQUAL 8) 32 | set (_libdir_def "${_libdir_noarch}") 33 | else () 34 | set (_libdir_def "lib") 35 | set (_libdir_noarch "lib") 36 | endif () 37 | else () 38 | set (_libdir_def "lib") 39 | set (_libdir_noarch "lib") 40 | endif () 41 | 42 | # let the user override if somewhere else is desirable 43 | set (CMAKE_INSTALL_LIBDIR "${_libdir_def}" CACHE PATH "Object code libraries") 44 | set (CMAKE_INSTALL_LIBDIR_NOARCH "${_libdir_noarch}" CACHE PATH "Architecture-independent library files") 45 | mark_as_advanced ( 46 | CMAKE_INSTALL_LIBDIR 47 | CMAKE_INSTALL_LIBDIR_NOARCH 48 | ) 49 | 50 | -------------------------------------------------------------------------------- /cmake/WindowsDebug.cmake: -------------------------------------------------------------------------------- 1 | if(WIN32) 2 | if (MSVC) 3 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_HAS_ITERATOR_DEBUGGING=1 /D_SECURE_SCL=1") 4 | add_compile_definitions($<$:_ITERATOR_DEBUG_LEVEL=2>) 5 | add_compile_definitions($<$:_HAS_ITERATOR_DEBUGGING=1>) 6 | endif(MSVC) 7 | endif(WIN32) 8 | -------------------------------------------------------------------------------- /debian/cec-client.1: -------------------------------------------------------------------------------- 1 | .TH CEC-CLIENT "1" "January 2012" "User Commands" 2 | .SH NAME 3 | cec\-client \- CEC connection client utility 4 | .SH DESCRIPTION 5 | cec\-client {\-h|\-\-help|\-l|\-\-list\-devices|[COM PORT]} 6 | .SS "parameters:" 7 | .TP 8 | \fB\-h\fR \fB\-\-help\fR 9 | Shows this help text 10 | .TP 11 | \fB\-l\fR \fB\-\-list\-devices\fR 12 | List all devices on this system 13 | .TP 14 | \fB\-t\fR \fB\-\-type\fR {p|r|t|a} 15 | The device type to use. More than one is possible. 16 | .TP 17 | \fB\-p\fR \fB\-\-port\fR {int} 18 | The HDMI port to use as active source. 19 | .TP 20 | \fB\-b\fR \fB\-\-base\fR {int} 21 | The logical address of the device to with this 22 | adapter is connected. 23 | .TP 24 | \fB\-f\fR \fB\-\-log\-file\fR {file} 25 | Writes all libCEC log message to a file 26 | .TP 27 | \fB\-sf\fR \fB\-\-short\-log\-file\fR {file} Writes all libCEC log message without timestamps 28 | and log levels to a file. 29 | .TP 30 | \fB\-d\fR \fB\-\-log\-level\fR {level} 31 | Sets the log level. See cectypes.h for values. 32 | .TP 33 | \fB\-s\fR \fB\-\-single\-command\fR 34 | Execute a single command and exit. Does not power 35 | on devices on startup and power them off on exit. 36 | .TP 37 | [COM PORT] 38 | The com port to connect to. If no COM 39 | port is given, the client tries to connect to the 40 | first device that is detected. 41 | .PP 42 | Type 'h' or 'help' and press enter after starting the client to display all 43 | available commands 44 | -------------------------------------------------------------------------------- /debian/cec-utils.install: -------------------------------------------------------------------------------- 1 | usr/bin/cec-client* 2 | -------------------------------------------------------------------------------- /debian/cec-utils.manpages: -------------------------------------------------------------------------------- 1 | debian/cec-client.1 2 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: libcec 2 | Section: libs 3 | Priority: optional 4 | Maintainer: Lars Op den Kamp 5 | Build-Depends: debhelper (>= 7), 6 | pkg-config, 7 | libudev-dev, 8 | libp8-platform-dev, 9 | python-dev, 10 | cmake (>= 2.8.9), 11 | swig, 12 | libxrandr-dev, 13 | x11proto-core-dev, 14 | libncurses5-dev 15 | Standards-Version: 3.8.4 16 | Homepage: http://libcec.pulse-eight.com/ 17 | Vcs-Git: git://anonscm.debian.org/collab-maint/libcec.git 18 | Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/libcec.git 19 | 20 | Package: libcec4-dev 21 | Architecture: any 22 | Section: libdevel 23 | Depends: libcec4 (= ${binary:Version}), 24 | ${misc:Depends} 25 | Replaces: libcec-dev 26 | Provides: libcec-dev 27 | Description: libCEC communication Library (development files) 28 | This library provides support for the Pulse-Eight USB-CEC adapter. 29 | . 30 | This package provides the necessary files needed for development. 31 | 32 | Package: libcec4 33 | Architecture: any 34 | Multi-Arch: same 35 | Pre-Depends: ${misc:Pre-Depends} 36 | Depends: ${shlibs:Depends}, ${misc:Depends} 37 | Description: libCEC communication Library (shared library) 38 | This library provides support for the Pulse-Eight USB-CEC adapter. 39 | . 40 | This package provides the shared library. 41 | 42 | Package: cec-utils 43 | Architecture: any 44 | Section: utils 45 | Depends: libcec4 (= ${binary:Version}), 46 | ${shlibs:Depends}, 47 | ${misc:Depends} 48 | Description: libCEC communication Library (utility programs) 49 | This library provides support for the Pulse-Eight USB-CEC adapter. 50 | . 51 | This package provides the CEC utility programs. 52 | 53 | Package: python-libcec 54 | Architecture: any 55 | Section: python 56 | Pre-Depends: ${misc:Pre-Depends} 57 | Depends: libcec4 (= ${binary:Version}) 58 | Description: Python bindings for libCEC 59 | This library provides Python bindings for libCEC. 60 | . 61 | This package provides Python bindings for libCEC. 62 | 63 | Package: libcec 64 | Architecture: any 65 | Depends: ${shlibs:Depends}, ${misc:Depends}, libcec4 (= ${binary:Version}) 66 | Description: Meta package libCEC. 67 | 68 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://dep.debian.net/deps/dep5/ 2 | Upstream-Name: libcec 3 | Upstream-Contact: Lars Op den Kamp 4 | Source: https://github.com/Pulse-Eight/libcec 5 | 6 | Files: * 7 | Copyright: 2011-2012 Pulse-Eight Limited. 8 | License: GPL-2+ or other 9 | libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved. 10 | libCEC(R) is a original work, containing original code. 11 | . 12 | libCEC(R) is a trademark of Pulse-Eight Limited. 13 | . 14 | This program is dual-licensed; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2 of the License, or 17 | (at your option) any later version. 18 | . 19 | This program is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | . 24 | You should have received a copy of the GNU General Public License 25 | along with this program. If not, see . 26 | . 27 | Alternatively, you can license this library under a commercial license, 28 | please contact Pulse-Eight Licensing for more information. 29 | . 30 | On Debian systems, the full text of the GNU General Public License 31 | version 2 can be found in the file 32 | '/usr/share/common-licenses/GPL-2'. 33 | 34 | Files: lib/platform/windows/dlfcn-win32.* 35 | Copyright: 2007 Ramiro Polla 36 | License: LGPL-2.1+ 37 | This library is free software; you can redistribute it and/or 38 | modify it under the terms of the GNU Lesser General Public 39 | License as published by the Free Software Foundation; either 40 | version 2.1 of the License, or (at your option) any later version. 41 | . 42 | This library is distributed in the hope that it will be useful, 43 | but WITHOUT ANY WARRANTY; without even the implied warranty of 44 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 45 | Lesser General Public License for more details. 46 | . 47 | You should have received a copy of the GNU Lesser General Public License 48 | along with this program. If not, see . 49 | . 50 | On Debian systems, the full text of the GNU Lesser General Public License 51 | version 2.1 can be found in the file 52 | '/usr/share/common-licenses/LGPL-2.1'. 53 | 54 | Files: lib/util/StdString.h 55 | Copyright: 2002 Joseph M. O'Leary 56 | License: other 57 | This code is 100% free. Use it anywhere you 58 | want. Rewrite it, restructure it, whatever. If you can write software 59 | that makes money off of it, good for you. I kinda like capitalism. 60 | Please don't blame me if it causes your $30 billion dollar satellite 61 | explode in orbit. If you redistribute it in any form, I'd appreciate it 62 | if you would leave this notice here. 63 | 64 | Files: debian/* 65 | Copyright: 2011, Andres Mejia 66 | License: GPL-2+ 67 | This Program is free software; you can redistribute it and/or modify 68 | it under the terms of the GNU General Public License as published by 69 | the Free Software Foundation; either version 2, or (at your option) 70 | any later version. 71 | . 72 | This Program is distributed in the hope that it will be useful, 73 | but WITHOUT ANY WARRANTY; without even the implied warranty of 74 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 75 | GNU General Public License for more details. 76 | . 77 | You should have received a copy of the GNU General Public License 78 | along with this program. If not, see . 79 | . 80 | On Debian systems, the full text of the GNU General Public License 81 | version 2 can be found in the file 82 | '/usr/share/common-licenses/GPL-2'. 83 | -------------------------------------------------------------------------------- /debian/libcec-get-orig-source: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Script used to generate the orig source tarball for libcec. 4 | 5 | LIBCEC_GIT_URL="git://github.com/Pulse-Eight/libcec.git" 6 | LIBCEC_GIT_BRANCH="release" 7 | LIBCEC_VERSION="2.2.0" 8 | 9 | rm -rf "libcec-${LIBCEC_VERSION}" 10 | git clone "$LIBCEC_GIT_URL" "libcec-${LIBCEC_VERSION}" 11 | cd "libcec-${LIBCEC_VERSION}" 12 | git checkout -b "$LIBCEC_GIT_BRANCH" origin/"$LIBCEC_GIT_BRANCH" 13 | autoreconf -vif 14 | cd .. 15 | 16 | # Remove temp files and other cruft from source tarball 17 | # The find command snippet here was taken from debhelper's dh_clean command 18 | # with some modification to delete more unneeded files. 19 | echo "Removing temp files and other cruft from source tarball" 20 | find libcec-${LIBCEC_VERSION} \( \( -type f -a \ 21 | \( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \ 22 | -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \ 23 | -o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \ 24 | -o -name TAGS -o \( -path '*/.deps/*' -a -name '*.P' \) \ 25 | -o -name config.status -o -name config.cache -o -name config.log \ 26 | \) -exec rm -f "{}" \; \) -o \ 27 | \( -type d -a -name autom4te.cache -prune -exec rm -rf "{}" \; \) \) 28 | rm -rf libcec-${LIBCEC_VERSION}/.git 29 | rm -f libcec-${LIBCEC_VERSION}/.gitignore 30 | rm -rf libcec-${LIBCEC_VERSION}/debian 31 | 32 | # Remove empty directories 33 | echo "Removing empty directories" 34 | find libcec-${LIBCEC_VERSION} -type d -empty -delete 35 | 36 | tar --exclude-vcs -czf "libcec_${LIBCEC_VERSION}.orig.tar.gz" \ 37 | "libcec-${LIBCEC_VERSION}/" 38 | -------------------------------------------------------------------------------- /debian/libcec4-dev.install: -------------------------------------------------------------------------------- 1 | usr/include 2 | usr/lib/*/pkgconfig 3 | usr/lib/*/*.so 4 | -------------------------------------------------------------------------------- /debian/libcec4.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libcec.so.* 2 | -------------------------------------------------------------------------------- /debian/pulse-eight-usb-cec.udev: -------------------------------------------------------------------------------- 1 | # ModemManager and mtp probe should ignore USB-CEC adapters 2 | ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2548", ATTRS{idProduct}=="1001", ENV{ID_MM_DEVICE_INORE}="1", ENV{MTP_NO_PROBE}="1" 3 | ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2548", ATTRS{idProduct}=="1002", ENV{ID_MM_DEVICE_INORE}="1", ENV{MTP_NO_PROBE}="1" 4 | -------------------------------------------------------------------------------- /debian/python-libcec.install: -------------------------------------------------------------------------------- 1 | usr/lib*{/*,}/python*/dist-packages/cec/* 2 | usr/bin/pyCecClient 3 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | # Uncomment this to turn on verbose mode. 4 | #export DH_VERBOSE=1 5 | 6 | %: 7 | dh $@ 8 | 9 | 10 | override_dh_auto_configure: 11 | cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX=/usr 12 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /debian/source/lintian-overrides: -------------------------------------------------------------------------------- 1 | # Only Build-Depends on debhelper (>= 8.1.3~) is needed, so ignore this. 2 | libcec source: package-needs-versioned-debhelper-build-depends 9 3 | -------------------------------------------------------------------------------- /debian/source/options: -------------------------------------------------------------------------------- 1 | unapply-patches 2 | abort-on-upstream-changes 3 | -------------------------------------------------------------------------------- /debian/watch: -------------------------------------------------------------------------------- 1 | # There is currently no upstream source tarball. This package is generated 2 | # from upstream's git vcs. 3 | -------------------------------------------------------------------------------- /docs/README.debian.md: -------------------------------------------------------------------------------- 1 | ### Debian 2 | Use the following commands to create a Debian package: 3 | ``` 4 | sudo apt-get build-dep . # to install build dependencies 5 | sed "s/#DIST#/$(lsb_release -cs)/g" debian/changelog.in > debian/changelog 6 | dpkg-buildpackage --no-sign # omit this argument if you have a private key to sign with 7 | ``` 8 | -------------------------------------------------------------------------------- /docs/README.developers.md: -------------------------------------------------------------------------------- 1 | # Developers 2 | 3 | We provide a C, C++, Python and .NET CLR interface to the adapter. 4 | 5 | ## C++ developers 6 | * the API can be found in `include/cec.h` 7 | * an example implementation can be found on https://github.com/Pulse-Eight/libcec/blob/master/src/cec-client/cec-client.cpp 8 | 9 | ## C developers 10 | * the API can be found in `include/cecc.h` 11 | * an example implementation can be found on https://github.com/Pulse-Eight/libcec/blob/master/src/cecc-client/cecc-client.c 12 | 13 | ## .NET Framework developers 14 | * add a reference to LibCecSharp.dll for the target architecture (x86/amd64). It's installed to `C:\Program Files (x86)\Pulse-Eight\USB-CEC Adapter\netfx` by default 15 | * the minimum .Net Framework version required for LibCecSharp is 4.0 16 | * an example implementation can be found on https://github.com/Pulse-Eight/cec-dotnet/blob/master/src/CecSharpTester/CecSharpClient.cs 17 | 18 | ## .NET Core developers 19 | * add a reference to LibCecSharpCore.dll for the target architecture (x86/amd64). It's installed to `C:\Program Files (x86)\Pulse-Eight\USB-CEC Adapter\netcore` by default 20 | * the minimum .Net Core version required for LibCecSharpCore is 3.1 21 | * an example implementation can be found on https://github.com/Pulse-Eight/cec-dotnet/blob/master/src/CecSharpTester/CecSharpClient.cs 22 | 23 | ## Python developers 24 | * the API is exported to Python through Swig 25 | * an example implementation can be found on https://github.com/Pulse-Eight/libcec/blob/master/src/pyCecClient/pyCecClient.py 26 | 27 | # Developers Agreement 28 | 29 | If you wish to contribute to this project, you must first sign our contributors agreement. 30 | Please see [the contributors agreement](http://www.pulse-eight.com/contributors) for more information. 31 | -------------------------------------------------------------------------------- /docs/README.linux.md: -------------------------------------------------------------------------------- 1 | ## Linux & BSD 2 | 3 | ### Prerequisites 4 | libCEC needs the following dependencies in order to work correctly: 5 | * [p8-platform](https://github.com/Pulse-Eight/platform) 2.0 or later 6 | * udev v151 or later 7 | * cdc-acm support compiled into the kernel or available as module 8 | 9 | To compile libCEC on Linux, you'll need the following dependencies: 10 | * [cmake 2.6 or better](http://www.cmake.org/) 11 | * a supported C++ 11 compiler 12 | 13 | The following dependencies are recommended. Without them, the adapter can not 14 | be (fully) auto-detected. 15 | * pkg-config 16 | * udev development headers v151 or later 17 | * X randr development headers 18 | 19 | ### Compilation 20 | To compile libCEC on a new Debian/Ubuntu installation, follow these instructions: 21 | ``` 22 | apt-get update 23 | apt-get install cmake libudev-dev libxrandr-dev python-dev swig 24 | git clone https://github.com/Pulse-Eight/libcec.git 25 | mkdir libcec/build 26 | cd libcec/build 27 | cmake .. 28 | make -j4 29 | sudo make install 30 | sudo ldconfig 31 | ``` 32 | 33 | ### Raspberry Pi 34 | See [docs/README.raspberrypi.md](README.raspberrypi.md). 35 | 36 | ### Exynos 37 | Pass the argument `-DHAVE_EXYNOS_API=1` to the cmake command in the compilation instructions: 38 | ``` 39 | cmake -DHAVE_EXYNOS_API=1 .. 40 | ``` 41 | 42 | ### AOCEC 43 | Pass the argument `-DHAVE_AOCEC_API=1` to the cmake command in the compilation instructions: 44 | ``` 45 | cmake -DHAVE_AOCEC_API=1 .. 46 | ``` 47 | 48 | ### TDA995x 49 | Pass the argument `-DHAVE_TDA995X_API=1` to the cmake command in the compilation instructions: 50 | ``` 51 | cmake -DHAVE_TDA995X_API=1 .. 52 | ``` 53 | 54 | ### Linux CEC Framework (v4.10+) 55 | Pass the argument `-DHAVE_LINUX_API=1` to the cmake command in the compilation instructions: 56 | ``` 57 | cmake -DHAVE_LINUX_API=1 .. 58 | ``` 59 | 60 | ### Systemd 61 | Example systemd units for common use cases can be found in the [systemd folder](../systemd/). 62 | 63 | 64 | ### Debian / Ubuntu .deb packaging 65 | See [docs/README.debian.md](README.debian.md). 66 | -------------------------------------------------------------------------------- /docs/README.osx.md: -------------------------------------------------------------------------------- 1 | ## Apple OS X 2 | 3 | ### MacPorts 4 | 5 | libCEC is available through [MacPorts](https://www.macports.org/) and has been tested on OS X 10.9 through 10.12 6 | 7 | ### Prerequisites 8 | To compile libCEC on OS X, you'll need the following dependencies: 9 | * [p8-platform](https://github.com/Pulse-Eight/platform) 2.0 or later 10 | * [cmake 2.6 or better](http://www.cmake.org/) 11 | * a supported C++ 11 compiler. Support for C++11 was added in OS X 10.9 12 | * xcode 3.2.6 or later 13 | * optional: [Python 3.4 or later](https://www.python.org/) and [Swig](http://www.swig.org/) to generate Python bindings 14 | * optional: libX11 and xrandr to read the sink's EDID, used to determine the PC's HDMI physical address 15 | 16 | ### Compilation 17 | To compile, execute the following command: 18 | ``` 19 | mkdir build 20 | cd build 21 | cmake .. 22 | make 23 | sudo make install 24 | ``` 25 | 26 | _Note:_ You may need to copy pkg.m4 to your m4 sources directory 27 | -------------------------------------------------------------------------------- /docs/README.raspberrypi.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi 2 | 3 | ## Linux Kernel vs. Raspberry Pi driver 4 | On a recent Raspberry Pi that's using the `vc4_kms_3d` dtoverlay, you have to use the [Linux Kernel driver](#compilation-using-the-linux-kernel-driver) and disable the Raspberry Pi driver with `-DHAVE_RPI_API=0` to use CEC. 5 | 6 | ## Raspberry Pi driver 7 | If you're compiling the old Raspberry Pi API driver, then the path to the required headers and libraries can be set manually, in case it's not in a standard system directory: 8 | ``` 9 | cmake -DRPI_INCLUDE_DIR=/path/to/vc/include \ 10 | -DRPI_LIB_DIR=/path/to/vc/lib \ 11 | .. 12 | ``` 13 | 14 | The headers and libraries are installed in /opt/vc when using Raspbian, but they may be installed somewhere else when using another distribution. Please ask the distribution's maintainers for help in case compilation fails and you're not using Raspbian. 15 | 16 | If you're cross compiling, then you can set the correct toolchain like this (for the Raspberry Pi): 17 | ``` 18 | cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/CrossCompile.cmake \ 19 | -DXCOMPILE_BASE_PATH=/path/to/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi \ 20 | -DXCOMPILE_LIB_PATH=/path/to/firmware/hardfp/opt/vc/lib \ 21 | -DRPI_INCLUDE_DIR=/path/to/firmware/hardfp/opt/vc/include \ 22 | -DRPI_LIB_DIR=/path/to/firmware/hardfp/opt/vc/lib \ 23 | .. 24 | ``` 25 | 26 | ## Compilation using the Linux Kernel driver 27 | To compile libCEC on a new Raspbian installation, follow these instructions: 28 | ``` 29 | sudo apt-get update 30 | sudo apt-get -y install cmake libudev-dev libxrandr-dev python3-dev swig git 31 | cd 32 | git clone https://github.com/Pulse-Eight/platform.git 33 | mkdir platform/build 34 | cd platform/build 35 | cmake .. 36 | make 37 | sudo make install 38 | cd 39 | git clone https://github.com/Pulse-Eight/libcec.git 40 | mkdir libcec/build 41 | cd libcec/build 42 | cmake -DHAVE_LINUX_API=1 -DHAVE_RPI_API=0 .. 43 | make -j4 44 | sudo make install 45 | sudo ldconfig 46 | ``` 47 | 48 | ## Compilation using the old Raspberry Pi driver 49 | To compile libCEC on a new Raspbian installation, follow these instructions: 50 | ``` 51 | sudo apt-get update 52 | sudo apt-get -y install cmake libudev-dev libxrandr-dev python3-dev swig git 53 | cd 54 | git clone https://github.com/Pulse-Eight/platform.git 55 | mkdir platform/build 56 | cd platform/build 57 | cmake .. 58 | make 59 | sudo make install 60 | cd 61 | git clone https://github.com/Pulse-Eight/libcec.git 62 | mkdir libcec/build 63 | cd libcec/build 64 | cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib .. 65 | make -j4 66 | sudo make install 67 | sudo ldconfig 68 | ``` 69 | 70 | ## Examples 71 | Example implementations using libCEC can be found here: 72 | * [github.com/Pulse-Eight/libcec/blob/master/src/cec-client/cec-client.cpp](https://github.com/Pulse-Eight/libcec/blob/master/src/cec-client/cec-client.cpp) 73 | * [github.com/DrGeoff/cec_simplest](https://github.com/DrGeoff/cec_simplest) 74 | -------------------------------------------------------------------------------- /docs/README.windows.md: -------------------------------------------------------------------------------- 1 | ## Microsoft Windows 2 | 3 | ### Developing a .Net Framework application 4 | To develop a .Net Framework application that uses LibCecSharp: 5 | * download the latest binary version from [our website](http://libcec.pulse-eight.com/Downloads) 6 | * add a reference to LibCecSharp.dll for the target architecture (x86/amd64). It's installed to `C:\Program Files (x86)\Pulse-Eight\USB-CEC Adapter\netfx` by default 7 | * the minimum .Net Framework version required for LibCecSharp is 4.0 8 | 9 | An example implementation can be found on [Github](https://github.com/Pulse-Eight/cec-dotnet/tree/master/src/CecSharpTester/netfx/). 10 | 11 | ### Developing a .Net Core application 12 | To develop a .Net Core application that uses LibCecSharp: 13 | * download the latest binary version from [our website](http://libcec.pulse-eight.com/Downloads) 14 | * add a reference to LibCecSharpCore.dll for the target architecture (x86/amd64). It's installed to `C:\Program Files (x86)\Pulse-Eight\USB-CEC Adapter\netcore` by default 15 | * the minimum .Net Core version required for LibCecSharpCore is 3.1 16 | 17 | An example implementation can be found on [Github](https://github.com/Pulse-Eight/cec-dotnet/tree/master/src/CecSharpTester/netcore/). 18 | 19 | ### Prerequisites 20 | To compile libCEC on Windows, you'll need the following dependencies: 21 | * [p8-platform](https://github.com/Pulse-Eight/platform) 2.0 or later 22 | * [cmake 3.12 or newer](http://www.cmake.org/) 23 | * [Visual Studio 2019 (v16) or newer](https://www.visualstudio.com/), with the following options selected: Universal Windows Platform development, Desktop development with C++, .NET Core cross platform development 24 | * [.Net Core 3.1](https://dotnet.microsoft.com/download/dotnet-core/3.1) 25 | * To create an installer, you'll need [Nullsoft's NSIS](http://nsis.sourceforge.net/) 26 | * You also need two versions of Python to build an installer: [Python 2.7.13 for x86](https://www.python.org/ftp/python/2.7.13/python-2.7.13.msi), required by the EventGhost plugin and [Python 3.6 or newer for x64](https://www.python.org/) 27 | 28 | ### Visual Studio 29 | The build scripts have been configured for building with Visual Studio 2019. To use another version Visual Studio, pass the verion number as parameter: `windows\visual-studio.cmd 2019` 30 | 31 | ### Compilation 32 | To only compile libCEC, follow these instructions: 33 | * `git submodule update --init --recursive` 34 | * run `windows\build-all.cmd` to build libCEC and LibCecSharp 35 | 36 | To develop for libCEC in Visual Studio: 37 | * `git submodule update --init --recursive` 38 | * run `windows\visual-studio.cmd` 39 | 40 | To build an installer on Windows: 41 | * `git submodule update --init --recursive` 42 | * run `windows\create-installer.cmd` 43 | * the installer is stored as `build\libCEC-VERSION.exe` 44 | -------------------------------------------------------------------------------- /include/version.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | /** 35 | * Convert a version number to an uint32_t 36 | * @param[in] major Major version number 37 | * @param[in] minor Minor version number 38 | * @param[in] patch Patch number 39 | * 40 | * @return The version number as uint32_t 41 | */ 42 | #define LIBCEC_VERSION_TO_UINT(major, minor, patch) \ 43 | ((major < 2 || (major == 2 && minor <= 2)) ? \ 44 | (uint32_t) (major << 8) | (minor << 4) | (patch) : \ 45 | (uint32_t) (major << 16) | (minor << 8) | (patch)) 46 | 47 | /* new style version numbers, 2.3.0 and later */ 48 | #define LIBCEC_UINT_TO_VERSION_MAJOR(x) ((x >> 16) & 0xFF) 49 | #define LIBCEC_UINT_TO_VERSION_MINOR(x) ((x >> 8 ) & 0xFF) 50 | #define LIBCEC_UINT_TO_VERSION_PATCH(x) ((x >> 0 ) & 0xFF) 51 | 52 | /* old style version numbers, before 2.3.0 */ 53 | #define LIBCEC_UINT_TO_VERSION_MAJOR_OLD(x) ((x >> 8) & 0xFF) 54 | #define LIBCEC_UINT_TO_VERSION_MINOR_OLD(x) ((x >> 4) & 0x0F) 55 | #define LIBCEC_UINT_TO_VERSION_PATCH_OLD(x) ((x >> 0) & 0x0F) 56 | 57 | /*! 58 | * libCEC's major version number 59 | */ 60 | #define CEC_LIB_VERSION_MAJOR @LIBCEC_VERSION_MAJOR@ 61 | 62 | /*! 63 | * libCEC's major version number as string 64 | */ 65 | #define CEC_LIB_VERSION_MAJOR_STR "@LIBCEC_VERSION_MAJOR@" 66 | 67 | /*! 68 | * libCEC's minor version number 69 | */ 70 | #define CEC_LIB_VERSION_MINOR @LIBCEC_VERSION_MINOR@ 71 | 72 | /* current libCEC version number */ 73 | #define _LIBCEC_VERSION_CURRENT \ 74 | LIBCEC_VERSION_TO_UINT(@LIBCEC_VERSION_MAJOR@, @LIBCEC_VERSION_MINOR@, @LIBCEC_VERSION_PATCH@) 75 | -------------------------------------------------------------------------------- /project/eventghost.nsi: -------------------------------------------------------------------------------- 1 | ;libCEC EventGhost Plugin installer 2 | ;Copyright (C) 2025 Pulse-Eight Ltd. 3 | ;http://www.pulse-eight.com/ 4 | 5 | XPStyle on 6 | RequestExecutionLevel user 7 | SetCompressor /SOLID lzma 8 | 9 | !include "LogicLib.nsh" 10 | !include "MUI2.nsh" 11 | !include "nsDialogs.nsh" 12 | !include "nsis\libcec-version.nsh" 13 | 14 | Name "Pulse-Eight libCEC v${LIBCEC_VERSION_STRING} EventGhost Plugin" 15 | OutFile "..\build\libcec-eventghost-plugin-${LIBCEC_VERSION_STRING}.exe" 16 | InstType "Full installation" 17 | 18 | Var EventGhostLocation 19 | 20 | Section "EventGhost plugin" SecEvGhostCec 21 | SetShellVarContext current 22 | SectionIn 1 23 | SectionIn RO 24 | 25 | SetOutPath "$%TEMP%\" 26 | File "..\build\EventGhost\pulse_eight.egplugin" 27 | 28 | ExecWait '"$EventGhostLocation\eventghost.exe" "$%TEMP%\pulse_eight.egplugin"' 29 | Delete "$%TEMP%\pulse_eight.egplugin" 30 | SectionEnd 31 | 32 | Function EventGhost 33 | ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\EventGhost_is1" "InstallLocation" 34 | ${If} $1 != "" 35 | StrCpy $EventGhostLocation "$1" 36 | ${Else} 37 | MessageBox MB_OK "EventGhost is not installed. Exiting." 38 | Quit 39 | ${Endif} 40 | FunctionEnd 41 | 42 | !define MUI_FINISHPAGE_LINK "Visit https://libcec.pulse-eight.com/ for more information." 43 | !define MUI_FINISHPAGE_LINK_LOCATION "https://libcec.pulse-eight.com/" 44 | !define MUI_ABORTWARNING 45 | 46 | !insertmacro MUI_PAGE_WELCOME 47 | !insertmacro MUI_PAGE_LICENSE "..\LICENSE.md" 48 | !insertmacro MUI_PAGE_COMPONENTS 49 | 50 | !insertmacro MUI_PAGE_INSTFILES 51 | !insertmacro MUI_PAGE_FINISH 52 | 53 | !insertmacro MUI_LANGUAGE "English" 54 | 55 | Function .onInit 56 | ; check for EventGhost 57 | Call EventGhost 58 | FunctionEnd 59 | -------------------------------------------------------------------------------- /project/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulse-Eight/libcec/20222b1d5313c589654da8c009fa78a6e0912a1a/project/favicon.ico -------------------------------------------------------------------------------- /project/libcec.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.13.35806.99 d17.13 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibCecSharp", "..\src\dotnetlib\LibCecSharp\LibCecSharp.vcxproj", "{E54D4581-CD59-4687-BB10-694B8192EABA}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B119505D-5CD1-48E4-BED1-9C2BF26153D5}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibCecSharpCore", "..\src\dotnetlib\LibCecSharpCore\LibCecSharpCore.vcxproj", "{E8C30CBD-64D1-44F8-9172-82B728986DCC}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|x64 = Debug|x64 15 | Debug|x86 = Debug|x86 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {E54D4581-CD59-4687-BB10-694B8192EABA}.Debug|x64.ActiveCfg = Debug|x64 21 | {E54D4581-CD59-4687-BB10-694B8192EABA}.Debug|x64.Build.0 = Debug|x64 22 | {E54D4581-CD59-4687-BB10-694B8192EABA}.Debug|x86.ActiveCfg = Debug|Win32 23 | {E54D4581-CD59-4687-BB10-694B8192EABA}.Debug|x86.Build.0 = Debug|Win32 24 | {E54D4581-CD59-4687-BB10-694B8192EABA}.Release|x64.ActiveCfg = Release|x64 25 | {E54D4581-CD59-4687-BB10-694B8192EABA}.Release|x64.Build.0 = Release|x64 26 | {E54D4581-CD59-4687-BB10-694B8192EABA}.Release|x86.ActiveCfg = Release|Win32 27 | {E54D4581-CD59-4687-BB10-694B8192EABA}.Release|x86.Build.0 = Release|Win32 28 | {E8C30CBD-64D1-44F8-9172-82B728986DCC}.Debug|x64.ActiveCfg = Debug|x64 29 | {E8C30CBD-64D1-44F8-9172-82B728986DCC}.Debug|x64.Build.0 = Debug|x64 30 | {E8C30CBD-64D1-44F8-9172-82B728986DCC}.Debug|x86.ActiveCfg = Debug|Win32 31 | {E8C30CBD-64D1-44F8-9172-82B728986DCC}.Debug|x86.Build.0 = Debug|Win32 32 | {E8C30CBD-64D1-44F8-9172-82B728986DCC}.Release|x64.ActiveCfg = Release|x64 33 | {E8C30CBD-64D1-44F8-9172-82B728986DCC}.Release|x64.Build.0 = Release|x64 34 | {E8C30CBD-64D1-44F8-9172-82B728986DCC}.Release|x86.ActiveCfg = Release|Win32 35 | {E8C30CBD-64D1-44F8-9172-82B728986DCC}.Release|x86.Build.0 = Release|Win32 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {79F89A04-C65A-4AC3-A89C-42B3C1F2623A} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /project/nsis/cec-tray.nsh: -------------------------------------------------------------------------------- 1 | Section "libCEC Tray" SecTray 2 | SetShellVarContext current 3 | SectionIn 1 4 | 5 | ; Copy binaries 6 | SetOutPath "$INSTDIR\netfx" 7 | File "${BINARY_SOURCE_DIR}\cec-tray.exe" 8 | 9 | ; Start menu item 10 | !insertmacro MUI_STARTMENU_WRITE_BEGIN Application 11 | SetShellVarContext all 12 | CreateDirectory "$SMPROGRAMS\$StartMenuFolder" 13 | CreateShortCut "$SMPROGRAMS\$StartMenuFolder\cec-tray.lnk" "$INSTDIR\netfx\cec-tray.exe" \ 14 | "" "$INSTDIR\netfx\cec-tray.exe" 0 SW_SHOWNORMAL \ 15 | "" "Start libCEC Tray." 16 | !insertmacro MUI_STARTMENU_WRITE_END 17 | SectionEnd 18 | -------------------------------------------------------------------------------- /project/nsis/eventghost.nsh: -------------------------------------------------------------------------------- 1 | !ifndef NSISINCLUDEPDB 2 | !ifndef INNER 3 | 4 | Var EventGhostLocation 5 | 6 | !define EVENTGHOST_SECTIONNAME "EventGhost plugin" 7 | Section "" SecEvGhostCec 8 | SetShellVarContext current 9 | SectionIn 1 10 | 11 | SetOutPath "$INSTDIR\EventGhost" 12 | File "..\build\EventGhost\pulse_eight.egplugin" 13 | 14 | ${If} $EventGhostLocation != "" 15 | ExecWait '"$EventGhostLocation\eventghost.exe" "$INSTDIR\EventGhost\pulse_eight.egplugin"' 16 | ${EndIf} 17 | SectionEnd 18 | 19 | Function EventGhost 20 | ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\EventGhost_is1" "InstallLocation" 21 | ${If} $1 != "" 22 | StrCpy $EventGhostLocation "$1" 23 | !insertMacro SelectSection ${SecEvGhostCec} 24 | SectionSetText ${SecEvGhostCec} "${EVENTGHOST_SECTIONNAME}" 25 | ${Else} 26 | !insertMacro UnSelectSection ${SecEvGhostCec} 27 | ${Endif} 28 | FunctionEnd 29 | 30 | !endif 31 | !endif -------------------------------------------------------------------------------- /project/nsis/functions.nsh: -------------------------------------------------------------------------------- 1 | !include LogicLib.nsh 2 | !include FileFunc.nsh 3 | 4 | Var oldVersionDir 5 | 6 | !macro !defineifexist _VAR_NAME _FILE_NAME 7 | !tempfile _TEMPFILE 8 | !ifdef NSIS_WIN32_MAKENSIS 9 | ; Windows - cmd.exe 10 | !system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} > "${_TEMPFILE}"' 11 | !else 12 | ; Posix - sh 13 | !system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME}" > "${_TEMPFILE}"; fi' 14 | !endif 15 | !include '${_TEMPFILE}' 16 | !delfile '${_TEMPFILE}' 17 | !undef _TEMPFILE 18 | !macroend 19 | !define !defineifexist "!insertmacro !defineifexist" 20 | 21 | Function DeleteOldFiles 22 | RMDir /r "$INSTDIR\EventGhost" 23 | RMDir /r "$INSTDIR\include" 24 | RMDir /r "$INSTDIR\python" 25 | RMDir /r "$INSTDIR\x64" 26 | RMDir /r "$INSTDIR\x86" 27 | Delete "$INSTDIR\AUTHORS" 28 | Delete "$INSTDIR\cec.dll" 29 | Delete "$INSTDIR\cec.pdb" 30 | Delete "$INSTDIR\cecc-client.exe" 31 | Delete "$INSTDIR\cec-client.exe" 32 | Delete "$INSTDIR\cec-firmware-latest.exe" 33 | Delete "$INSTDIR\ChangeLog" 34 | Delete "$INSTDIR\COPYING" 35 | Delete "$INSTDIR\libusb0.dll" 36 | Delete "$INSTDIR\LICENSE.md" 37 | Delete "$INSTDIR\README.*" 38 | Delete "$INSTDIR\tv_on.cmd" 39 | Delete "$INSTDIR\tv_off.cmd" 40 | Delete "$INSTDIR\Uninstall.exe" 41 | Delete "$INSTDIR\uninstall_libcec.exe" 42 | FunctionEnd 43 | 44 | Function UninstallOldVersion 45 | ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" "UninstallString" 46 | ${If} $0 != "" 47 | ${If} ${Cmd} `MessageBox MB_YESNO|MB_ICONQUESTION "An old libCEC installation was found. This version must be uninstalled before installing libCEC v${LIBCEC_VERSION_STRING}. Continue?" /SD IDYES IDYES` 48 | ${GetParent} "$0" $oldVersionDir 49 | ExecWait '"$0" _?=$oldVersionDir' $0 50 | ${If} $0 <> 0 51 | MessageBox MB_OK "Failed to uninstall" 52 | Quit 53 | ${Else} 54 | ; old uninstaller was bugged and didn't always uninstall 55 | Call DeleteOldFiles 56 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" 57 | DeleteRegKey HKLM "Software\Pulse-Eight\USB-CEC Adapter sofware" 58 | DeleteRegKey /ifempty HKLM "Software\Pulse-Eight" 59 | SetShellVarContext current 60 | RMDir /r "$SMPROGRAMS\Pulse-Eight libCEC v6.0.2" 61 | SetShellVarContext all 62 | RMDir /r "$SMPROGRAMS\Pulse-Eight libCEC v6.0.2" 63 | ${EndIf} 64 | ${Else} 65 | Quit 66 | ${EndIf} 67 | ${EndIf} 68 | FunctionEnd 69 | -------------------------------------------------------------------------------- /project/nsis/libcec-pdb.nsh: -------------------------------------------------------------------------------- 1 | Section "libCEC debug symbols" SecPDB 2 | SetShellVarContext current 3 | SectionIn 1 4 | 5 | SetOutPath "$INSTDIR" 6 | File "${BINARY_SOURCE_DIR}\lib\cec.pdb" 7 | File "${BINARY_SOURCE_DIR}\cec-tray.pdb" 8 | 9 | SetOutPath "$INSTDIR\netfx" 10 | File /nonfatal "${BINARY_SOURCE_DIR}\CecSharpTester.pdb" 11 | File "${BINARY_SOURCE_DIR}\LibCecSharp.pdb" 12 | File "${BINARY_SOURCE_DIR}\LibCecSharp.xml" 13 | 14 | SetOutPath "$INSTDIR\net8.0" 15 | File /nonfatal "${BINARY_SOURCE_DIR}\net8.0\CecSharpCoreTester.pdb" 16 | File "${BINARY_SOURCE_DIR}\net8.0\LibCecSharpCore.pdb" 17 | File "${BINARY_SOURCE_DIR}\net8.0\CecSharpCoreTester.pdb" 18 | SectionEnd 19 | -------------------------------------------------------------------------------- /project/nsis/libcec-version.nsh.in: -------------------------------------------------------------------------------- 1 | !define LIBCEC_VERSION_STRING "${LIBCEC_VERSION_MAJOR}.${LIBCEC_VERSION_MINOR}.${LIBCEC_VERSION_PATCH}" -------------------------------------------------------------------------------- /project/nsis/uninstall.nsh: -------------------------------------------------------------------------------- 1 | Function un.DeleteInstalledFiles 2 | Delete "$INSTDIR\AUTHORS" 3 | Delete "$INSTDIR\cec.dll" 4 | Delete "$INSTDIR\cec.pdb" 5 | Delete "$INSTDIR\cecc-client.exe" 6 | Delete "$INSTDIR\cec-client.exe" 7 | Delete "$INSTDIR\cec-firmware-latest.exe" 8 | Delete "$INSTDIR\ChangeLog" 9 | Delete "$INSTDIR\COPYING" 10 | Delete "$INSTDIR\libusb0.dll" 11 | Delete "$INSTDIR\LICENSE" 12 | Delete "$INSTDIR\README.*" 13 | Delete "$INSTDIR\tv_on.cmd" 14 | Delete "$INSTDIR\tv_off.cmd" 15 | Delete "$INSTDIR\include\cec*.h" 16 | Delete "$INSTDIR\netcore\LibCecSharpCore.deps.json" 17 | Delete "$INSTDIR\netcore\LibCecSharpCore.dll" 18 | Delete "$INSTDIR\netcore\LibCecSharpCore.pdb" 19 | Delete "$INSTDIR\netcore\LibCecSharpCore.runtimeconfig.json" 20 | Delete "$INSTDIR\netcore\LibCecSharpCore.xml" 21 | Delete "$INSTDIR\netcore\CecSharpCoreTester.deps.json" 22 | Delete "$INSTDIR\netcore\CecSharpCoreTester.dll" 23 | Delete "$INSTDIR\netcore\CecSharpCoreTester.runtimeconfig.json" 24 | Delete "$INSTDIR\netcore\CecSharpCoreTester.exe" 25 | Delete "$INSTDIR\netcore\CecSharpCoreTester.pdb" 26 | Delete "$INSTDIR\netfx\LibCecSharp.dll" 27 | Delete "$INSTDIR\netfx\LibCecSharp.pdb" 28 | Delete "$INSTDIR\netfx\LibCecSharp.xml" 29 | Delete "$INSTDIR\netfx\cec-tray.exe" 30 | Delete "$INSTDIR\netfx\CecSharpTester.exe" 31 | Delete "$INSTDIR\python\_cec.pyd" 32 | Delete "$INSTDIR\python\cec\cec.py" 33 | Delete "$INSTDIR\python\cec\__init__.py" 34 | Delete "$INSTDIR\python\pyCecClient.py" 35 | FunctionEnd 36 | 37 | ; Uninstaller Section 38 | Section "Uninstall" 39 | SetShellVarContext all 40 | 41 | Call un.DeleteInstalledFiles 42 | 43 | ; Uninstall EventGhost plugin 44 | ; Eventghost has no uninstall plugin feature so we simply delete the plugin 45 | ; from the directory. 46 | ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\EventGhost_is1" "InstallLocation" 47 | ${If} $1 != "" 48 | RMDir /r "$%PROGRAMDATA%\EventGhost\plugins\PulseEight" 49 | ${Endif} 50 | 51 | ; Uninstall the driver 52 | ReadRegStr $1 HKLM "Software\Pulse-Eight\USB-CEC Adapter driver" "" 53 | ${If} $1 != "" 54 | ExecWait '"$1\Uninstall.exe" /S _?=$1' 55 | ${EndIf} 56 | 57 | RMDir /r "$INSTDIR\include" 58 | Delete "$INSTDIR\uninstall_libcec.exe" 59 | RMDir /r "$INSTDIR" 60 | RMDir "$PROGRAMFILES\Pulse-Eight" 61 | 62 | !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder 63 | Delete "$SMPROGRAMS\$StartMenuFolder\libCEC Tray.lnk" 64 | ${If} ${RunningX64} 65 | Delete "$SMPROGRAMS\$StartMenuFolder\libCEC Tray (x64).lnk" 66 | ${EndIf} 67 | Delete "$SMPROGRAMS\$StartMenuFolder\cec-tray.lnk" 68 | Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" 69 | ${If} ${RunningX64} 70 | Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk" 71 | ${EndIf} 72 | Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall Pulse-Eight USB-CEC Adapter software.lnk" 73 | Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" 74 | RMDir "$SMPROGRAMS\$StartMenuFolder" 75 | 76 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter software" 77 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" 78 | DeleteRegKey /ifempty HKLM "Software\Pulse-Eight\USB-CEC Adapter software" 79 | DeleteRegKey /ifempty HKLM "Software\Pulse-Eight" 80 | SectionEnd -------------------------------------------------------------------------------- /project/nsis/vc_redist.nsh: -------------------------------------------------------------------------------- 1 | !ifndef INNER 2 | Var VSRedistSetupError 3 | Var VSRedistInstalledX64 4 | 5 | !ifdef NSIS_X86 6 | Var VSRedistInstalledX86 7 | 8 | !define REDISTRIBUTABLE_X86_SECTIONNAME "Microsoft Visual C++ Redistributable Package (x86)" 9 | Section "" SecVCRedistX86 10 | SetShellVarContext current 11 | SectionIn 1 2 3 12 | SectionIn RO 13 | 14 | SetOutPath "$TEMP\vc_x86" 15 | 16 | ${If} $VSRedistInstalledX86 != "Yes" 17 | NSISdl::download https://aka.ms/vs/16/release/vc_redist.x86.exe vc_redist.x86.exe 18 | ExecWait '"$TEMP\vc_x86\vc_redist.x86.exe" /q' $VSRedistSetupError 19 | ${Endif} 20 | 21 | RMDIR /r "$TEMP\vc_x86" 22 | SectionEnd 23 | 24 | Function vsRedistX86 25 | ReadRegDword $1 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Version" 26 | ${If} $1 != "" 27 | StrCpy $VSRedistInstalledX86 "Yes" 28 | ${Endif} 29 | 30 | ${If} $VSRedistInstalledX86 == "Yes" 31 | !insertMacro UnSelectSection ${SecVCRedistX86} 32 | SectionSetText ${SecVCRedistX86} "" 33 | ${Else} 34 | !insertMacro SelectSection ${SecVCRedistX86} 35 | SectionSetText ${SecVCRedistX86} "${REDISTRIBUTABLE_X86_SECTIONNAME}" 36 | ${Endif} 37 | FunctionEnd 38 | !endif 39 | 40 | !define REDISTRIBUTABLE_X64_SECTIONNAME "Microsoft Visual C++ Redistributable Package (x64)" 41 | Section "" SecVCRedistX64 42 | SetShellVarContext current 43 | SectionIn 1 2 3 44 | SectionIn RO 45 | 46 | SetOutPath "$TEMP\vc_x64" 47 | 48 | ${If} $VSRedistInstalledX64 != "Yes" 49 | NSISdl::download https://aka.ms/vs/16/release/vc_redist.x64.exe vc_redist.x64.exe 50 | ExecWait '"$TEMP\vc_x64\vc_redist.x64.exe" /q' $VSRedistSetupError 51 | ${Endif} 52 | 53 | RMDIR /r "$TEMP\vc_x64" 54 | SectionEnd 55 | 56 | Function vsRedistX64 57 | ${If} ${RunningX64} 58 | ; check for vc x64 redist 59 | ReadRegDword $1 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Version" 60 | ${If} $1 != "" 61 | StrCpy $VSRedistInstalledX64 "Yes" 62 | ${Endif} 63 | 64 | ${If} $VSRedistInstalledX64 == "Yes" 65 | !insertMacro UnSelectSection ${SecVCRedistX64} 66 | SectionSetText ${SecVCRedistX64} "" 67 | ${Else} 68 | !insertMacro SelectSection ${SecVCRedistX64} 69 | SectionSetText ${SecVCRedistX64} "${REDISTRIBUTABLE_X64_SECTIONNAME}" 70 | ${Endif} 71 | ${Else} 72 | !insertMacro UnSelectSection ${SecVCRedistX64} 73 | SectionSetText ${SecVCRedistX64} "" 74 | ${Endif} 75 | FunctionEnd 76 | 77 | !endif -------------------------------------------------------------------------------- /src/EventGhost/egplugin_sources/PulseEight/cec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulse-Eight/libcec/20222b1d5313c589654da8c009fa78a6e0912a1a/src/EventGhost/egplugin_sources/PulseEight/cec.png -------------------------------------------------------------------------------- /src/EventGhost/egplugin_sources/info.py: -------------------------------------------------------------------------------- 1 | name = u'Pulse-Eight CEC adapter' 2 | author = u'Lars Op den Kamp, K' 3 | version = u'1.1b' 4 | url = u'http://libcec.pulse-eight.com/' 5 | guid = '{81AC5776-0220-4D2A-B561-DD91F052FF7B}' 6 | description = u'

Integration with libCEC, which adds support for Pulse-Eight\'s CEC adapters. This third party integration is not supported by Pulse-Eight. Please visit https://github.com/EventGhost/EventGhost for support.

\n
\n

\n
\ncec.png\n

Notice: Make sure you select the correct HDMI port number on the device that the CEC adapter is connected to, or remote control input won\'t work.

\n' 7 | icon = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAHVYdUCVeJ6QpYiuULWYuRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEUoQBBlSG+U6d0P9PntH/CFaI8QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEUoQFBFKECARShAcEUoQFBFKEBARShP5jtOf/ZLTm/wVThf0EUoQFBFKEBwRShAQAAAAAAAAAAAAAAAAAAAAABVOF9gVThfsFU4X8BVOF/AVThf0MWoz3XK7i/2S16P8PXY/3BVOF/QVThfwFU4X2BFKEAwAAAAAAAAAAAAAAAAVThfw9lc3/Q5rR/0mf1f9Po9n/Vajd/1ms4f9fseX/ZLXo/2i36v9ot+r/BFKE/wAAAAAAAAAAAAAAAAAAAAAEUoT9OJHK/z6Wzv9Em9L/SqDW/1Ck2v9VqN3/Wq3i/1+x5f9ltun/Z7bp/wRShP4AAAAAAAAAAAAAAAAAAAAABFKE/QlZi/IIVIr1KX2z+0Wc0/9Lodf/UKTa/1ap3v9cruL/YLLm/2W15/8GVIb8B1WH8wVThfsIVojvCFaIWQRShCQEUoQnBFKETQdVh/hAmND/Rp3U/0uh1/9Rpdv/V6rf/12s4/9is+b/YrLk/2Cw4v9ltef/RJPG/wdVh+0EUoQHBFKEBARShCYGVIb4O5TN/0GZ0f9GndT/TKLY/1Gl2/9Xqt//Xa/j/yV1p/9ot+r/aLfq/2Cw4v8HVYf0BFCG9wRShPwFU4X6HW+p+TeQyf89lc3/Q5rR/0ee1f9Ootj/Uqbc/1ir4P8EUoT/IXGj9E+e0f82hbj+CliKoARQhvwgfrr/JYO//yyIwv8xjcf/OJHK/z2Vzf9DmtH/SZ/V/0+g2f9Vpd3/BFKE/gRShG4JWYvfCFaI4gRShBQEUIb8HHu4/yF/u/8nhL//LInE/zKOyP84kcr/PpbO/0Oa0f9KoNb/UKTa/wRShP4EUoQBAAAAAAAAAAAAAAAABFKE9wVThfkFU4X6BFSG/ARShP0IWIr2L4jB/zeQyf8GVIb8BFKE/gVQhf0FU4X1BFKEAQAAAAAAAAAAAAAAAARShAgEUoQNBFKECgRShAYEUoQDB1OJ0yR8tP8yjcb/BVOF+gAAAAAEUoQEBFKEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARShP0ngrv/LonC/wRShP0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFUYeSBVOF+QRUhvwGVIaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==' -------------------------------------------------------------------------------- /src/cec-client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(cecclient) 2 | cmake_minimum_required(VERSION 3.12.0) 3 | 4 | set(cecclient_NAME cecclient) 5 | set(cecclient_DESCRIPTION "libCEC test client") 6 | set(cecclient_VERSION_MAJOR ${LIBCEC_VERSION_MAJOR}) 7 | set(cecclient_VERSION_MINOR ${LIBCEC_VERSION_MINOR}) 8 | set(cecclient_VERSION_PATCH ${LIBCEC_VERSION_PATCH}) 9 | 10 | enable_language(CXX) 11 | include(CheckCXXSourceCompiles) 12 | include(CheckLibraryExists) 13 | include(CheckIncludeFiles) 14 | include(CheckCXXCompilerFlag) 15 | include(../../cmake/WindowsDebug.cmake) 16 | 17 | check_cxx_compiler_flag("-std=c++11" SUPPORTS_CXX11) 18 | if (SUPPORTS_CXX11) 19 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 20 | endif() 21 | 22 | find_package(p8-platform REQUIRED) 23 | find_package(Threads REQUIRED) 24 | 25 | set(cecclient_SOURCES cec-client.cpp) 26 | 27 | # curses 28 | check_library_exists(curses initscr "" HAVE_CURSES_API) 29 | if (HAVE_CURSES_API) 30 | list(APPEND cecclient_SOURCES curses/CursesControl.cpp) 31 | 32 | # tinfo 33 | find_library(HAVE_CURSES_TINFO tinfo) 34 | endif() 35 | 36 | 37 | add_executable(cec-client ${cecclient_SOURCES}) 38 | set_target_properties(cec-client PROPERTIES VERSION ${LIBCEC_VERSION_MAJOR}.${LIBCEC_VERSION_MINOR}.${LIBCEC_VERSION_PATCH}) 39 | target_link_libraries(cec-client ${p8-platform_LIBRARIES}) 40 | target_link_libraries(cec-client ${CMAKE_THREAD_LIBS_INIT}) 41 | 42 | if (NOT WIN32) 43 | # check for dlopen 44 | check_library_exists(dl dlopen "" HAVE_DLOPEN) 45 | if (HAVE_DLOPEN) 46 | target_link_libraries(cec-client dl) 47 | endif() 48 | 49 | # curses 50 | if (HAVE_CURSES_API) 51 | target_link_libraries(cec-client curses) 52 | if (HAVE_CURSES_TINFO) 53 | target_link_libraries(cec-client tinfo) 54 | endif() 55 | endif() 56 | 57 | # rt 58 | check_library_exists(rt clock_gettime "" HAVE_RT) 59 | if (HAVE_RT) 60 | target_link_libraries(cec-client rt) 61 | endif() 62 | 63 | # CoreVideo 64 | if (APPLE) 65 | target_link_libraries(cec-client "-framework CoreVideo") 66 | endif() 67 | else() 68 | add_definitions(-DTARGET_WINDOWS -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_WINSOCKAPI_) 69 | check_symbol_exists(_AMD64_ Windows.h WIN64) 70 | check_symbol_exists(_ARM64_ Windows.h ARM64) 71 | if (WIN64 OR ARM64) 72 | string(REPLACE "/arch:SSE2" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) 73 | else() 74 | add_definitions(-D_USE_32BIT_TIME_T) 75 | endif() 76 | endif() 77 | 78 | include_directories(${p8-platform_INCLUDE_DIRS} 79 | ${PROJECT_SOURCE_DIR} 80 | ${PROJECT_SOURCE_DIR}/../../include) 81 | 82 | # write env.h 83 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/env.h.in ${CMAKE_CURRENT_SOURCE_DIR}/env.h) 84 | 85 | if (WIN32) 86 | install(TARGETS cec-client 87 | DESTINATION .) 88 | else() 89 | install(TARGETS cec-client 90 | DESTINATION bin) 91 | endif() 92 | -------------------------------------------------------------------------------- /src/cec-client/curses/CursesControl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "CursesControl.h" 35 | #include "p8-platform/util/StringUtils.h" 36 | #include 37 | 38 | void CCursesControl::Init() 39 | { 40 | initscr(); 41 | noecho(); 42 | keypad(stdscr, true); 43 | printw("Curses enabled."); 44 | } 45 | 46 | void CCursesControl::End(void) 47 | { 48 | endwin(); 49 | printw("Curses closed."); 50 | } 51 | 52 | void CCursesControl::SetInput(const std::string& in) 53 | { 54 | m_in = in; 55 | } 56 | 57 | void CCursesControl::SetOutput(const std::string& out) 58 | { 59 | m_out = out; 60 | } 61 | 62 | std::string CCursesControl::ParseCursesKey(void) 63 | { 64 | int key = getch(); 65 | std::string strKey; 66 | switch(key){ 67 | case KEY_DOWN: 68 | strKey = "42"; 69 | break; 70 | case KEY_UP: 71 | strKey = "41"; 72 | break; 73 | case 109: // KEY_m 74 | strKey = "43"; 75 | break; 76 | case 10: // KEY_ENTER 77 | strKey = "6B"; 78 | break; 79 | case 113: // KEY_q 80 | strKey = "q"; 81 | break; 82 | } 83 | 84 | return strKey.empty() ? 85 | "" : 86 | StringUtils::Format("tx %s%s 44 %s", m_in.c_str(), m_out.c_str(), strKey.c_str()); 87 | } 88 | -------------------------------------------------------------------------------- /src/cec-client/curses/CursesControl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* 4 | * This file is part of the libCEC(R) library. 5 | * 6 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 7 | * libCEC(R) is an original work, containing original code. 8 | * 9 | * libCEC(R) is a trademark of Pulse-Eight Limited. 10 | * 11 | * This program is dual-licensed; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 24 | * 02110-1301 USA 25 | * 26 | * 27 | * Alternatively, you can license this library under a commercial license, 28 | * please contact Pulse-Eight Licensing for more information. 29 | * 30 | * For more information contact: 31 | * Pulse-Eight Licensing 32 | * http://www.pulse-eight.com/ 33 | * http://www.pulse-eight.net/ 34 | */ 35 | 36 | #include 37 | 38 | class CCursesControl 39 | { 40 | public: 41 | CCursesControl() {} 42 | CCursesControl(const std::string& in, const std::string& out) : 43 | m_in(in), 44 | m_out(out) {} 45 | virtual ~CCursesControl() {} 46 | 47 | void Init(void); 48 | void End(void); 49 | void SetInput(const std::string& in); 50 | void SetOutput(const std::string& out); 51 | std::string ParseCursesKey(void); 52 | 53 | private: 54 | std::string m_in, m_out; 55 | }; 56 | -------------------------------------------------------------------------------- /src/cec-client/env.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * WARNING: Auto-generated file from env.h.in 4 | * 5 | * This file is part of the libCEC(R) library. 6 | * 7 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 8 | * libCEC(R) is an original work, containing original code. 9 | * 10 | * libCEC(R) is a trademark of Pulse-Eight Limited. 11 | * 12 | * This program is dual-licensed; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 25 | * 26 | * 27 | * Alternatively, you can license this library under a commercial license, 28 | * please contact Pulse-Eight Licensing for more information. 29 | * 30 | * For more information contact: 31 | * Pulse-Eight Licensing 32 | * http://www.pulse-eight.com/ 33 | * http://www.pulse-eight.net/ 34 | */ 35 | 36 | #include "cectypes.h" 37 | #include "p8-platform/os.h" 38 | 39 | #ifdef UNUSED 40 | #elif defined(__GNUC__) 41 | #define UNUSED(x) UNUSED_ ## x __attribute__((unused)) 42 | #elif defined(__LCLINT__) 43 | #define UNUSED(x) /*@unused@*/ x 44 | #else 45 | #define UNUSED(x) x 46 | #endif 47 | 48 | /* Define to 1 for curses support */ 49 | #cmakedefine HAVE_CURSES_API @HAVE_CURSES_API@ 50 | -------------------------------------------------------------------------------- /src/cecc-client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(ceccclient) 2 | cmake_minimum_required(VERSION 3.12.0) 3 | 4 | set(ceccclient_NAME ceccclient) 5 | set(ceccclient_DESCRIPTION "libCEC test client") 6 | set(ceccclient_VERSION_MAJOR ${LIBCEC_VERSION_MAJOR}) 7 | set(ceccclient_VERSION_MINOR ${LIBCEC_VERSION_MINOR}) 8 | set(ceccclient_VERSION_PATCH ${LIBCEC_VERSION_PATCH}) 9 | 10 | enable_language(C) 11 | include(CheckCSourceCompiles) 12 | include(CheckLibraryExists) 13 | include(CheckIncludeFiles) 14 | include(../../cmake/WindowsDebug.cmake) 15 | 16 | find_package(p8-platform REQUIRED) 17 | find_package(Threads REQUIRED) 18 | 19 | set(ceccclient_SOURCES cecc-client.c) 20 | 21 | add_executable(cecc-client ${ceccclient_SOURCES}) 22 | set_target_properties(cecc-client PROPERTIES VERSION ${LIBCEC_VERSION_MAJOR}.${LIBCEC_VERSION_MINOR}.${LIBCEC_VERSION_PATCH}) 23 | target_link_libraries(cecc-client ${p8-platform_LIBRARIES}) 24 | target_link_libraries(cecc-client ${CMAKE_THREAD_LIBS_INIT}) 25 | 26 | if (NOT WIN32) 27 | # check for dlopen 28 | check_library_exists(dl dlopen "" HAVE_DLOPEN) 29 | if (HAVE_DLOPEN) 30 | target_link_libraries(cecc-client dl) 31 | endif() 32 | 33 | # CoreVideo 34 | if (APPLE) 35 | target_link_libraries(cecc-client "-framework CoreVideo") 36 | endif() 37 | else() 38 | add_definitions(-DTARGET_WINDOWS -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_WINSOCKAPI_) 39 | check_symbol_exists(_AMD64_ Windows.h WIN64) 40 | check_symbol_exists(_ARM64_ Windows.h ARM64) 41 | if (WIN64 OR ARM64) 42 | string(REPLACE "/arch:SSE2" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) 43 | else() 44 | add_definitions(-D_USE_32BIT_TIME_T) 45 | endif() 46 | endif() 47 | 48 | include_directories(${p8-platform_INCLUDE_DIRS} 49 | ${PROJECT_SOURCE_DIR} 50 | ${PROJECT_SOURCE_DIR}/../../include) 51 | 52 | # write env.h 53 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/env.h.in ${CMAKE_CURRENT_SOURCE_DIR}/env.h) 54 | 55 | if (WIN32) 56 | install(TARGETS cecc-client 57 | DESTINATION .) 58 | else() 59 | install(TARGETS cecc-client 60 | DESTINATION bin) 61 | endif() 62 | -------------------------------------------------------------------------------- /src/cecc-client/env.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * WARNING: Auto-generated file from env.h.in 4 | * 5 | * This file is part of the libCEC(R) library. 6 | * 7 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 8 | * libCEC(R) is an original work, containing original code. 9 | * 10 | * libCEC(R) is a trademark of Pulse-Eight Limited. 11 | * 12 | * This program is dual-licensed; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 25 | * 26 | * 27 | * Alternatively, you can license this library under a commercial license, 28 | * please contact Pulse-Eight Licensing for more information. 29 | * 30 | * For more information contact: 31 | * Pulse-Eight Licensing 32 | * http://www.pulse-eight.com/ 33 | * http://www.pulse-eight.net/ 34 | */ 35 | 36 | #include "cectypes.h" 37 | #include "p8-platform/os.h" 38 | 39 | #ifdef UNUSED 40 | #elif defined(__GNUC__) 41 | #define UNUSED(x) UNUSED_ ## x __attribute__((unused)) 42 | #elif defined(__LCLINT__) 43 | #define UNUSED(x) /*@unused@*/ x 44 | #else 45 | #define UNUSED(x) x 46 | #endif 47 | -------------------------------------------------------------------------------- /src/dotnetlib/LibCecSharp/.gitignore: -------------------------------------------------------------------------------- 1 | AssemblyInfo.cpp 2 | *.vcxproj.user 3 | *.aps 4 | .vs 5 | Release 6 | Debug 7 | x64 -------------------------------------------------------------------------------- /src/dotnetlib/LibCecSharp/AssemblyInfo.cpp.in: -------------------------------------------------------------------------------- 1 | using namespace System; 2 | using namespace System::Reflection; 3 | using namespace System::Runtime::CompilerServices; 4 | using namespace System::Runtime::InteropServices; 5 | using namespace System::Security::Permissions; 6 | 7 | [assembly:AssemblyTitleAttribute("LibCecSharp")]; 8 | [assembly:AssemblyDescriptionAttribute("")]; 9 | [assembly:AssemblyConfigurationAttribute("")]; 10 | [assembly:AssemblyCompanyAttribute("Pulse-Eight Limited")]; 11 | [assembly:AssemblyProductAttribute("LibCecSharp")]; 12 | [assembly:AssemblyCopyrightAttribute("Copyright (c) Pulse-Eight Limited 2011-2020")]; 13 | [assembly:AssemblyTrademarkAttribute("")]; 14 | [assembly:AssemblyCultureAttribute("")]; 15 | 16 | [assembly:AssemblyVersionAttribute("@LIBCEC_VERSION_MAJOR@.@LIBCEC_VERSION_MINOR@.@LIBCEC_VERSION_PATCH@.0")]; 17 | 18 | [assembly:ComVisible(false)]; 19 | [assembly:CLSCompliantAttribute(true)]; 20 | -------------------------------------------------------------------------------- /src/dotnetlib/LibCecSharp/LibCecSharp.rc.in: -------------------------------------------------------------------------------- 1 | #include "winres.h" 2 | 3 | VS_VERSION_INFO VERSIONINFO 4 | FILEVERSION ${LIBCEC_VERSION_MAJOR},${LIBCEC_VERSION_MINOR},${LIBCEC_VERSION_PATCH},0 5 | PRODUCTVERSION ${LIBCEC_VERSION_MAJOR},${LIBCEC_VERSION_MINOR},${LIBCEC_VERSION_PATCH},0 6 | FILEFLAGSMASK 0x3fL 7 | #ifdef _DEBUG 8 | FILEFLAGS 0x1L 9 | #else 10 | FILEFLAGS 0x0L 11 | #endif 12 | FILEOS 0x40004L 13 | FILETYPE 0x2L 14 | FILESUBTYPE 0x0L 15 | BEGIN 16 | BLOCK "StringFileInfo" 17 | BEGIN 18 | BLOCK "000004b0" 19 | BEGIN 20 | VALUE "CompanyName", "Pulse-Eight Limited" 21 | VALUE "FileDescription", "LibCecSharp" 22 | VALUE "FileVersion", "${LIBCEC_VERSION_MAJOR}.${LIBCEC_VERSION_MINOR}.${LIBCEC_VERSION_PATCH}.0" 23 | VALUE "InternalName", "LibCecSharp.dll" 24 | VALUE "LegalCopyright", "Copyright (c) Pulse-Eight Limited 2011-2020" 25 | VALUE "OriginalFilename", "LibCecSharp.dll" 26 | VALUE "ProductName", "LibCecSharp" 27 | VALUE "ProductVersion", "${LIBCEC_VERSION_MAJOR}.${LIBCEC_VERSION_MINOR}.${LIBCEC_VERSION_PATCH}.0" 28 | END 29 | END 30 | BLOCK "VarFileInfo" 31 | BEGIN 32 | VALUE "Translation", 0x0, 1200 33 | END 34 | END 35 | -------------------------------------------------------------------------------- /src/dotnetlib/LibCecSharp/LibCecSharp.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | 22 | 23 | Header Files 24 | 25 | 26 | Header Files 27 | 28 | 29 | Header Files 30 | 31 | 32 | Header Files 33 | 34 | 35 | Header Files 36 | 37 | 38 | Header Files 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/dotnetlib/LibCecSharp/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulse-Eight/libcec/20222b1d5313c589654da8c009fa78a6e0912a1a/src/dotnetlib/LibCecSharp/resource.h -------------------------------------------------------------------------------- /src/dotnetlib/LibCecSharpCore/.gitignore: -------------------------------------------------------------------------------- 1 | AssemblyInfo.cpp 2 | *.vcxproj.user 3 | .vs 4 | Release 5 | Debug 6 | x64 -------------------------------------------------------------------------------- /src/dotnetlib/LibCecSharpCore/AssemblyInfo.cpp.in: -------------------------------------------------------------------------------- 1 | using namespace System; 2 | using namespace System::Reflection; 3 | using namespace System::Runtime::CompilerServices; 4 | using namespace System::Runtime::InteropServices; 5 | using namespace System::Security::Permissions; 6 | 7 | [assembly:AssemblyTitleAttribute(L"LibCecSharpCore")]; 8 | [assembly:AssemblyDescriptionAttribute(L"")]; 9 | [assembly:AssemblyConfigurationAttribute(L"")]; 10 | [assembly:AssemblyCompanyAttribute(L"Pulse-Eight Limited")]; 11 | [assembly:AssemblyProductAttribute(L"LibCecSharpUWP")]; 12 | [assembly:AssemblyCopyrightAttribute(L"Copyright (c) Pulse-Eight Limited 2011-2020")]; 13 | [assembly:AssemblyTrademarkAttribute(L"")]; 14 | [assembly:AssemblyCultureAttribute(L"")]; 15 | 16 | [assembly:AssemblyVersionAttribute("@LIBCEC_VERSION_MAJOR@.@LIBCEC_VERSION_MINOR@.@LIBCEC_VERSION_PATCH@.*")]; 17 | 18 | [assembly:ComVisible(false)]; 19 | 20 | [assembly:CLSCompliantAttribute(true)]; 21 | -------------------------------------------------------------------------------- /src/dotnetlib/LibCecSharpCore/LibCecSharpCore.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | 43 | 44 | Resource Files 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/dotnetlib/LibCecSharpCore/Resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by app.rc 4 | -------------------------------------------------------------------------------- /src/dotnetlib/LibCecSharpCore/app.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulse-Eight/libcec/20222b1d5313c589654da8c009fa78a6e0912a1a/src/dotnetlib/LibCecSharpCore/app.rc -------------------------------------------------------------------------------- /src/libcec/CECInputBuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "p8-platform/threads/mutex.h" 37 | #include "p8-platform/util/buffer.h" 38 | 39 | namespace CEC 40 | { 41 | // a buffer that priotises the input from the TV. 42 | // if we need more than this, we'll have to change it into a priority_queue 43 | class CCECInputBuffer 44 | { 45 | public: 46 | CCECInputBuffer(void) : m_bHasData(false) {} 47 | virtual ~CCECInputBuffer(void) 48 | { 49 | Broadcast(); 50 | } 51 | 52 | void Broadcast(void) 53 | { 54 | P8PLATFORM::CLockObject lock(m_mutex); 55 | m_bHasData = true; 56 | m_condition.Broadcast(); 57 | } 58 | 59 | bool Push(const cec_command &command) 60 | { 61 | bool bReturn(false); 62 | P8PLATFORM::CLockObject lock(m_mutex); 63 | if (command.initiator == CECDEVICE_TV) 64 | bReturn = m_tvInBuffer.Push(command); 65 | else 66 | bReturn = m_inBuffer.Push(command); 67 | 68 | m_bHasData |= bReturn; 69 | if (m_bHasData) 70 | m_condition.Signal(); 71 | 72 | return bReturn; 73 | } 74 | 75 | bool Pop(cec_command &command, uint16_t iTimeout) 76 | { 77 | bool bReturn(false); 78 | P8PLATFORM::CLockObject lock(m_mutex); 79 | if (m_tvInBuffer.IsEmpty() && m_inBuffer.IsEmpty() && 80 | !m_condition.Wait(m_mutex, m_bHasData, iTimeout)) 81 | return bReturn; 82 | 83 | if (m_tvInBuffer.Pop(command)) 84 | bReturn = true; 85 | else if (m_inBuffer.Pop(command)) 86 | bReturn = true; 87 | 88 | m_bHasData = !m_tvInBuffer.IsEmpty() || !m_inBuffer.IsEmpty(); 89 | return bReturn; 90 | } 91 | 92 | private: 93 | P8PLATFORM::CMutex m_mutex; 94 | P8PLATFORM::CCondition m_condition; 95 | volatile bool m_bHasData; 96 | P8PLATFORM::SyncedBuffer m_tvInBuffer; 97 | P8PLATFORM::SyncedBuffer m_inBuffer; 98 | }; 99 | }; 100 | -------------------------------------------------------------------------------- /src/libcec/LibCECDll.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | 36 | int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) 37 | { 38 | return 1; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/libcec/adapter/AOCEC/AOCEC.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC AOCEC Code Copyright (C) 2016 Gerald Dachs 6 | * based heavily on: 7 | * libCEC Exynos Code Copyright (C) 2014 Valentin Manea 8 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 9 | * libCEC(R) is an original work, containing original code. 10 | * 11 | * libCEC(R) is a trademark of Pulse-Eight Limited. 12 | * 13 | * This program is dual-licensed; you can redistribute it and/or modify 14 | * it under the terms of the GNU General Public License as published by 15 | * the Free Software Foundation; either version 2 of the License, or 16 | * (at your option) any later version. 17 | * 18 | * This program is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public License 24 | * along with this program; if not, write to the Free Software 25 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 26 | * 27 | * 28 | * Alternatively, you can license this library under a commercial license, 29 | * please contact Pulse-Eight Licensing for more information. 30 | * 31 | * For more information contact: 32 | * Pulse-Eight Licensing 33 | * http://www.pulse-eight.com/ 34 | * http://www.pulse-eight.net/ 35 | */ 36 | 37 | 38 | #define CEC_IOC_MAGIC 'C' 39 | #define CEC_IOC_GET_PHYSICAL_ADDR _IOR(CEC_IOC_MAGIC, 0x00, uint16_t) 40 | #define CEC_IOC_GET_VERSION _IOR(CEC_IOC_MAGIC, 0x01, int) 41 | #define CEC_IOC_GET_VENDOR_ID _IOR(CEC_IOC_MAGIC, 0x02, uint32_t) 42 | #define CEC_IOC_GET_PORT_INFO _IOR(CEC_IOC_MAGIC, 0x03, int) 43 | #define CEC_IOC_GET_PORT_NUM _IOR(CEC_IOC_MAGIC, 0x04, int) 44 | #define CEC_IOC_GET_SEND_FAIL_REASON _IOR(CEC_IOC_MAGIC, 0x05, uint32_t) 45 | #define CEC_IOC_SET_OPTION_WAKEUP _IOW(CEC_IOC_MAGIC, 0x06, uint32_t) 46 | #define CEC_IOC_SET_OPTION_ENALBE_CEC _IOW(CEC_IOC_MAGIC, 0x07, uint32_t) 47 | #define CEC_IOC_SET_OPTION_SYS_CTRL _IOW(CEC_IOC_MAGIC, 0x08, uint32_t) 48 | #define CEC_IOC_SET_OPTION_SET_LANG _IOW(CEC_IOC_MAGIC, 0x09, uint32_t) 49 | #define CEC_IOC_GET_CONNECT_STATUS _IOR(CEC_IOC_MAGIC, 0x0A, uint32_t) 50 | #define CEC_IOC_ADD_LOGICAL_ADDR _IOW(CEC_IOC_MAGIC, 0x0B, uint32_t) 51 | #define CEC_IOC_CLR_LOGICAL_ADDR _IOW(CEC_IOC_MAGIC, 0x0C, uint32_t) 52 | 53 | #define CEC_MAX_FRAME_SIZE 16 54 | -------------------------------------------------------------------------------- /src/libcec/adapter/AOCEC/AOCECAdapterDetection.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC AOCEC Code Copyright (C) 2016 Gerald Dachs 5 | * based heavily on: 6 | * libCEC Exynos Code Copyright (C) 2014 Valentin Manea 7 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 8 | * libCEC(R) is an original work, containing original code. 9 | * 10 | * libCEC(R) is a trademark of Pulse-Eight Limited. 11 | * 12 | * This program is dual-licensed; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 25 | * 26 | * 27 | * Alternatively, you can license this library under a commercial license, 28 | * please contact Pulse-Eight Licensing for more information. 29 | * 30 | * For more information contact: 31 | * Pulse-Eight Licensing 32 | * http://www.pulse-eight.com/ 33 | * http://www.pulse-eight.net/ 34 | */ 35 | 36 | #include "env.h" 37 | #include 38 | 39 | #if defined(HAVE_AOCEC_API) 40 | #include "AOCECAdapterDetection.h" 41 | #include "AOCEC.h" 42 | 43 | using namespace CEC; 44 | 45 | bool CAOCECAdapterDetection::FindAdapter(void) 46 | { 47 | return access(CEC_AOCEC_PATH, 0) == 0; 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/libcec/adapter/AOCEC/AOCECAdapterDetection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC AOCEC Code Copyright (C) 2016 Gerald Dachs 6 | * based heavily on: 7 | * libCEC Exynos Code Copyright (C) 2014 Valentin Manea 8 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 9 | * libCEC(R) is an original work, containing original code. 10 | * 11 | * libCEC(R) is a trademark of Pulse-Eight Limited. 12 | * 13 | * This program is dual-licensed; you can redistribute it and/or modify 14 | * it under the terms of the GNU General Public License as published by 15 | * the Free Software Foundation; either version 2 of the License, or 16 | * (at your option) any later version. 17 | * 18 | * This program is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public License 24 | * along with this program; if not, write to the Free Software 25 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 26 | * 27 | * 28 | * Alternatively, you can license this library under a commercial license, 29 | * please contact Pulse-Eight Licensing for more information. 30 | * 31 | * For more information contact: 32 | * Pulse-Eight Licensing 33 | * http://www.pulse-eight.com/ 34 | * http://www.pulse-eight.net/ 35 | */ 36 | 37 | #include "env.h" 38 | 39 | namespace CEC 40 | { 41 | class CAOCECAdapterDetection 42 | { 43 | public: 44 | static bool FindAdapter(void); 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /src/libcec/adapter/AdapterFactory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include 37 | #include 38 | 39 | namespace CEC 40 | { 41 | class CLibCEC; 42 | class IAdapterCommunication; 43 | 44 | class CAdapterFactory 45 | { 46 | public: 47 | CAdapterFactory(CLibCEC *lib) : 48 | m_lib(lib) {} 49 | virtual ~CAdapterFactory(void) {}; 50 | 51 | int8_t FindAdapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL); 52 | int8_t DetectAdapters(cec_adapter_descriptor *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL); 53 | IAdapterCommunication *GetInstance(const char *strPort, uint16_t iBaudRate = CEC_SERIAL_DEFAULT_BAUDRATE); 54 | 55 | static void InitVideoStandalone(void); 56 | 57 | private: 58 | CLibCEC *m_lib; 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /src/libcec/adapter/Exynos/ExynosCEC.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea 6 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 7 | * libCEC(R) is an original work, containing original code. 8 | * 9 | * libCEC(R) is a trademark of Pulse-Eight Limited. 10 | * 11 | * This program is dual-licensed; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | 36 | #define CEC_DEFAULT_PADDR 0x1000 37 | #define CEC_PADDR_NAME "/sys/module/s5p_hdmi/parameters/source_phy_addr" 38 | #define CEC_IOC_SETLADDR _IOW('c', 0, unsigned int) 39 | #define CEC_MAX_FRAME_SIZE 16 40 | -------------------------------------------------------------------------------- /src/libcec/adapter/Exynos/ExynosCECAdapterDetection.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | #include 36 | 37 | #if defined(HAVE_EXYNOS_API) 38 | #include "ExynosCECAdapterDetection.h" 39 | #include "ExynosCEC.h" 40 | 41 | using namespace CEC; 42 | 43 | bool CExynosCECAdapterDetection::FindAdapter(void) 44 | { 45 | return access(CEC_EXYNOS_PATH, 0) == 0; 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/libcec/adapter/Exynos/ExynosCECAdapterDetection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea 6 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 7 | * libCEC(R) is an original work, containing original code. 8 | * 9 | * libCEC(R) is a trademark of Pulse-Eight Limited. 10 | * 11 | * This program is dual-licensed; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | 37 | namespace CEC 38 | { 39 | class CExynosCECAdapterDetection 40 | { 41 | public: 42 | static bool FindAdapter(void); 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /src/libcec/adapter/IMX/IMXCEC.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * IMX adpater port is Copyright (C) 2013 by Stephan Rafin 11 | * 12 | * You can redistribute this file and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 25 | * 26 | * 27 | */ 28 | 29 | 30 | /* 31 | * Ioctl definitions from kernel header 32 | */ 33 | #define HDMICEC_IOC_MAGIC 'H' 34 | #define HDMICEC_IOC_SETLOGICALADDRESS _IOW(HDMICEC_IOC_MAGIC, 1, unsigned char) 35 | #define HDMICEC_IOC_STARTDEVICE _IO(HDMICEC_IOC_MAGIC, 2) 36 | #define HDMICEC_IOC_STOPDEVICE _IO(HDMICEC_IOC_MAGIC, 3) 37 | #define HDMICEC_IOC_GETPHYADDRESS _IOR(HDMICEC_IOC_MAGIC, 4, unsigned char[4]) 38 | 39 | #define MESSAGE_TYPE_RECEIVE_SUCCESS 1 40 | #define MESSAGE_TYPE_NOACK 2 41 | #define MESSAGE_TYPE_DISCONNECTED 3 42 | #define MESSAGE_TYPE_CONNECTED 4 43 | #define MESSAGE_TYPE_SEND_SUCCESS 5 44 | 45 | #define MAX_CEC_MESSAGE_LEN 17 46 | 47 | typedef struct hdmi_cec_event { 48 | int event_type; 49 | int msg_len; 50 | unsigned char msg[MAX_CEC_MESSAGE_LEN]; 51 | } hdmi_cec_event; 52 | 53 | -------------------------------------------------------------------------------- /src/libcec/adapter/IMX/IMXCECAdapterDetection.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * IMX adpater port is Copyright (C) 2013 by Stephan Rafin 10 | * 11 | * You can redistribute this file and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 | * 25 | * 26 | */ 27 | 28 | #include "env.h" 29 | #include 30 | 31 | #if defined(HAVE_IMX_API) 32 | #include "IMXCECAdapterDetection.h" 33 | 34 | 35 | using namespace CEC; 36 | 37 | bool CIMXCECAdapterDetection::FindAdapter(void) 38 | { 39 | return access(CEC_IMX_PATH, 0) == 0; 40 | } 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/libcec/adapter/IMX/IMXCECAdapterDetection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * IMX adpater port is Copyright (C) 2013 by Stephan Rafin 11 | * 12 | * You can redistribute this file and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 25 | * 26 | * 27 | */ 28 | 29 | namespace CEC 30 | { 31 | class CIMXCECAdapterDetection 32 | { 33 | public: 34 | static bool FindAdapter(void); 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /src/libcec/adapter/Linux/LinuxCECAdapterCommunication.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC Linux CEC Adapter is Copyright (C) 2017-2018 Jonas Karlman 6 | * based heavily on: 7 | * libCEC AOCEC Code is Copyright (C) 2016 Gerald Dachs 8 | * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea 9 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 10 | * libCEC(R) is an original work, containing original code. 11 | * 12 | * libCEC(R) is a trademark of Pulse-Eight Limited. 13 | * 14 | * This program is dual-licensed; you can redistribute it and/or modify 15 | * it under the terms of the GNU General Public License as published by 16 | * the Free Software Foundation; either version 2 of the License, or 17 | * (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 27 | * 28 | * 29 | * Alternatively, you can license this library under a commercial license, 30 | * please contact Pulse-Eight Licensing for more information. 31 | * 32 | * For more information contact: 33 | * Pulse-Eight Licensing 34 | * http://www.pulse-eight.com/ 35 | * http://www.pulse-eight.net/ 36 | */ 37 | 38 | #include "env.h" 39 | 40 | #if defined(HAVE_LINUX_API) 41 | #include "p8-platform/threads/threads.h" 42 | #include "../AdapterCommunication.h" 43 | 44 | namespace CEC 45 | { 46 | class CLinuxCECAdapterCommunication : public IAdapterCommunication, public P8PLATFORM::CThread 47 | { 48 | public: 49 | /*! 50 | * @brief Create a new Linux CEC communication handler. 51 | * @param callback The callback to use for incoming CEC commands. 52 | */ 53 | CLinuxCECAdapterCommunication(IAdapterCommunicationCallback *callback); 54 | virtual ~CLinuxCECAdapterCommunication(void); 55 | 56 | /** @name IAdapterCommunication implementation */ 57 | ///{ 58 | bool Open(uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT, bool bSkipChecks = false, bool bStartListening = true) override; 59 | void Close(void) override; 60 | bool IsOpen(void) override; 61 | cec_adapter_message_state Write(const cec_command &data, bool &bRetry, uint8_t iLineTimeout, bool bIsReply) override; 62 | 63 | bool SetLineTimeout(uint8_t UNUSED(iTimeout)) override { return true; } 64 | bool StartBootloader(void) override { return false; } 65 | bool SetLogicalAddresses(const cec_logical_addresses &addresses) override; 66 | cec_logical_addresses GetLogicalAddresses(void) const override; 67 | bool PingAdapter(void) override { return true; } 68 | uint16_t GetFirmwareVersion(void) override { return 0; } 69 | uint32_t GetFirmwareBuildDate(void) override { return 0; } 70 | bool IsRunningLatestFirmware(void) override { return true; } 71 | bool SetControlledMode(bool UNUSED(controlled)) override { return true; } 72 | bool SaveConfiguration(const libcec_configuration & UNUSED(configuration)) override { return false; } 73 | bool SetAutoMode(bool UNUSED(automode)) override { return false; } 74 | bool GetConfiguration(libcec_configuration & UNUSED(configuration)) override { return false; } 75 | std::string GetPortName(void) override { return std::string("LINUX"); } 76 | uint16_t GetPhysicalAddress(void) override; 77 | cec_vendor_id GetVendorId(void) override; 78 | bool SupportsSourceLogicalAddress(const cec_logical_address address) override { return address > CECDEVICE_TV && address <= CECDEVICE_BROADCAST; } 79 | cec_adapter_type GetAdapterType(void) override { return ADAPTERTYPE_LINUX; } 80 | uint16_t GetAdapterVendorId(void) const override { return 1; } 81 | uint16_t GetAdapterProductId(void) const override { return 1; } 82 | void SetActiveSource(bool UNUSED(bSetTo), bool UNUSED(bClientUnregistered)) override {} 83 | #if CEC_LIB_VERSION_MAJOR >= 5 84 | bool GetStats(struct cec_adapter_stats* UNUSED(stats)) override { return false; } 85 | #endif 86 | ///} 87 | 88 | /** @name P8PLATFORM::CThread implementation */ 89 | ///{ 90 | void *Process(void) override; 91 | ///} 92 | 93 | private: 94 | int m_fd; 95 | }; 96 | }; 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /src/libcec/adapter/Linux/LinuxCECAdapterDetection.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC Linux CEC Adapter is Copyright (C) 2017 Jonas Karlman 5 | * based heavily on: 6 | * libCEC AOCEC Code is Copyright (C) 2016 Gerald Dachs 7 | * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea 8 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 9 | * libCEC(R) is an original work, containing original code. 10 | * 11 | * libCEC(R) is a trademark of Pulse-Eight Limited. 12 | * 13 | * This program is dual-licensed; you can redistribute it and/or modify 14 | * it under the terms of the GNU General Public License as published by 15 | * the Free Software Foundation; either version 2 of the License, or 16 | * (at your option) any later version. 17 | * 18 | * This program is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public License 24 | * along with this program; if not, write to the Free Software 25 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 26 | * 27 | * 28 | * Alternatively, you can license this library under a commercial license, 29 | * please contact Pulse-Eight Licensing for more information. 30 | * 31 | * For more information contact: 32 | * Pulse-Eight Licensing 33 | * http://www.pulse-eight.com/ 34 | * http://www.pulse-eight.net/ 35 | */ 36 | 37 | #include "env.h" 38 | #include 39 | 40 | #if defined(HAVE_LINUX_API) 41 | #include "LinuxCECAdapterDetection.h" 42 | 43 | using namespace CEC; 44 | 45 | bool CLinuxCECAdapterDetection::FindAdapter(void) 46 | { 47 | return access(CEC_LINUX_PATH, 0) == 0; 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/libcec/adapter/Linux/LinuxCECAdapterDetection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC Linux CEC Adapter is Copyright (C) 2017 Jonas Karlman 6 | * based heavily on: 7 | * libCEC AOCEC Code is Copyright (C) 2016 Gerald Dachs 8 | * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea 9 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 10 | * libCEC(R) is an original work, containing original code. 11 | * 12 | * libCEC(R) is a trademark of Pulse-Eight Limited. 13 | * 14 | * This program is dual-licensed; you can redistribute it and/or modify 15 | * it under the terms of the GNU General Public License as published by 16 | * the Free Software Foundation; either version 2 of the License, or 17 | * (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 27 | * 28 | * 29 | * Alternatively, you can license this library under a commercial license, 30 | * please contact Pulse-Eight Licensing for more information. 31 | * 32 | * For more information contact: 33 | * Pulse-Eight Licensing 34 | * http://www.pulse-eight.com/ 35 | * http://www.pulse-eight.net/ 36 | */ 37 | 38 | #include "env.h" 39 | 40 | #if defined(HAVE_LINUX_API) 41 | 42 | namespace CEC 43 | { 44 | class CLinuxCECAdapterDetection 45 | { 46 | public: 47 | static bool FindAdapter(void); 48 | }; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/libcec/adapter/Pulse-Eight/USBCECAdapterDetection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | 37 | namespace CEC 38 | { 39 | #define CEC_VID 0x2548 40 | #define CEC_PID 0x1001 41 | #define CEC_PID2 0x1002 42 | 43 | class CUSBCECAdapterDetection 44 | { 45 | public: 46 | static uint8_t FindAdapters(cec_adapter_descriptor *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL); 47 | static bool CanAutodetect(void); 48 | 49 | private: 50 | static uint8_t FindAdaptersWindows(cec_adapter_descriptor *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL); 51 | static uint8_t FindAdaptersApple(cec_adapter_descriptor *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL); 52 | static uint8_t FindAdaptersUdev(cec_adapter_descriptor *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL); 53 | static uint8_t FindAdaptersLinux(cec_adapter_descriptor *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL); 54 | static uint8_t FindAdaptersFreeBSD(cec_adapter_descriptor *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL); 55 | }; 56 | }; 57 | -------------------------------------------------------------------------------- /src/libcec/adapter/RPi/RPiCECAdapterDetection.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | 36 | #if defined(HAVE_RPI_API) 37 | #include "RPiCECAdapterDetection.h" 38 | 39 | extern "C" { 40 | #include 41 | #include 42 | #include 43 | } 44 | 45 | using namespace CEC; 46 | 47 | bool CRPiCECAdapterDetection::FindAdapter(void) 48 | { 49 | uint8_t iResult; 50 | 51 | VCHI_INSTANCE_T vchiq_instance; 52 | if ((iResult = vchi_initialise(&vchiq_instance)) != VCHIQ_SUCCESS) 53 | return false; 54 | 55 | if ((iResult = vchi_connect(NULL, 0, vchiq_instance)) != VCHIQ_SUCCESS) 56 | return false; 57 | 58 | bcm_host_init(); 59 | iResult = vc_cec_set_passive(true); 60 | if (iResult != VCHIQ_SUCCESS) 61 | return false; 62 | return true; 63 | } 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/libcec/adapter/RPi/RPiCECAdapterDetection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | 37 | namespace CEC 38 | { 39 | class CRPiCECAdapterDetection 40 | { 41 | public: 42 | static bool FindAdapter(void); 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /src/libcec/adapter/TDA995x/TDA995xCECAdapterDetection.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | #include 36 | 37 | #if defined(HAVE_TDA995X_API) 38 | #include "TDA995xCECAdapterDetection.h" 39 | 40 | extern "C" { 41 | #define __cec_h__ 42 | #include 43 | #include 44 | } 45 | 46 | using namespace CEC; 47 | 48 | bool CTDA995xCECAdapterDetection::FindAdapter(void) 49 | { 50 | return access(CEC_TDA995x_PATH, 0) == 0; 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/libcec/adapter/TDA995x/TDA995xCECAdapterDetection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | namespace CEC 37 | { 38 | class CTDA995xCECAdapterDetection 39 | { 40 | public: 41 | static bool FindAdapter(void); 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /src/libcec/adapter/Tegra/TegraCECAdapterDetection.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 | * 23 | * 24 | * Alternatively, you can license this library under a commercial license, 25 | * please contact Pulse-Eight Licensing for more information. 26 | * 27 | * For more information contact: 28 | * Pulse-Eight Licensing 29 | * http://www.pulse-eight.com/ 30 | * http://www.pulse-eight.net/ 31 | */ 32 | 33 | #include "env.h" 34 | #include 35 | 36 | #if defined(HAVE_TEGRA_API) 37 | #include "TegraCECAdapterDetection.h" 38 | #include "TegraCECDev.h" 39 | 40 | using namespace CEC; 41 | 42 | bool TegraCECAdapterDetection::FindAdapter(void) 43 | { 44 | return access(TEGRA_CEC_DEV_PATH, 0) == 0; 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/libcec/adapter/Tegra/TegraCECAdapterDetection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | namespace CEC 35 | { 36 | class TegraCECAdapterDetection 37 | { 38 | public: 39 | static bool FindAdapter(void); 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /src/libcec/adapter/Tegra/TegraCECDev.h: -------------------------------------------------------------------------------- 1 | #define TEGRA_CEC_DEV_PATH "/dev/tegra_cec" 2 | #define TEGRA_CEC_FRAME_MAX_LENGTH 16 3 | #define TEGRA_ADDR_PATH "/sys/devices/platform/tegra_cec/cec_logical_addr_config" 4 | -------------------------------------------------------------------------------- /src/libcec/cmake/DisplayPlatformSupport.cmake: -------------------------------------------------------------------------------- 1 | # - Display platform support found by CheckPlatformSupport.cmake 2 | 3 | message(STATUS "Configured features:") 4 | 5 | if (HAVE_P8_USB) 6 | message(STATUS "Pulse-Eight CEC Adapter: yes") 7 | else() 8 | message(STATUS "Pulse-Eight CEC Adapter: no") 9 | endif() 10 | 11 | if (HAVE_P8_USB_DETECT) 12 | message(STATUS "Pulse-Eight CEC Adapter detection: yes") 13 | else() 14 | message(STATUS "Pulse-Eight CEC Adapter detection: no") 15 | endif() 16 | 17 | if (HAVE_RANDR) 18 | message(STATUS "xrandr support: yes") 19 | else() 20 | message(STATUS "xrandr support: no") 21 | endif() 22 | 23 | if (HAVE_RPI_API) 24 | message(STATUS "Raspberry Pi support: yes") 25 | else() 26 | message(STATUS "Raspberry Pi support: no") 27 | endif() 28 | 29 | if (HAVE_TDA995X_API) 30 | message(STATUS "NXP TDA995x support: yes") 31 | else() 32 | message(STATUS "NXP TDA995x support: no") 33 | endif() 34 | 35 | if (HAVE_EXYNOS_API) 36 | message(STATUS "Exynos support: yes") 37 | else() 38 | message(STATUS "Exynos support: no") 39 | endif() 40 | 41 | if (HAVE_DRM_EDID_PARSER) 42 | message(STATUS "DRM support: yes") 43 | else() 44 | message(STATUS "DRM support: no") 45 | endif() 46 | 47 | if (HAVE_LINUX_API) 48 | message(STATUS "Linux kernel CEC framework support: yes") 49 | else() 50 | message(STATUS "Linux kernel CEC framework support: no") 51 | endif() 52 | 53 | if (HAVE_TEGRA_API) 54 | message(STATUS "Tegra support: yes") 55 | else() 56 | message(STATUS "Tegra support: no") 57 | endif() 58 | 59 | if (HAVE_AOCEC_API) 60 | message(STATUS "AOCEC (Odroid C2) SoC support: yes") 61 | else() 62 | message(STATUS "AOCEC (Odroid C2) SoC support: no") 63 | endif() 64 | 65 | if (HAVE_IMX_API) 66 | message(STATUS "i.MX6 SoC support: yes") 67 | else() 68 | message(STATUS "i.MX6 SoC support: no") 69 | endif() 70 | 71 | if (HAVE_PYTHON) 72 | message(STATUS "Python support: version ${PYTHONLIBS_VERSION_STRING} (${PYTHON_VERSION})") 73 | else() 74 | message(STATUS "Python support: no") 75 | endif() 76 | 77 | message(STATUS "lib info: ${LIB_INFO}") 78 | 79 | -------------------------------------------------------------------------------- /src/libcec/cmake/LinkPlatformSupport.cmake: -------------------------------------------------------------------------------- 1 | # - Link platform support dependencies found by CheckPlatformSupport.cmake 2 | 3 | list(APPEND cec_depends ${p8-platform_LIBRARIES} 4 | ${CMAKE_THREAD_LIBS_INIT}) 5 | 6 | # lockdev 7 | if (HAVE_LOCKDEV) 8 | list(APPEND cec_depends lockdev) 9 | endif() 10 | 11 | # udev 12 | if (HAVE_LIBUDEV) 13 | list(APPEND cec_depends udev) 14 | endif() 15 | 16 | # xrandr 17 | if (HAVE_RANDR) 18 | list(APPEND cec_depends Xrandr 19 | X11) 20 | endif() 21 | 22 | # rt 23 | if (HAVE_RT) 24 | list(APPEND cec_depends rt) 25 | endif() 26 | 27 | # dl 28 | if (HAVE_DLOPEN) 29 | list(APPEND cec_depends dl) 30 | endif() 31 | 32 | # raspberry pi 33 | if (HAVE_RPI_API) 34 | list(APPEND cec_depends ${RPI_VCOS} 35 | ${RPI_VCHIQ_ARM} 36 | ${RPI_BCM_HOST}) 37 | endif() 38 | 39 | # Apple 40 | if (APPLE) 41 | list(APPEND cec_depends "-framework CoreFoundation" 42 | "-framework IOKit" 43 | "-framework CoreVideo") 44 | endif() 45 | 46 | -------------------------------------------------------------------------------- /src/libcec/cmake/SetBuildInfo.cmake: -------------------------------------------------------------------------------- 1 | # - Set information about the system on which this was built in LIB_INFO 2 | # 3 | # This module sets the following variables 4 | # LIB_INFO supported features and compilation information 5 | # 6 | 7 | if(WIN32) 8 | 9 | # Windows 10 | set(LIB_INFO "compiled using MSVC ${CMAKE_CXX_COMPILER_VERSION}") 11 | 12 | else() 13 | # not Windows 14 | set(LIB_INFO "") 15 | 16 | # add git revision to compile info 17 | find_program(HAVE_GIT_BIN git /bin /usr/bin /usr/local/bin) 18 | if(HAVE_GIT_BIN) 19 | execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/git-rev.sh OUTPUT_VARIABLE GIT_REVISION) 20 | string(STRIP ${GIT_REVISION} GIT_REVISION) 21 | message(STATUS "git found: ${GIT_REVISION}") 22 | endif() 23 | if (GIT_REVISION) 24 | set(LIB_INFO "git revision: ${GIT_REVISION},") 25 | endif() 26 | 27 | # add compilation date to compile info 28 | STRING(TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S" UTC) 29 | set(LIB_INFO "${LIB_INFO} compiled on ${BUILD_DATE}") 30 | 31 | # add user who built this to compile info 32 | find_program(HAVE_WHOAMI_BIN whoami /bin /usr/bin /usr/local/bin) 33 | if (DEFINED ENV{SOURCE_DATE_EPOCH}) 34 | set(BUILD_USER "(reproducible)") 35 | else() 36 | if(HAVE_WHOAMI_BIN) 37 | execute_process(COMMAND bash -c "whoami" OUTPUT_VARIABLE BUILD_USER) 38 | string(STRIP ${BUILD_USER} BUILD_USER) 39 | set(LIB_INFO "${LIB_INFO} by ${BUILD_USER}") 40 | else() 41 | set(LIB_INFO "${LIB_INFO} by (unknown user)") 42 | endif() 43 | endif() 44 | 45 | # add host on which this was built to compile info 46 | if (DEFINED ENV{SOURCE_DATE_EPOCH}) 47 | set(BUILD_HOST "(reproducible)") 48 | else() 49 | find_program(HAVE_HOSTNAME_BIN hostname /bin /usr/bin /usr/local/bin) 50 | if(HAVE_HOSTNAME_BIN) 51 | execute_process(COMMAND bash -c "hostname" ARGS -f OUTPUT_VARIABLE BUILD_HOST RESULT_VARIABLE RETURN_HOST) 52 | if (RETURN_HOST) 53 | execute_process(COMMAND bash -c "hostname" OUTPUT_VARIABLE BUILD_HOST) 54 | endif() 55 | string(STRIP ${BUILD_HOST} BUILD_HOST) 56 | set(LIB_INFO "${LIB_INFO}@${BUILD_HOST}") 57 | endif() 58 | endif() 59 | 60 | # add host info on which this was built to compile info 61 | find_program(HAVE_UNAME_BIN uname /bin /usr/bin /usr/local/bin) 62 | if(HAVE_UNAME_BIN) 63 | execute_process(COMMAND bash -c "uname" ARGS -s OUTPUT_VARIABLE BUILD_SYSNAME) 64 | execute_process(COMMAND bash -c "uname" ARGS -r OUTPUT_VARIABLE BUILD_SYSVER) 65 | execute_process(COMMAND bash -c "uname" ARGS -m OUTPUT_VARIABLE BUILD_SYSARCH) 66 | string(STRIP ${BUILD_SYSNAME} BUILD_SYSNAME) 67 | string(STRIP ${BUILD_SYSVER} BUILD_SYSVER) 68 | string(STRIP ${BUILD_SYSARCH} BUILD_SYSARCH) 69 | 70 | set(LIB_INFO "${LIB_INFO} on ${BUILD_SYSNAME} ${BUILD_SYSVER} (${BUILD_SYSARCH})") 71 | endif() 72 | 73 | endif() 74 | 75 | -------------------------------------------------------------------------------- /src/libcec/cmake/__init__.py: -------------------------------------------------------------------------------- 1 | ## dummy import for Python 2.x ## 2 | -------------------------------------------------------------------------------- /src/libcec/cmake/git-rev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## cmake doesn't read the variable when it doesn't end with a newline, and I haven't figured out how to have it add a newline directly... 4 | if git rev-parse --git-dir > /dev/null 2>&1; then 5 | last_tag=`git describe --tags --abbrev=0` 6 | last_hash=`git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h"` 7 | commits_since_tag=`git log ${last_tag}..HEAD --oneline | wc -l` 8 | git_dirty=`git diff HEAD | wc -l` 9 | if [ $commits_since_tag -gt 0 ]; then 10 | dirty="" 11 | if [ $git_dirty -gt 0 ]; then 12 | dirty="~dirty" 13 | fi 14 | echo "${last_tag}+${commits_since_tag}-${last_hash}${dirty}" 15 | else 16 | echo $last_tag 17 | fi 18 | else 19 | echo "" 20 | fi 21 | -------------------------------------------------------------------------------- /src/libcec/devices/CECAudioSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "CECBusDevice.h" 37 | 38 | namespace CEC 39 | { 40 | class CCECAudioSystem : public CCECBusDevice 41 | { 42 | public: 43 | CCECAudioSystem(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = CEC_INVALID_PHYSICAL_ADDRESS); 44 | virtual ~CCECAudioSystem(void) {}; 45 | 46 | bool SetAudioStatus(uint8_t status); 47 | bool SetSystemAudioModeStatus(const cec_system_audio_status mode); 48 | bool TransmitAudioStatus(cec_logical_address dest, bool bIsReply); 49 | bool TransmitSetSystemAudioMode(cec_logical_address dest, bool bIsReply); 50 | bool TransmitSystemAudioModeStatus(cec_logical_address dest, bool bIsReply); 51 | 52 | uint8_t VolumeUp(const cec_logical_address source, bool bSendRelease = true); 53 | uint8_t VolumeDown(const cec_logical_address source, bool bSendRelease = true); 54 | uint8_t MuteAudio(const cec_logical_address source); 55 | uint8_t GetAudioStatus(const cec_logical_address initiator, bool bUpdate = false); 56 | bool EnableAudio(CCECBusDevice* device = nullptr); 57 | 58 | bool TransmitActiveSource(bool bIsReply) { (void)bIsReply; return false; } 59 | 60 | protected: 61 | bool RequestAudioStatus(const cec_logical_address initiator, bool bWaitForResponse = true); 62 | 63 | cec_system_audio_status m_systemAudioStatus; 64 | uint8_t m_audioStatus; 65 | }; 66 | } 67 | -------------------------------------------------------------------------------- /src/libcec/devices/CECDeviceMap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include 37 | #include 38 | 39 | namespace CEC 40 | { 41 | class CCECBusDevice; 42 | 43 | typedef std::map CECDEVICEMAP; 44 | typedef std::vector CECDEVICEVEC; 45 | 46 | class CCECProcessor; 47 | 48 | class CCECDeviceMap 49 | { 50 | public: 51 | CCECDeviceMap(CCECProcessor *processor); 52 | virtual ~CCECDeviceMap(void); 53 | CECDEVICEMAP::iterator Begin(void); 54 | CECDEVICEMAP::iterator End(void); 55 | void ResetDeviceStatus(void); 56 | CCECBusDevice * operator[] (cec_logical_address iAddress) const; 57 | CCECBusDevice * operator[] (uint8_t iAddress) const; 58 | CCECBusDevice * At(cec_logical_address iAddress) const; 59 | CCECBusDevice * At(uint8_t iAddress) const; 60 | CCECBusDevice * GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bSuppressUpdate = true); 61 | 62 | void Get(CECDEVICEVEC &devices) const; 63 | void GetLibCECControlled(CECDEVICEVEC &devices) const; 64 | void GetByLogicalAddresses(CECDEVICEVEC &devices, const cec_logical_addresses &addresses); 65 | void GetActive(CECDEVICEVEC &devices) const; 66 | bool IsActiveType(const cec_device_type type, bool suppressPoll = true) const; 67 | void GetByType(const cec_device_type type, CECDEVICEVEC &devices) const; 68 | void GetChildrenOf(CECDEVICEVEC& devices, CCECBusDevice* device) const; 69 | void SignalAll(cec_opcode opcode); 70 | 71 | void GetPowerOffDevices(const libcec_configuration &configuration, CECDEVICEVEC &devices) const; 72 | void GetWakeDevices(const libcec_configuration &configuration, CECDEVICEVEC &devices) const; 73 | 74 | CCECBusDevice *GetActiveSource(void) const; 75 | void ResetActiveSourceSent(void); 76 | 77 | static void FilterLibCECControlled(CECDEVICEVEC &devices); 78 | static void FilterActive(CECDEVICEVEC &devices); 79 | static void FilterTypes(const cec_device_type_list &types, CECDEVICEVEC &devices); 80 | static void FilterType(const cec_device_type type, CECDEVICEVEC &devices); 81 | static cec_logical_addresses ToLogicalAddresses(const CECDEVICEVEC &devices); 82 | private: 83 | void Clear(void); 84 | 85 | CECDEVICEMAP m_busDevices; 86 | CCECProcessor *m_processor; 87 | }; 88 | } 89 | -------------------------------------------------------------------------------- /src/libcec/devices/CECPlaybackDevice.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | #include "CECPlaybackDevice.h" 36 | #include "implementations/CECCommandHandler.h" 37 | #include "CECProcessor.h" 38 | #include "LibCEC.h" 39 | #include "CECTypeUtils.h" 40 | 41 | using namespace CEC; 42 | using namespace P8PLATFORM; 43 | 44 | #define ToString(p) CCECTypeUtils::ToString(p) 45 | 46 | CCECPlaybackDevice::CCECPlaybackDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) : 47 | CCECBusDevice(processor, address, iPhysicalAddress), 48 | m_deckStatus(CEC_DECK_INFO_STOP), 49 | m_deckControlMode(CEC_DECK_CONTROL_MODE_STOP) 50 | { 51 | m_type = CEC_DEVICE_TYPE_PLAYBACK_DEVICE; 52 | } 53 | 54 | cec_deck_info CCECPlaybackDevice::GetDeckStatus(const cec_logical_address UNUSED(initiator)) 55 | { 56 | CLockObject lock(m_mutex); 57 | return m_deckStatus; 58 | } 59 | 60 | void CCECPlaybackDevice::SetDeckStatus(cec_deck_info deckStatus) 61 | { 62 | CLockObject lock(m_mutex); 63 | if (m_deckStatus != deckStatus) 64 | { 65 | m_processor->GetLib()->AddLog(CEC_LOG_DEBUG, ">> %s (%X): deck status changed from '%s' to '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(m_deckStatus), ToString(deckStatus)); 66 | m_deckStatus = deckStatus; 67 | } 68 | } 69 | 70 | cec_deck_control_mode CCECPlaybackDevice::GetDeckControlMode(const cec_logical_address UNUSED(initiator)) 71 | { 72 | CLockObject lock(m_mutex); 73 | return m_deckControlMode; 74 | } 75 | 76 | void CCECPlaybackDevice::SetDeckControlMode(cec_deck_control_mode mode) 77 | { 78 | CLockObject lock(m_mutex); 79 | if (m_deckControlMode != mode) 80 | { 81 | m_processor->GetLib()->AddLog(CEC_LOG_DEBUG, ">> %s (%X): deck control mode changed from '%s' to '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(m_deckControlMode), ToString(mode)); 82 | m_deckControlMode = mode; 83 | } 84 | } 85 | 86 | bool CCECPlaybackDevice::TransmitDeckStatus(cec_logical_address dest, bool bIsReply) 87 | { 88 | cec_deck_info state; 89 | { 90 | CLockObject lock(m_mutex); 91 | m_processor->GetLib()->AddLog(CEC_LOG_DEBUG, "<< %s (%X) -> %s (%X): deck status '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString(m_deckStatus)); 92 | state = m_deckStatus; 93 | } 94 | 95 | return m_handler->TransmitDeckStatus(m_iLogicalAddress, dest, state, bIsReply); 96 | } 97 | 98 | void CCECPlaybackDevice::ResetDeviceStatus(bool bClientUnregistered /* = false */) 99 | { 100 | CLockObject lock(m_mutex); 101 | m_deckStatus = CEC_DECK_INFO_STOP; 102 | m_deckControlMode = CEC_DECK_CONTROL_MODE_STOP; 103 | CCECBusDevice::ResetDeviceStatus(bClientUnregistered); 104 | } 105 | -------------------------------------------------------------------------------- /src/libcec/devices/CECPlaybackDevice.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "CECBusDevice.h" 37 | 38 | namespace CEC 39 | { 40 | class CCECPlaybackDevice : public CCECBusDevice 41 | { 42 | public: 43 | CCECPlaybackDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = CEC_INVALID_PHYSICAL_ADDRESS); 44 | virtual ~CCECPlaybackDevice(void) {}; 45 | 46 | cec_deck_info GetDeckStatus(const cec_logical_address initiator); 47 | cec_deck_control_mode GetDeckControlMode(const cec_logical_address initiator); 48 | 49 | void SetDeckStatus(cec_deck_info deckStatus); 50 | void SetDeckControlMode(cec_deck_control_mode mode); 51 | 52 | bool TransmitDeckStatus(cec_logical_address dest, bool bIsReply); 53 | 54 | virtual void ResetDeviceStatus(bool bClientUnregistered = false);; 55 | 56 | protected: 57 | cec_deck_info m_deckStatus; 58 | cec_deck_control_mode m_deckControlMode; 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /src/libcec/devices/CECRecordingDevice.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | #include "CECRecordingDevice.h" 36 | 37 | using namespace CEC; 38 | using namespace P8PLATFORM; 39 | 40 | CCECRecordingDevice::CCECRecordingDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) : 41 | CCECPlaybackDevice(processor, address, iPhysicalAddress), 42 | m_tuner(processor, address, iPhysicalAddress) 43 | { 44 | m_type = CEC_DEVICE_TYPE_RECORDING_DEVICE; 45 | } 46 | 47 | void CCECRecordingDevice::ResetDeviceStatus(bool bClientUnregistered /* = false */) 48 | { 49 | CLockObject lock(m_mutex); 50 | m_tuner.ResetDeviceStatus(); 51 | CCECPlaybackDevice::ResetDeviceStatus(bClientUnregistered); 52 | } 53 | -------------------------------------------------------------------------------- /src/libcec/devices/CECRecordingDevice.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "CECBusDevice.h" 37 | #include "CECPlaybackDevice.h" 38 | #include "CECTuner.h" 39 | 40 | namespace CEC 41 | { 42 | class CCECRecordingDevice : public CCECPlaybackDevice 43 | { 44 | public: 45 | CCECRecordingDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = CEC_INVALID_PHYSICAL_ADDRESS); 46 | virtual ~CCECRecordingDevice(void) {}; 47 | 48 | virtual void ResetDeviceStatus(bool bClientUnregistered = false); 49 | 50 | /* TODO: tuner methods */ 51 | protected: 52 | CCECTuner m_tuner; 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /src/libcec/devices/CECTV.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | #include "CECTV.h" 36 | 37 | using namespace CEC; 38 | using namespace P8PLATFORM; 39 | 40 | CCECTV::CCECTV(CCECProcessor *processor, cec_logical_address address) : 41 | CCECBusDevice(processor, address, CEC_PHYSICAL_ADDRESS_TV) 42 | { 43 | m_type = CEC_DEVICE_TYPE_TV; 44 | } 45 | -------------------------------------------------------------------------------- /src/libcec/devices/CECTV.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "CECBusDevice.h" 37 | 38 | namespace CEC 39 | { 40 | class CCECTV : public CCECBusDevice 41 | { 42 | public: 43 | CCECTV(CCECProcessor *processor, cec_logical_address address); 44 | virtual ~CCECTV(void) {}; 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /src/libcec/devices/CECTuner.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | #include "CECTuner.h" 36 | 37 | using namespace CEC; 38 | using namespace P8PLATFORM; 39 | 40 | CCECTuner::CCECTuner(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) : 41 | CCECBusDevice(processor, address, iPhysicalAddress) 42 | { 43 | m_type = CEC_DEVICE_TYPE_TUNER; 44 | } 45 | -------------------------------------------------------------------------------- /src/libcec/devices/CECTuner.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "CECBusDevice.h" 37 | 38 | namespace CEC 39 | { 40 | class CCECTuner : public CCECBusDevice 41 | { 42 | public: 43 | CCECTuner(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = CEC_INVALID_PHYSICAL_ADDRESS); 44 | virtual ~CCECTuner(void) {}; 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /src/libcec/env.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * WARNING: Auto-generated file from env.h.in 4 | * 5 | * This file is part of the libCEC(R) library. 6 | * 7 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 8 | * libCEC(R) is an original work, containing original code. 9 | * 10 | * libCEC(R) is a trademark of Pulse-Eight Limited. 11 | * 12 | * This program is dual-licensed; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 25 | * 26 | * 27 | * Alternatively, you can license this library under a commercial license, 28 | * please contact Pulse-Eight Licensing for more information. 29 | * 30 | * For more information contact: 31 | * Pulse-Eight Licensing 32 | * http://www.pulse-eight.com/ 33 | * http://www.pulse-eight.net/ 34 | */ 35 | 36 | #include "cectypes.h" 37 | #include "p8-platform/os.h" 38 | 39 | #ifdef UNUSED 40 | #elif defined(__GNUC__) 41 | #define UNUSED(x) UNUSED_ ## x __attribute__((unused)) 42 | #elif defined(__LCLINT__) 43 | #define UNUSED(x) /*@unused@*/ x 44 | #else 45 | #define UNUSED(x) x 46 | #endif 47 | 48 | #ifndef ON 49 | #define ON (1) 50 | #endif 51 | 52 | /* Define to 1 for xrandr support */ 53 | #cmakedefine HAVE_RANDR @HAVE_RANDR@ 54 | 55 | /* Define to 1 if should be included for flock() */ 56 | #cmakedefine HAVE_SYS_FILE_HEADER @HAVE_SYS_FILE_HEADER@ 57 | 58 | /* Define to 1 for flock() support */ 59 | #cmakedefine HAVE_FLOCK @HAVE_FLOCK@ 60 | 61 | /* Define to 1 for udev support */ 62 | #cmakedefine HAVE_LIBUDEV @HAVE_LIBUDEV@ 63 | 64 | /* Define to 1 for Pulse-Eight CEC Adapter support */ 65 | #cmakedefine HAVE_P8_USB @HAVE_P8_USB@ 66 | 67 | /* Define to 1 for Pulse-Eight CEC Adapter detection support */ 68 | #cmakedefine HAVE_P8_USB_DETECT @HAVE_P8_USB_DETECT@ 69 | 70 | /* Define to 1 for Raspberry Pi support */ 71 | #cmakedefine HAVE_RPI_API @HAVE_RPI_API@ 72 | 73 | /* Define to 1 for TDA995x support */ 74 | #cmakedefine HAVE_TDA995X_API @HAVE_TDA995X_API@ 75 | 76 | /* Define to 1 for IMX support */ 77 | #cmakedefine HAVE_IMX_API @HAVE_IMX_API@ 78 | 79 | /* Define to 1 for Exynos support */ 80 | #cmakedefine HAVE_EXYNOS_API @HAVE_EXYNOS_API@ 81 | 82 | /* Define to 1 for Linux support */ 83 | #cmakedefine HAVE_LINUX_API @HAVE_LINUX_API@ 84 | 85 | /* Define to 1 for Tegra support */ 86 | #cmakedefine HAVE_TEGRA_API @HAVE_TEGRA_API@ 87 | 88 | /* Define to 1 for AOCEC support */ 89 | #cmakedefine HAVE_AOCEC_API @HAVE_AOCEC_API@ 90 | 91 | /* Define to 1 for nVidia EDID parsing support (on selected models) */ 92 | #cmakedefine HAVE_NVIDIA_EDID_PARSER @HAVE_NVIDIA_EDID_PARSER@ 93 | 94 | /* Define to 1 for DRM EDID parsing support */ 95 | #cmakedefine HAVE_DRM_EDID_PARSER @HAVE_DRM_EDID_PARSER@ 96 | 97 | /* Define to 1 for Python support */ 98 | #cmakedefine HAVE_PYTHON @HAVE_PYTHON@ 99 | 100 | /* information about how libCEC was compiled */ 101 | #define LIB_INFO ("@LIB_INFO@") 102 | -------------------------------------------------------------------------------- /src/libcec/implementations/ANCommandHandler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "CECCommandHandler.h" 37 | 38 | namespace CEC 39 | { 40 | class CANCommandHandler : public CCECCommandHandler 41 | { 42 | public: 43 | CANCommandHandler(CCECBusDevice *busDevice, 44 | int32_t iTransmitTimeout = CEC_DEFAULT_TRANSMIT_TIMEOUT, 45 | int32_t iTransmitWait = CEC_DEFAULT_TRANSMIT_WAIT, 46 | int8_t iTransmitRetries = CEC_DEFAULT_TRANSMIT_RETRIES, 47 | int64_t iActiveSourcePending = 0); 48 | virtual ~CANCommandHandler(void) {}; 49 | 50 | int HandleVendorRemoteButtonDown(const cec_command &command); 51 | int HandleDeviceVendorCommandWithId(const cec_command &command); 52 | int HandleSetMenuLanguage(const cec_command &command); 53 | 54 | protected: 55 | bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination); 56 | }; 57 | }; 58 | -------------------------------------------------------------------------------- /src/libcec/implementations/AQCommandHandler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | #include "AQCommandHandler.h" 36 | 37 | #include "devices/CECBusDevice.h" 38 | #include "CECProcessor.h" 39 | #include "LibCEC.h" 40 | #include "CECClient.h" 41 | 42 | using namespace CEC; 43 | using namespace P8PLATFORM; 44 | 45 | #define LIB_CEC m_busDevice->GetProcessor()->GetLib() 46 | #define ToString(p) LIB_CEC->ToString(p) 47 | 48 | CAQCommandHandler::CAQCommandHandler(CCECBusDevice *busDevice, 49 | int32_t iTransmitTimeout /* = CEC_DEFAULT_TRANSMIT_TIMEOUT */, 50 | int32_t iTransmitWait /* = CEC_DEFAULT_TRANSMIT_WAIT */, 51 | int8_t iTransmitRetries /* = CEC_DEFAULT_TRANSMIT_RETRIES */, 52 | int64_t iActiveSourcePending /* = 0 */) : 53 | CCECCommandHandler(busDevice, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending), 54 | m_powerOnCheck(NULL) 55 | { 56 | m_vendorId = CEC_VENDOR_SHARP; 57 | } 58 | 59 | CAQCommandHandler::~CAQCommandHandler(void) 60 | { 61 | delete m_powerOnCheck; 62 | } 63 | 64 | bool CAQCommandHandler::PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination) 65 | { 66 | bool bCheck(false); 67 | bool bRetval(false); 68 | if (m_busDevice->GetCurrentPowerStatus() != CEC_POWER_STATUS_ON && (!m_powerOnCheck || !m_powerOnCheck->IsRunning())) 69 | bCheck = true; 70 | bRetval = CCECCommandHandler::PowerOn(iInitiator, iDestination); 71 | 72 | if (bRetval && bCheck) 73 | { 74 | if (!m_powerOnCheck) 75 | m_powerOnCheck = new CAQPowerStatusCheck(this, iInitiator, iDestination); 76 | if (m_powerOnCheck) 77 | m_powerOnCheck->CreateThread(); 78 | } 79 | 80 | return bRetval; 81 | } 82 | 83 | void* CAQPowerStatusCheck::Process(void) 84 | { 85 | // sleep for 2 seconds and query the power status 86 | Sleep(2000); 87 | if (m_handler->m_busDevice->GetProcessor()->GetDevice(m_iDestination)->GetPowerStatus(m_iInitiator, true) == CEC_POWER_STATUS_STANDBY) 88 | m_handler->m_busDevice->GetProcessor()->GetLib()->AddLog(CEC_LOG_WARNING, "AQUOS LINK 'auto power on' is disabled, which prevents the TV from being powered on. To correct this, press the menu button on your remote, go to 'link operation' -> 'AQUOS LINK setup' -> 'Auto power on' and set it to 'On'"); 89 | return NULL; 90 | } 91 | -------------------------------------------------------------------------------- /src/libcec/implementations/AQCommandHandler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "CECCommandHandler.h" 37 | #include "p8-platform/threads/threads.h" 38 | 39 | namespace CEC 40 | { 41 | class CAQPowerStatusCheck; 42 | 43 | class CAQCommandHandler : public CCECCommandHandler 44 | { 45 | friend class CAQPowerStatusCheck; 46 | public: 47 | CAQCommandHandler(CCECBusDevice *busDevice, 48 | int32_t iTransmitTimeout = CEC_DEFAULT_TRANSMIT_TIMEOUT, 49 | int32_t iTransmitWait = CEC_DEFAULT_TRANSMIT_WAIT, 50 | int8_t iTransmitRetries = CEC_DEFAULT_TRANSMIT_RETRIES, 51 | int64_t iActiveSourcePending = 0); 52 | virtual ~CAQCommandHandler(void); 53 | 54 | protected: 55 | virtual bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination); 56 | 57 | private: 58 | CAQPowerStatusCheck* m_powerOnCheck; 59 | }; 60 | 61 | class CAQPowerStatusCheck : public P8PLATFORM::CThread 62 | { 63 | public: 64 | CAQPowerStatusCheck(CAQCommandHandler* handler, cec_logical_address iInitiator, cec_logical_address iDestination) : 65 | m_handler(handler), 66 | m_iInitiator(iInitiator), 67 | m_iDestination(iDestination) {} 68 | virtual ~CAQPowerStatusCheck(void) {} 69 | 70 | private: 71 | void* Process(void); 72 | CAQCommandHandler* m_handler; 73 | cec_logical_address m_iInitiator; 74 | cec_logical_address m_iDestination; 75 | }; 76 | }; 77 | -------------------------------------------------------------------------------- /src/libcec/implementations/PHCommandHandler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "CECCommandHandler.h" 37 | #include "p8-platform/threads/threads.h" 38 | 39 | namespace CEC 40 | { 41 | class CPHCommandHandler; 42 | 43 | class CImageViewOnCheck : public P8PLATFORM::CThread 44 | { 45 | public: 46 | CImageViewOnCheck(CPHCommandHandler* handler): 47 | m_handler(handler) {} 48 | virtual ~CImageViewOnCheck(void); 49 | 50 | void* Process(void); 51 | 52 | private: 53 | CPHCommandHandler* m_handler; 54 | P8PLATFORM::CEvent m_event; 55 | }; 56 | 57 | class CPHCommandHandler : public CCECCommandHandler 58 | { 59 | friend class CImageViewOnCheck; 60 | public: 61 | CPHCommandHandler(CCECBusDevice *busDevice, 62 | int32_t iTransmitTimeout = CEC_DEFAULT_TRANSMIT_TIMEOUT, 63 | int32_t iTransmitWait = CEC_DEFAULT_TRANSMIT_WAIT, 64 | int8_t iTransmitRetries = CEC_DEFAULT_TRANSMIT_RETRIES, 65 | int64_t iActiveSourcePending = 0); 66 | virtual ~CPHCommandHandler(void); 67 | 68 | bool InitHandler(void); 69 | 70 | protected: 71 | virtual bool ActivateSource(bool bTransmitDelayedCommandsOnly = false); 72 | virtual int HandleUserControlPressed(const cec_command& command); 73 | virtual int HandleUserControlRelease(const cec_command& command); 74 | virtual bool TransmitVendorID(const cec_logical_address iInitiator, const cec_logical_address iDestination, uint64_t iVendorId, bool bIsReply); 75 | virtual int HandleDeviceVendorId(const cec_command& command); 76 | uint8_t m_iLastKeyCode; 77 | CImageViewOnCheck* m_imageViewOnCheck; 78 | }; 79 | }; 80 | -------------------------------------------------------------------------------- /src/libcec/implementations/RHCommandHandler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | #include "RHCommandHandler.h" 36 | 37 | #include "devices/CECBusDevice.h" 38 | #include "CECProcessor.h" 39 | #include "LibCEC.h" 40 | #include "CECClient.h" 41 | 42 | using namespace CEC; 43 | 44 | #define LIB_CEC m_busDevice->GetProcessor()->GetLib() 45 | #define ToString(p) LIB_CEC->ToString(p) 46 | 47 | CRHCommandHandler::CRHCommandHandler(CCECBusDevice *busDevice, 48 | int32_t iTransmitTimeout /* = CEC_DEFAULT_TRANSMIT_TIMEOUT */, 49 | int32_t iTransmitWait /* = CEC_DEFAULT_TRANSMIT_WAIT */, 50 | int8_t iTransmitRetries /* = CEC_DEFAULT_TRANSMIT_RETRIES */, 51 | int64_t iActiveSourcePending /* = 0 */) : 52 | CCECCommandHandler(busDevice, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending) 53 | { 54 | m_vendorId = CEC_VENDOR_ONKYO; 55 | } 56 | 57 | int CRHCommandHandler::HandleDeviceVendorCommandWithId(const cec_command &command) 58 | { 59 | // onkyo's vendor id 60 | if (command.parameters[0] == 0x00 && command.parameters[1] == 0x09 && command.parameters[2] == 0xb0) 61 | { 62 | // ignore unknown vendor commands sent by onkyo devices, bugzid: 2559 63 | } 64 | return CEC_ABORT_REASON_REFUSED; 65 | } 66 | -------------------------------------------------------------------------------- /src/libcec/implementations/RHCommandHandler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "CECCommandHandler.h" 37 | 38 | namespace CEC 39 | { 40 | class CRHCommandHandler : public CCECCommandHandler 41 | { 42 | public: 43 | CRHCommandHandler(CCECBusDevice *busDevice, 44 | int32_t iTransmitTimeout = CEC_DEFAULT_TRANSMIT_TIMEOUT, 45 | int32_t iTransmitWait = CEC_DEFAULT_TRANSMIT_WAIT, 46 | int8_t iTransmitRetries = CEC_DEFAULT_TRANSMIT_RETRIES, 47 | int64_t iActiveSourcePending = 0); 48 | virtual ~CRHCommandHandler(void) {}; 49 | 50 | protected: 51 | int HandleDeviceVendorCommandWithId(const cec_command &command); 52 | }; 53 | }; 54 | -------------------------------------------------------------------------------- /src/libcec/implementations/RLCommandHandler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "CECCommandHandler.h" 37 | 38 | namespace CEC 39 | { 40 | class CRLCommandHandler : public CCECCommandHandler 41 | { 42 | public: 43 | CRLCommandHandler(CCECBusDevice *busDevice, 44 | int32_t iTransmitTimeout = CEC_DEFAULT_TRANSMIT_TIMEOUT, 45 | int32_t iTransmitWait = CEC_DEFAULT_TRANSMIT_WAIT, 46 | int8_t iTransmitRetries = CEC_DEFAULT_TRANSMIT_RETRIES, 47 | int64_t iActiveSourcePending = 0); 48 | virtual ~CRLCommandHandler(void) {}; 49 | 50 | bool InitHandler(void); 51 | int HandleDeviceVendorCommandWithId(const cec_command &command); 52 | }; 53 | }; 54 | -------------------------------------------------------------------------------- /src/libcec/implementations/SLCommandHandler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "CECCommandHandler.h" 37 | 38 | namespace CEC 39 | { 40 | class CSLCommandHandler : public CCECCommandHandler 41 | { 42 | public: 43 | CSLCommandHandler(CCECBusDevice *busDevice, 44 | int32_t iTransmitTimeout = CEC_DEFAULT_TRANSMIT_TIMEOUT, 45 | int32_t iTransmitWait = CEC_DEFAULT_TRANSMIT_WAIT, 46 | int8_t iTransmitRetries = CEC_DEFAULT_TRANSMIT_RETRIES, 47 | int64_t iActiveSourcePending = 0); 48 | virtual ~CSLCommandHandler(void) {}; 49 | 50 | bool InitHandler(void); 51 | bool ActivateSource(bool bTransmitDelayedCommandsOnly = false); 52 | 53 | protected: 54 | int HandleVendorCommand(const cec_command &command); 55 | 56 | void HandleVendorCommandSLInit(const cec_command &command); 57 | void TransmitVendorCommandSLAckInit(const cec_logical_address iSource, const cec_logical_address iDestination); 58 | 59 | void HandleVendorCommandPowerOn(const cec_command &command, bool activateSource); 60 | void HandleVendorCommandPowerOnStatus(const cec_command &command); 61 | 62 | void HandleVendorCommandSLConnect(const cec_command &command); 63 | void TransmitVendorCommandSetDeviceMode(const cec_logical_address iSource, const cec_logical_address iDestination, const cec_device_type type); 64 | 65 | int HandleGiveDevicePowerStatus(const cec_command &command); 66 | int HandleGiveDeckStatus(const cec_command &command); 67 | int HandleRequestActiveSource(const cec_command &command); 68 | int HandleFeatureAbort(const cec_command &command); 69 | int HandleStandby(const cec_command &command); 70 | bool TransmitMenuState(const cec_logical_address UNUSED(iInitiator), const cec_logical_address UNUSED(iDestination), cec_menu_state UNUSED(menuState), bool UNUSED(bIsReply)) { return true; } 71 | bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination); 72 | 73 | void ResetSLState(void); 74 | bool SLInitialised(void); 75 | void SetSLInitialised(void); 76 | 77 | bool m_bSLEnabled; 78 | P8PLATFORM::CTimeout m_resetPowerState; 79 | P8PLATFORM::CMutex m_SLMutex; 80 | }; 81 | }; 82 | -------------------------------------------------------------------------------- /src/libcec/implementations/VLCommandHandler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "CECCommandHandler.h" 37 | 38 | namespace CEC 39 | { 40 | class CVLCommandHandler : public CCECCommandHandler 41 | { 42 | public: 43 | CVLCommandHandler(CCECBusDevice *busDevice, 44 | int32_t iTransmitTimeout = CEC_DEFAULT_TRANSMIT_TIMEOUT, 45 | int32_t iTransmitWait = CEC_DEFAULT_TRANSMIT_WAIT, 46 | int8_t iTransmitRetries = CEC_DEFAULT_TRANSMIT_RETRIES, 47 | int64_t iActiveSourcePending = 0); 48 | virtual ~CVLCommandHandler(void) {}; 49 | 50 | bool InitHandler(void); 51 | 52 | int HandleDeviceVendorCommandWithId(const cec_command &command); 53 | int HandleStandby(const cec_command &command); 54 | int HandleSystemAudioModeRequest(const cec_command &command); 55 | 56 | int HandleVendorCommand(const cec_command &command); 57 | bool PowerUpEventReceived(void); 58 | bool SupportsDeviceType(const cec_device_type type) const { return type != CEC_DEVICE_TYPE_RECORDING_DEVICE; }; 59 | cec_device_type GetReplacementDeviceType(const cec_device_type type) const { return type == CEC_DEVICE_TYPE_RECORDING_DEVICE ? CEC_DEVICE_TYPE_PLAYBACK_DEVICE : type; } 60 | 61 | bool SourceSwitchAllowed(void); 62 | 63 | protected: 64 | void VendorPreActivateSourceHook(void); 65 | void SendVendorCommandCapabilities(const cec_logical_address initiator, const cec_logical_address destination); 66 | int HandleReportPowerStatus(const cec_command &command); 67 | 68 | P8PLATFORM::CMutex m_mutex; 69 | uint64_t m_iPowerUpEventReceived; 70 | bool m_bCapabilitiesSent; 71 | }; 72 | }; 73 | -------------------------------------------------------------------------------- /src/libcec/libcec.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libcec 7 | Description: Pulse-Eight libCEC @LIBCEC_VERSION_MAJOR@.@LIBCEC_VERSION_MINOR@.@LIBCEC_VERSION_PATCH@ 8 | URL: http://www.pulse-eight.com/ 9 | Version: @LIBCEC_VERSION_MAJOR@.@LIBCEC_VERSION_MINOR@.@LIBCEC_VERSION_PATCH@ 10 | Requires: @LIBCEC_LIBREQUIRES@ 11 | Libs: -L${libdir} -lcec 12 | Cflags: -I${includedir} -I${includedir}/libcec 13 | -------------------------------------------------------------------------------- /src/libcec/libcec.rc.in: -------------------------------------------------------------------------------- 1 | #include "winres.h" 2 | 3 | VS_VERSION_INFO VERSIONINFO 4 | FILEVERSION @LIBCEC_VERSION_MAJOR@,@LIBCEC_VERSION_MINOR@,@LIBCEC_VERSION_PATCH@,0 5 | PRODUCTVERSION @LIBCEC_VERSION_MAJOR@,@LIBCEC_VERSION_MINOR@,@LIBCEC_VERSION_PATCH@,0 6 | FILEFLAGSMASK 0x3fL 7 | #ifdef _DEBUG 8 | FILEFLAGS 0x1L 9 | #else 10 | FILEFLAGS 0x0L 11 | #endif 12 | FILEOS 0x40004L 13 | FILETYPE 0x2L 14 | FILESUBTYPE 0x0L 15 | BEGIN 16 | BLOCK "StringFileInfo" 17 | BEGIN 18 | BLOCK "000004b0" 19 | BEGIN 20 | VALUE "CompanyName", "Pulse-Eight Limited" 21 | VALUE "FileDescription", "Pulse-Eight USB-CEC adapter interface" 22 | VALUE "FileVersion", "@cec_VERSION_MAJOR@.@LIBCEC_VERSION_MINOR@.@LIBCEC_VERSION_PATCH@.0" 23 | VALUE "InternalName", "libcec.dll" 24 | VALUE "LegalCopyright", "Copyright (c) Pulse-Eight Limited 2011-2015" 25 | VALUE "OriginalFilename", "cec.dll" 26 | VALUE "ProductName", "libCEC" 27 | VALUE "ProductVersion", "@LIBCEC_VERSION_MAJOR@.@LIBCEC_VERSION_MINOR@.@LIBCEC_VERSION_PATCH@.0" 28 | END 29 | END 30 | BLOCK "VarFileInfo" 31 | BEGIN 32 | VALUE "Translation", 0x0, 1200 33 | END 34 | END 35 | -------------------------------------------------------------------------------- /src/libcec/platform/X11/randr-edid.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "platform/util/edid.h" 37 | 38 | namespace P8PLATFORM 39 | { 40 | class CRandrEdidParser 41 | { 42 | public: 43 | CRandrEdidParser(void) {}; 44 | virtual ~CRandrEdidParser(void) {}; 45 | 46 | uint16_t GetPhysicalAddress(void); 47 | }; 48 | } 49 | -------------------------------------------------------------------------------- /src/libcec/platform/adl/adl-edid.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #define HAVE_ADL_EDID_PARSER 37 | 38 | #include "platform/util/edid.h" 39 | 40 | #if !defined(__WINDOWS__) 41 | #include "adl_sdk.h" 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | typedef void* ADL_LIB_HANDLE; 48 | 49 | #else 50 | #include 51 | #include 52 | #include "adl_sdk.h" 53 | 54 | typedef HINSTANCE ADL_LIB_HANDLE; 55 | #endif 56 | 57 | typedef int (*ADL_MAIN_CONTROL_CREATE ) (ADL_MAIN_MALLOC_CALLBACK, int); 58 | typedef int (*ADL_MAIN_CONTROL_DESTROY) (void); 59 | typedef int (*ADL_ADAPTER_NUMBEROFADAPTERS_GET) (int*); 60 | typedef int (*ADL_ADAPTER_ADAPTERINFO_GET) (LPAdapterInfo, int); 61 | typedef int (*ADL_DISPLAY_DISPLAYINFO_GET) (int, int *, ADLDisplayInfo **, int); 62 | typedef int (*ADL_DISPLAY_EDIDDATA_GET) (int, int, ADLDisplayEDIDData *); 63 | 64 | #define ADL_DISPLAY_CONNECTED (ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED | ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED) 65 | 66 | namespace P8PLATFORM 67 | { 68 | class CADLEdidParser 69 | { 70 | public: 71 | CADLEdidParser(void); 72 | virtual ~CADLEdidParser(void); 73 | 74 | uint16_t GetPhysicalAddress(void); 75 | int GetNumAdapters(void); 76 | 77 | private: 78 | bool LibOpen(void) { return m_bOpen; } 79 | void Initialise(void); 80 | bool OpenLibrary(void); 81 | void CloseLibrary(void); 82 | 83 | LPAdapterInfo GetAdapterInfo(int iNumAdapters); 84 | bool GetAdapterEDID(int iAdapterIndex, int iDisplayIndex, ADLDisplayEDIDData *data); 85 | 86 | bool m_bOpen; 87 | ADL_LIB_HANDLE m_handle; 88 | 89 | ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create; 90 | ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy; 91 | ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get; 92 | ADL_ADAPTER_ADAPTERINFO_GET ADL_Adapter_AdapterInfo_Get; 93 | ADL_DISPLAY_DISPLAYINFO_GET ADL_Display_DisplayInfo_Get; 94 | ADL_DISPLAY_EDIDDATA_GET ADL_Display_EdidData_Get; 95 | }; 96 | } 97 | -------------------------------------------------------------------------------- /src/libcec/platform/adl/adl_sdk.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// Copyright (c) 2008 - 2009 Advanced Micro Devices, Inc. 3 | 4 | /// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 5 | /// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 6 | /// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | 8 | /// \file adl_sdk.h 9 | /// \brief Contains the definition of the Memory Allocation Callback.\n Included in ADL SDK 10 | /// 11 | /// \n\n 12 | /// This file contains the definition of the Memory Allocation Callback.\n 13 | /// It also includes definitions of the respective structures and constants.\n 14 | /// This is the only header file to be included in a C/C++ project using ADL 15 | 16 | #ifndef ADL_SDK_H_ 17 | #define ADL_SDK_H_ 18 | 19 | #include "adl_structures.h" 20 | 21 | #if !defined(__WINDOWS__) 22 | #define __stdcall 23 | #endif /* (LINUX) */ 24 | 25 | /// Memory Allocation Call back 26 | typedef void* ( __stdcall *ADL_MAIN_MALLOC_CALLBACK )( int ); 27 | 28 | 29 | #endif /* ADL_SDK_H_ */ 30 | -------------------------------------------------------------------------------- /src/libcec/platform/drm/drm-edid.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 | * 23 | * 24 | * Alternatively, you can license this library under a commercial license, 25 | * please contact Pulse-Eight Licensing for more information. 26 | * 27 | * For more information contact: 28 | * Pulse-Eight Licensing 29 | * http://www.pulse-eight.com/ 30 | * http://www.pulse-eight.net/ 31 | */ 32 | 33 | #include "env.h" 34 | #ifdef HAVE_DRM_EDID_PARSER 35 | 36 | #include "p8-platform/os.h" 37 | #include "drm-edid.h" 38 | #include 39 | #include 40 | 41 | using namespace P8PLATFORM; 42 | 43 | uint16_t CDRMEdidParser::GetPhysicalAddress(void) 44 | { 45 | uint16_t iPA(0); 46 | 47 | // Fisrt we look for all DRM subfolder 48 | std::string baseDir = "/sys/class/drm/"; 49 | 50 | DIR *dir = opendir(baseDir.c_str()); 51 | 52 | // DRM subfolder may not exist on some systems 53 | if (dir == NULL) 54 | { 55 | return iPA; 56 | } 57 | 58 | struct dirent *entry = readdir(dir); 59 | std::string enablededid; 60 | std::string line; 61 | 62 | while (entry != NULL && enablededid.empty()) 63 | { 64 | // We look if the element is a symlinl 65 | if (entry->d_type == DT_LNK) 66 | { 67 | // We look for the file enable to find the active video card 68 | std::string path, enabledPath, edidPath; 69 | path = baseDir + entry->d_name; 70 | enabledPath = path + "/enabled"; 71 | edidPath = path + "/edid"; 72 | 73 | std::ifstream f(enabledPath.c_str()); 74 | if (f.is_open()) 75 | { 76 | if (f.good() && !f.eof()) 77 | { 78 | getline(f, line); 79 | 80 | // We look if the card is "Enabled" 81 | if (line == "enabled") 82 | { 83 | // We look if the directory have an edid file 84 | std::ifstream edid(edidPath.c_str()); 85 | if (edid.is_open()) 86 | { 87 | if (edid.good()) { 88 | enablededid = edidPath; 89 | } 90 | edid.close(); 91 | } 92 | } 93 | } 94 | f.close(); 95 | } 96 | } 97 | entry = readdir(dir); 98 | } 99 | 100 | closedir(dir); 101 | 102 | if (!enablededid.empty()) 103 | { 104 | FILE *fp = fopen(enablededid.c_str(), "r"); 105 | 106 | if (fp) 107 | { 108 | char* buf = (char*)calloc(4096, sizeof(char)); 109 | int iPtr(0); 110 | int c(0); 111 | if (buf) 112 | { 113 | while (c != EOF) 114 | { 115 | c = fgetc(fp); 116 | if (c != EOF) 117 | buf[iPtr++] = c; 118 | } 119 | 120 | iPA = CEDIDParser::GetPhysicalAddressFromEDID(buf, iPtr); 121 | free(buf); 122 | } 123 | 124 | fclose(fp); 125 | } 126 | } 127 | 128 | return iPA; 129 | } 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /src/libcec/platform/drm/drm-edid.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | #ifdef HAVE_DRM_EDID_PARSER 34 | 35 | #include "platform/util/edid.h" 36 | 37 | namespace P8PLATFORM 38 | { 39 | class CDRMEdidParser 40 | { 41 | public: 42 | CDRMEdidParser(void) {}; 43 | virtual ~CDRMEdidParser(void) {}; 44 | 45 | uint16_t GetPhysicalAddress(void); 46 | }; 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/libcec/platform/nvidia/nv-edid.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | #include "nv-edid.h" 36 | 37 | #if defined(HAVE_NVIDIA_EDID_PARSER) 38 | 39 | #include "p8-platform/os.h" 40 | #include 41 | 42 | using namespace P8PLATFORM; 43 | 44 | uint16_t CNVEdidParser::GetPhysicalAddress(void) 45 | { 46 | uint16_t iPA(0); 47 | 48 | #if !defined(__WINDOWS__) 49 | FILE *fp = fopen("/proc/acpi/video/NGFX/HDMI/EDID", "r"); 50 | 51 | if (fp) 52 | { 53 | char buf[4096]; 54 | memset(buf, 0, sizeof(buf)); 55 | int iPtr(0); 56 | int c(0); 57 | while (c != EOF) 58 | { 59 | c = fgetc(fp); 60 | if (c != EOF) 61 | buf[iPtr++] = c; 62 | } 63 | 64 | iPA = CEDIDParser::GetPhysicalAddressFromEDID(buf, iPtr); 65 | fclose(fp); 66 | } 67 | #endif 68 | 69 | return iPA; 70 | } 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/libcec/platform/nvidia/nv-edid.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #define HAVE_NVIDIA_EDID_PARSER 37 | 38 | #include "platform/util/edid.h" 39 | 40 | namespace P8PLATFORM 41 | { 42 | class CNVEdidParser 43 | { 44 | public: 45 | CNVEdidParser(void) {}; 46 | virtual ~CNVEdidParser(void) {}; 47 | 48 | uint16_t GetPhysicalAddress(void); 49 | 50 | }; 51 | } 52 | -------------------------------------------------------------------------------- /src/libcec/platform/posix/os-edid.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | #include "platform/util/edid.h" 36 | #include "platform/X11/randr-edid.h" 37 | 38 | using namespace P8PLATFORM; 39 | 40 | uint16_t CEDIDParser::GetPhysicalAddress(void) 41 | { 42 | #if HAVE_RANDR 43 | return CRandrEdidParser().GetPhysicalAddress(); 44 | #else 45 | // TODO 46 | return 0; 47 | #endif 48 | } 49 | -------------------------------------------------------------------------------- /src/libcec/platform/sockets/serialport.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | #include "p8-platform/util/buffer.h" 37 | 38 | #include 39 | #include 40 | 41 | #if !defined(__WINDOWS__) 42 | #include 43 | #endif 44 | 45 | #include "p8-platform/sockets/socket.h" 46 | 47 | namespace P8PLATFORM 48 | { 49 | enum SerialParity 50 | { 51 | SERIAL_PARITY_NONE = 0, 52 | SERIAL_PARITY_EVEN, 53 | SERIAL_PARITY_ODD 54 | }; 55 | 56 | enum SerialStopBits 57 | { 58 | SERIAL_STOP_BITS_ONE = 1, 59 | SERIAL_STOP_BITS_TWO = 2 60 | }; 61 | 62 | enum SerialDataBits 63 | { 64 | SERIAL_DATA_BITS_FIVE = 5, 65 | SERIAL_DATA_BITS_SIX = 6, 66 | SERIAL_DATA_BITS_SEVEN = 7, 67 | SERIAL_DATA_BITS_EIGHT = 8 68 | }; 69 | 70 | class CSerialSocket : public CCommonSocket 71 | { 72 | public: 73 | CSerialSocket(const std::string &strName, uint32_t iBaudrate, SerialDataBits iDatabits = SERIAL_DATA_BITS_EIGHT, SerialStopBits iStopbits = SERIAL_STOP_BITS_ONE, SerialParity iParity = SERIAL_PARITY_NONE) : 74 | CCommonSocket(INVALID_SERIAL_SOCKET_VALUE, strName), 75 | #ifdef __WINDOWS__ 76 | m_iCurrentReadTimeout(MAXDWORD), 77 | #endif 78 | m_bIsOpen(false), 79 | m_iBaudrate(iBaudrate), 80 | m_iDatabits(iDatabits), 81 | m_iStopbits(iStopbits), 82 | m_iParity(iParity) {} 83 | 84 | virtual ~CSerialSocket(void) { Close(); } 85 | 86 | virtual bool Open(uint64_t iTimeoutMs = 0); 87 | virtual void Close(void); 88 | virtual void Shutdown(void); 89 | virtual ssize_t Write(void* data, size_t len); 90 | virtual ssize_t Read(void* data, size_t len, uint64_t iTimeoutMs = 0); 91 | 92 | virtual bool IsOpen(void) 93 | { 94 | return m_socket != INVALID_SERIAL_SOCKET_VALUE && 95 | m_bIsOpen; 96 | } 97 | 98 | virtual bool SetBaudRate(uint32_t baudrate); 99 | 100 | protected: 101 | #ifndef __WINDOWS__ 102 | struct termios m_options; 103 | #else 104 | bool SetTimeouts(serial_socket_t socket, int* iError, DWORD iTimeoutMs); 105 | DWORD m_iCurrentReadTimeout; 106 | #endif 107 | 108 | bool m_bIsOpen; 109 | uint32_t m_iBaudrate; 110 | SerialDataBits m_iDatabits; 111 | SerialStopBits m_iStopbits; 112 | SerialParity m_iParity; 113 | }; 114 | 115 | class CSerialPort : public CProtectedSocket 116 | { 117 | public: 118 | CSerialPort(const std::string &strName, uint32_t iBaudrate, SerialDataBits iDatabits = SERIAL_DATA_BITS_EIGHT, SerialStopBits iStopbits = SERIAL_STOP_BITS_ONE, SerialParity iParity = SERIAL_PARITY_NONE) : 119 | CProtectedSocket (new CSerialSocket(strName, iBaudrate, iDatabits, iStopbits, iParity)) {} 120 | virtual ~CSerialPort(void) {} 121 | }; 122 | }; 123 | -------------------------------------------------------------------------------- /src/libcec/platform/util/edid.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * This file is part of the libCEC(R) library. 4 | * 5 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 6 | * libCEC(R) is an original work, containing original code. 7 | * 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. 9 | * 10 | * This program is dual-licensed; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | * 02110-1301 USA 24 | * 25 | * 26 | * Alternatively, you can license this library under a commercial license, 27 | * please contact Pulse-Eight Licensing for more information. 28 | * 29 | * For more information contact: 30 | * Pulse-Eight Licensing 31 | * http://www.pulse-eight.com/ 32 | * http://www.pulse-eight.net/ 33 | */ 34 | 35 | #include "env.h" 36 | 37 | namespace P8PLATFORM 38 | { 39 | class CEDIDParser 40 | { 41 | public: 42 | static uint16_t GetPhysicalAddress(void); 43 | 44 | static uint16_t GetPhysicalAddressFromEDID(unsigned char *data, size_t size) 45 | { 46 | return GetPhysicalAddressFromEDID((char *)data, size); 47 | } 48 | 49 | static uint16_t GetPhysicalAddressFromEDID(char *data, size_t size) 50 | { 51 | uint16_t iPA(0); 52 | 53 | for (size_t iPtr = 0; data && size > 0 && iPtr < size - 4; iPtr++) 54 | { 55 | if (data[iPtr] == 0x03 && 56 | data[iPtr + 1] == 0x0C && 57 | data[iPtr + 2] == 0x0) 58 | { 59 | //found the hdmi marker 60 | iPA = (data[iPtr + 3] << 8) + data[iPtr + 4]; 61 | break; 62 | } 63 | } 64 | 65 | return iPA; 66 | } 67 | }; 68 | } 69 | -------------------------------------------------------------------------------- /src/libcec/platform/windows/os-edid.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the libCEC(R) library. 3 | * 4 | * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. 5 | * libCEC(R) is an original work, containing original code. 6 | * 7 | * libCEC(R) is a trademark of Pulse-Eight Limited. 8 | * 9 | * This program is dual-licensed; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | * 02110-1301 USA 23 | * 24 | * 25 | * Alternatively, you can license this library under a commercial license, 26 | * please contact Pulse-Eight Licensing for more information. 27 | * 28 | * For more information contact: 29 | * Pulse-Eight Licensing 30 | * http://www.pulse-eight.com/ 31 | * http://www.pulse-eight.net/ 32 | */ 33 | 34 | #include "env.h" 35 | #include "platform/util/edid.h" 36 | 37 | #include "windows.h" 38 | #include "setupapi.h" 39 | #include "initguid.h" 40 | #include "stdio.h" 41 | 42 | using namespace P8PLATFORM; 43 | 44 | static GUID MONITOR_GUID = { 0x4D36E96E, 0xE325, 0x11CE, { 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 } }; 45 | #define PA_MAX_REGENTRIES_TO_CHECK 1024 46 | 47 | uint16_t GetPhysicalAddressFromDevice(IN HDEVINFO hDevHandle, IN PSP_DEVINFO_DATA deviceInfoData) 48 | { 49 | uint16_t iPA(0); 50 | 51 | HKEY hDevRegKey = SetupDiOpenDevRegKey(hDevHandle, deviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_ALL_ACCESS); 52 | if (hDevRegKey) 53 | { 54 | CHAR regEntryName[128]; 55 | DWORD regEntryNameLength(128); 56 | DWORD type; 57 | LONG retVal(ERROR_SUCCESS); 58 | 59 | for (LONG ptr = 0; iPA == 0 && retVal == ERROR_SUCCESS && ptr < PA_MAX_REGENTRIES_TO_CHECK; ptr++) 60 | { 61 | BYTE regEntryData[1024]; 62 | DWORD regEntryDataSize = sizeof(regEntryData); 63 | 64 | retVal = RegEnumValue(hDevRegKey, ptr, ®EntryName[0], ®EntryNameLength, NULL, &type, regEntryData, ®EntryDataSize); 65 | 66 | if (retVal == ERROR_SUCCESS && !strcmp(regEntryName,"EDID")) 67 | iPA = CEDIDParser::GetPhysicalAddressFromEDID(regEntryData, regEntryDataSize); 68 | } 69 | RegCloseKey(hDevRegKey); 70 | } 71 | 72 | return iPA; 73 | } 74 | 75 | uint16_t CEDIDParser::GetPhysicalAddress(void) 76 | { 77 | HDEVINFO hDevHandle; 78 | uint16_t iPA(0); 79 | SP_DEVINFO_DATA deviceInfoData; 80 | 81 | hDevHandle = SetupDiGetClassDevsEx(&MONITOR_GUID, NULL, NULL, DIGCF_PRESENT, NULL, NULL, NULL); 82 | if (!hDevHandle) 83 | return iPA; 84 | 85 | for (int i=0; ERROR_NO_MORE_ITEMS != GetLastError(); i++) 86 | { 87 | memset(&deviceInfoData, 0, sizeof(SP_DEVINFO_DATA)); 88 | deviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); 89 | 90 | if (SetupDiEnumDeviceInfo(hDevHandle,i, &deviceInfoData)) 91 | { 92 | iPA = GetPhysicalAddressFromDevice(hDevHandle, &deviceInfoData); 93 | } 94 | } 95 | SetupDiDestroyDeviceInfoList(hDevHandle); 96 | 97 | return iPA; 98 | } 99 | -------------------------------------------------------------------------------- /src/pyCecClient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12.0) 2 | project(pyCecClient) 3 | 4 | # Python 5 | if(WIN32 AND "${MSVC_C_ARCHITECTURE_ID}" STREQUAL "X86") 6 | set(PYTHON_USE_VERSION 2) 7 | endif() 8 | 9 | if(PYTHON_USE_VERSION EQUAL 2) 10 | include(FindPython2) 11 | find_package(Python2) 12 | set(PYTHONLIBS_FOUND "${Python2_FOUND}") 13 | else() 14 | include(FindPython3) 15 | find_package(Python3) 16 | set(PYTHONLIBS_FOUND "${Python3_FOUND}") 17 | endif() 18 | 19 | if(PYTHONLIBS_FOUND) 20 | if (WIN32) 21 | install(PROGRAMS pyCecClient.py 22 | DESTINATION python) 23 | else() 24 | install(PROGRAMS pyCecClient.py 25 | DESTINATION bin 26 | RENAME pyCecClient) 27 | endif() 28 | endif() 29 | -------------------------------------------------------------------------------- /systemd/cec-active-source.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Set this device to the CEC Active Source 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStartPre=/bin/echo 'on 0' | /usr/bin/cec-client -s 7 | ExecStart=/bin/echo 'as' | /usr/bin/cec-client -s 8 | 9 | -------------------------------------------------------------------------------- /systemd/cec-active-source.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Trigger cec-active-source at boot 3 | 4 | [Timer] 5 | OnBootSec=1 6 | OnStartupSec=1 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /systemd/cec-poweroff-tv.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Use CEC to power off TV 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=/bin/echo 'standby 0' | /usr/bin/cec-client -s 7 | ExecStop=/bin/echo 'standby 0' | /usr/bin/cec-client -s 8 | 9 | [Install] 10 | WantedBy=poweroff.target 11 | -------------------------------------------------------------------------------- /windows/build-lib.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | rem Build libCEC cmake projects for Windows 4 | rem Usage: build-all.cmd [architecture] [type] [vs version] [install path] [project type] 5 | 6 | SETLOCAL 7 | 8 | SET MYDIR=%~dp0 9 | SET BUILDARCH=%1 10 | SET BUILDTYPE=%2 11 | SET VSVERSION=%3 12 | SET INSTALLPATH=%~4 13 | SET GENTYPE=%5 14 | IF [%5] == [] GOTO missingparams 15 | 16 | SET INSTALLPATH=%INSTALLPATH:"=% 17 | SET BUILDTARGET=%INSTALLPATH%\cmake\%BUILDARCH% 18 | SET TARGET=%INSTALLPATH%\%BUILDARCH% 19 | 20 | rem Check support submodule 21 | IF NOT EXIST "%MYDIR%..\support\windows\cmake\build.cmd" ( 22 | rem Try to init the git submodules 23 | cd "%MYDIR%.." 24 | git submodule update --init -r >nul 2>&1 25 | 26 | IF NOT EXIST "%MYDIR%..\support\windows\cmake\build.cmd" ( 27 | ECHO.*** support git submodule has not been checked out *** 28 | ECHO. 29 | ECHO.See docs\README.windows.md 30 | EXIT /b 2 31 | ) 32 | ) 33 | 34 | rem Check platform submodule 35 | IF NOT EXIST "%MYDIR%..\src\platform\windows\build.cmd" ( 36 | ECHO.*** platform git submodule has not been checked out *** 37 | ECHO. 38 | ECHO.See docs\README.windows.md 39 | EXIT /b 2 40 | ) 41 | 42 | rem Compile platform library 43 | ECHO. * compiling platform library for %BUILDARCH% 44 | CALL "%MYDIR%..\src\platform\windows\build-lib.cmd" %BUILDARCH% %BUILDTYPE% %VSVERSION% "%INSTALLPATH%" 45 | IF %errorlevel% neq 0 EXIT /b %errorlevel% 46 | RMDIR /s /q "%BUILDTARGET%" >nul 2>&1 47 | 48 | rem Compile libCEC 49 | ECHO. * compiling libCEC for %BUILDARCH% 50 | CALL "%MYDIR%..\support\windows\cmake\generate.cmd" %BUILDARCH% %GENTYPE% "%MYDIR%.." "%BUILDTARGET%" "%TARGET%" %BUILDTYPE% %VSVERSION% 51 | IF %errorlevel% neq 0 EXIT /b %errorlevel% 52 | 53 | IF "%GENTYPE%" == "nmake" ( 54 | CALL "%MYDIR%..\support\windows\cmake\build.cmd" %BUILDARCH% "%BUILDTARGET%" %VSVERSION% 55 | IF NOT EXIST "%TARGET%\cec.dll" ( 56 | ECHO. *** failed to build %TARGET%\cec.dll for %BUILDARCH% *** 57 | EXIT /b 1 58 | ) 59 | ECHO. * libCEC for %BUILDARCH% built successfully 60 | ) 61 | 62 | EXIT /b 0 63 | 64 | :missingparams 65 | ECHO.%~dp0 requires 5 parameters 66 | ECHO. %~dp0 [architecture] [type] [vs version] [install path] [project type] 67 | ECHO. 68 | ECHO. architecture: x64 x86 arm64 69 | ECHO. build type: Release Debug 70 | ECHO. vs version: Visual Studio version (2022) 71 | ECHO. install path: installation path without quotes 72 | ECHO. project type: nmake vs 73 | EXIT /b 99 74 | -------------------------------------------------------------------------------- /windows/eventghost.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | SETLOCAL 4 | 5 | SET MYDIR=%~dp0 6 | SET EXITCODE=0 7 | 8 | ECHO. * creating EventGhost plugin 9 | SET EGSOURCES=%MYDIR%..\build\EventGhost\egplugin_sources 10 | RMDIR /s /q "%MYDIR%..\build\EventGhost" >nul 2>&1 11 | MKDIR "%MYDIR%..\build\EventGhost" 12 | 13 | XCOPY /E /I "%MYDIR%..\src\eventghost\egplugin_sources" "%EGSOURCES%" >nul 14 | 15 | MKDIR "%EGSOURCES%\PulseEight\cec" 16 | COPY "%MYDIR%..\build\Release\x86\python\cec\cec.py" "%EGSOURCES%\PulseEight\cec" >nul 17 | COPY "%MYDIR%..\build\Release\x86\python\cec\_pycec.pyd" "%EGSOURCES%\PulseEight\cec" >nul 18 | COPY "%MYDIR%..\build\Release\x86\cec.dll" "%EGSOURCES%\PulseEight\cec" >nul 19 | COPY "%MYDIR%..\build\Release\x86\python\cec\__init__.py" "%EGSOURCES%\PulseEight\cec" >nul 20 | 21 | PowerShell -ExecutionPolicy ByPass -Command "Add-Type -Assembly System.IO.Compression.FileSystem;[System.IO.Compression.ZipFile]::CreateFromDirectory('%EGSOURCES%\', '%EGSOURCES%\..\pulse_eight.egplugin', [System.IO.Compression.CompressionLevel]::Optimal, $false)" 22 | 23 | IF NOT EXIST "%EGSOURCES%\..\pulse_eight.egplugin" ( 24 | ECHO. *** failed to create EventGhost plugin *** 25 | SET EXITCODE=1 26 | GOTO EXIT 27 | ) 28 | 29 | exit /b %EXITCODE% 30 | -------------------------------------------------------------------------------- /windows/nsis-helper.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | rem NSIS helper script. Used by create-installer.cmd 4 | 5 | SETLOCAL 6 | 7 | SET MYDIR=%~dp0 8 | 9 | IF [%2] == [] ( 10 | ECHO.This script should not be called manually. 11 | PAUSE 12 | EXIT /b 99 13 | ) 14 | 15 | rem Check for NSIS 16 | IF EXIST "%ProgramFiles%\NSIS\makensis.exe" ( 17 | SET NSIS="%ProgramFiles%\NSIS\makensis.exe" 18 | ) ELSE IF EXIST "%ProgramFiles(x86)%\NSIS\makensis.exe" ( 19 | SET NSIS="%ProgramFiles(x86)%\NSIS\makensis.exe" 20 | ) ELSE ( 21 | ECHO.*** NSIS could not be found *** 22 | ECHO. 23 | ECHO.See docs\README.windows.md 24 | EXIT /b 2 25 | ) 26 | 27 | SET NSISPROJECT="%1" 28 | SET RESULTMATCH=%2 29 | SET RESULTMATCH=%RESULTMATCH:"=% 30 | IF [%3] == [] ( 31 | SET NSISOPTS="" 32 | ) ELSE ( 33 | SET NSISOPTS=%3 34 | ) 35 | SET NSISOPTS=%NSISOPTS:"=% 36 | 37 | ECHO. * creating installer "%1" 38 | CD "%MYDIR%..\project" 39 | DEL /F /Q "%MYDIR%..\build\%RESULTMATCH%" >nul 2>&1 40 | %NSIS% /V1 %NSISOPTS% %NSISPROJECT% 41 | 42 | FOR /F "delims=" %%F IN ('dir /b /s "%MYDIR%..\build\%RESULTMATCH%" 2^>nul') DO SET INSTALLER=%%F 43 | IF [%INSTALLER%] == [] ( 44 | ECHO. *** the installer could not be created *** 45 | ECHO. 46 | ECHO. The most likely cause is that something went wrong while compiling. 47 | EXIT /B 3 48 | ) 49 | 50 | rem Sign the installer if sign-binary.cmd exists 51 | IF EXIST "..\support\private\sign-binary.cmd" ( 52 | ECHO. * signing installer binary 53 | CALL ..\support\private\sign-binary.cmd "%INSTALLER%" >nul 54 | ) 55 | 56 | ECHO.installer built: %INSTALLER% 57 | -------------------------------------------------------------------------------- /windows/visual-studio.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | rem Generate Visual Studio projects for libCEC 4 | rem Usage: build-all.cmd [visual studio version] 5 | 6 | SETLOCAL 7 | 8 | rem optional parameter: visual studio version (2022) 9 | IF "%1" == "" ( 10 | SET VSVERSION=2022 11 | ) ELSE ( 12 | SET VSVERSION=%1 13 | ) 14 | 15 | SET MYDIR=%~dp0 16 | SET BUILDTYPE=Debug 17 | SET INSTALLPATH=%MYDIR%..\build 18 | 19 | rem delete old build folder 20 | RMDIR /s /q "%MYDIR%..\build" >nul 2>&1 21 | 22 | rem build/generate vs project files 23 | FOR %%T IN (x64 x86 arm64) DO ( 24 | CALL "%MYDIR%build-lib.cmd" %%T %BUILDTYPE% %VSVERSION% "%INSTALLPATH%" vs 25 | IF %errorlevel% neq 0 EXIT /b %errorlevel% 26 | ) 27 | 28 | ECHO Visual Studio solutions can be found in: 29 | ECHO 32 bits: "%MYDIR%..\build\cmake\x86\libcec.sln" 30 | ECHO 64 bits: "%MYDIR%..\build\cmake\x64\libcec.sln" 31 | ECHO arm64: "%MYDIR%..\build\cmake\arm64\libcec.sln" 32 | ECHO. 33 | ECHO These projects only compile in %BUILDTYPE% mode and have been generated for Visual Studio %VSVERSION%. 34 | --------------------------------------------------------------------------------