Skip to content

Commit

Permalink
[cec] get the CEC devices that are connected to the system from libCE…
Browse files Browse the repository at this point in the history
…C, rather than getting them from usb device scanning (or other methods). this way all adapters that libCEC supports are automatically supported by XBMC, without the need for specific device scanning code. bumped libCEC to 2.1.0
  • Loading branch information
opdenkamp committed Feb 28, 2013
1 parent 8d2e0fe commit 59171c7
Show file tree
Hide file tree
Showing 15 changed files with 166 additions and 149 deletions.
14 changes: 14 additions & 0 deletions XBMC.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
18E7CACB1578C26D001D4554 /* CDDARipJob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18E7CAC91578C26D001D4554 /* CDDARipJob.cpp */; };
18ECC96213CF178D00A9ED6C /* StreamUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18ECC96013CF178D00A9ED6C /* StreamUtils.cpp */; };
1D638128161E211E003603ED /* PeripheralImon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1D638126161E211E003603ED /* PeripheralImon.cpp */; };
1DAFDB7C16DFDCA7007F8C68 /* PeripheralBusCEC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DAFDB7A16DFDCA7007F8C68 /* PeripheralBusCEC.cpp */; };
1DE0443515828F4B005DDB4D /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DE0443315828F4B005DDB4D /* Exception.cpp */; };
32C631281423A90F00F18420 /* JpegIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32C631261423A90F00F18420 /* JpegIO.cpp */; };
36A9443D15821E2800727135 /* DatabaseUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 36A9443B15821E2800727135 /* DatabaseUtils.cpp */; };
Expand Down Expand Up @@ -1384,6 +1385,8 @@
18ECC96113CF178D00A9ED6C /* StreamUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamUtils.h; sourceTree = "<group>"; };
1D638126161E211E003603ED /* PeripheralImon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PeripheralImon.cpp; sourceTree = "<group>"; };
1D638127161E211E003603ED /* PeripheralImon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeripheralImon.h; sourceTree = "<group>"; };
1DAFDB7A16DFDCA7007F8C68 /* PeripheralBusCEC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PeripheralBusCEC.cpp; sourceTree = "<group>"; };
1DAFDB7B16DFDCA7007F8C68 /* PeripheralBusCEC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeripheralBusCEC.h; sourceTree = "<group>"; };
1DE0443315828F4B005DDB4D /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Exception.cpp; path = commons/Exception.cpp; sourceTree = "<group>"; };
1DE0443415828F4B005DDB4D /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Exception.h; path = commons/Exception.h; sourceTree = "<group>"; };
32C631261423A90F00F18420 /* JpegIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JpegIO.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3743,6 +3746,15 @@
name = Products;
sourceTree = "<group>";
};
1DAFDB7916DFDCA7007F8C68 /* virtual */ = {
isa = PBXGroup;
children = (
1DAFDB7A16DFDCA7007F8C68 /* PeripheralBusCEC.cpp */,
1DAFDB7B16DFDCA7007F8C68 /* PeripheralBusCEC.h */,
);
path = virtual;
sourceTree = "<group>";
};
38F4E56013CCCB3B00664821 /* platform */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -6391,6 +6403,7 @@
F5E1050D140AA38000175026 /* bus */ = {
isa = PBXGroup;
children = (
1DAFDB7916DFDCA7007F8C68 /* virtual */,
F5E10512140AA38000175026 /* osx */,
F5E10515140AA38000175026 /* PeripheralBus.cpp */,
F5E10516140AA38000175026 /* PeripheralBus.h */,
Expand Down Expand Up @@ -7746,6 +7759,7 @@
DF404A3A16B9896C00D8023E /* imagefactory.cpp in Sources */,
DFD5812516C828500008EEA0 /* DAVCommon.cpp in Sources */,
DFD5812616C828500008EEA0 /* DAVFile.cpp in Sources */,
1DAFDB7C16DFDCA7007F8C68 /* PeripheralBusCEC.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
40 changes: 2 additions & 38 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ libusb_disabled="== libusb disabled. Plug and play USB device support will not b
libusb_disabled_udev_found="== libusb disabled. =="
libcec_enabled="== libcec enabled. =="
libcec_disabled="== libcec disabled. CEC adapter support will not be available. =="
libcec_disabled_missing_libs="== libcec disabled because it either needs libudev, or libusb a compatible version of the RPi API. CEC adapter support will not be available. =="
cec_rpi_api_missing="== no compatible RPi API found =="

# External library message strings
external_libraries_enabled="== Use of all supported external libraries enabled. =="
Expand Down Expand Up @@ -1497,46 +1495,18 @@ fi

# libcec
USE_LIBCEC=0
USE_CEC_RPI_API=0
use_rpi_cec_api="auto"
if test "x$use_libcec" != "xno"; then
case "${host_cpu}" in
arm*)
echo "will check for RPi support"
AC_CHECK_HEADER(interface/vmcs_host/vc_cec.h,,use_rpi_cec_api="no")
;;
*)
echo "will not check for RPi support (unsupported cpu: ${host_cpu})"
use_rpi_cec_api="no"
;;
esac

# libcec needs libudev, libusb or the RPi API under linux, or the device will never be detected.
if test "$host_vendor" != "apple" && test "$use_libusb" = "no" && test "$use_libudev" = "no" && test "$use_rpi_cec_api" = "no"; then
if test "x$use_libcec" != "xauto"; then
AC_MSG_ERROR($libcec_disabled_missing_libs)
else
use_libcec="no"
AC_MSG_NOTICE($libcec_disabled_missing_libs)
fi
fi

# libcec is dyloaded, so we need to check for its headers and link any depends.
if test "x$use_libcec" != "xno"; then
if test "x$use_libcec" != "xauto"; then
PKG_CHECK_MODULES([CEC],[libcec >= 2.0.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)])
PKG_CHECK_MODULES([CEC],[libcec >= 2.1.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)])
else
PKG_CHECK_MODULES([CEC],[libcec >= 2.0.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)])
PKG_CHECK_MODULES([CEC],[libcec >= 2.1.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)])
fi

if test "x$use_libcec" != "xno"; then
INCLUDES="$INCLUDES $CEC_CFLAGS"
USE_LIBCEC=1;AC_DEFINE([HAVE_LIBCEC],[1],["Define to 1 if libcec is installed"])
if test "x$use_rpi_cec_api" != "xno"; then
LIBS+=" -lvcos -lvchiq_arm"
AC_DEFINE([HAVE_CEC_RPI_API],[1],["Define to 1 if the CEC RPi API is installed"])
USE_CEC_RPI_API=1
fi
XB_FIND_SONAME([LIBCEC],[cec],[use_libcec])
AC_MSG_NOTICE($libcec_enabled)
else
Expand Down Expand Up @@ -2289,11 +2259,6 @@ fi

if test "x$use_libcec" != "xno"; then
final_message="$final_message\n libcec support:\tYes"
if test "x$use_rpi_cec_api" != "xno"; then
final_message="$final_message\n libcec RPi support:\tYes"
else
final_message="$final_message\n libcec RPi support:\tNo"
fi
else
final_message="$final_message\n libcec support:\tNo"
fi
Expand Down Expand Up @@ -2487,7 +2452,6 @@ AC_SUBST(USE_AIRTUNES)
AC_SUBST(USE_LIBUDEV)
AC_SUBST(USE_LIBUSB)
AC_SUBST(USE_LIBCEC)
AC_SUBST(USE_CEC_RPI_API)
AC_SUBST(USE_MYSQL)
AC_SUBST(USE_WEB_SERVER)
AC_SUBST(USE_UPNP)
Expand Down
2 changes: 1 addition & 1 deletion project/BuildDependencies/scripts/libcec_d.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
; filename source of the file

libcec-2.0.5.zip http://mirrors.xbmc.org/build-deps/win32/
libcec-2.1.0.zip http://mirrors.xbmc.org/build-deps/win32/
2 changes: 2 additions & 0 deletions project/VS2010Express/XBMC.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@
<ClCompile Include="..\..\xbmc\PartyModeManager.cpp" />
<ClCompile Include="..\..\xbmc\PasswordManager.cpp" />
<ClCompile Include="..\..\xbmc\peripherals\bus\PeripheralBus.cpp" />
<ClCompile Include="..\..\xbmc\peripherals\bus\virtual\PeripheralBusCEC.cpp" />
<ClCompile Include="..\..\xbmc\peripherals\bus\win32\PeripheralBusUSB.cpp" />
<ClCompile Include="..\..\xbmc\peripherals\devices\Peripheral.cpp" />
<ClCompile Include="..\..\xbmc\peripherals\devices\PeripheralBluetooth.cpp" />
Expand Down Expand Up @@ -1090,6 +1091,7 @@
<ClInclude Include="..\..\xbmc\interfaces\python\PyContext.h" />
<ClInclude Include="..\..\xbmc\interfaces\python\pythreadstate.h" />
<ClInclude Include="..\..\xbmc\music\karaoke\karaokevideobackground.h" />
<ClInclude Include="..\..\xbmc\peripherals\bus\virtual\PeripheralBusCEC.h" />
<ClInclude Include="..\..\xbmc\video\FFmpegVideoDecoder.h" />
<ClInclude Include="..\..\xbmc\interfaces\python\swig.h" />
<ClInclude Include="..\..\xbmc\interfaces\python\XBPython.h" />
Expand Down
6 changes: 6 additions & 0 deletions project/VS2010Express/XBMC.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -2981,6 +2981,9 @@
<ClCompile Include="..\..\xbmc\filesystem\DAVCommon.cpp">
<Filter>filesystem</Filter>
</ClCompile>
<ClCompile Include="..\..\xbmc\peripherals\bus\virtual\PeripheralBusCEC.cpp">
<Filter>peripherals\bus</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\xbmc\win32\pch.h">
Expand Down Expand Up @@ -5827,6 +5830,9 @@
<ClInclude Include="..\..\xbmc\filesystem\DAVCommon.h">
<Filter>filesystem</Filter>
</ClInclude>
<ClInclude Include="..\..\xbmc\peripherals\bus\virtual\PeripheralBusCEC.h">
<Filter>peripherals\bus</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
Expand Down
25 changes: 1 addition & 24 deletions system/peripherals.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,7 @@
<setting key="flip_remote" value="Dialog.Close(virtualkeyboard)" label="36003" order="4" />
</peripheral>

<peripheral vendor_product="2708:1001" bus="rpi" name="Raspberry Pi CEC Adapter" mapTo="cec">
<setting key="enabled" type="bool" value="1" label="305" order="1" />
<setting key="activate_source" type="bool" value="1" label="36020" order="2" />
<setting key="wake_devices" type="enum" value="36037" label="36007" lvalues="36037|36038|36039|231" order="3" />
<setting key="standby_devices" type="enum" value="36037" label="36008" lvalues="36037|36038|36039|231" order="4" />
<setting key="send_inactive_source" type="bool" value="1" label="36025" order="5" />
<setting key="cec_standby_screensaver" type="bool" value="0" label="36009" order="7" />
<setting key="standby_pc_on_tv_standby" type="enum" value="13011" label="36029" order="7" lvalues="36028|13005|13011" />
<setting key="standby_tv_on_pc_standby" type="bool" value="1" label="36026" order="8" />
<setting key="use_tv_menu_language" type="bool" value="1" label="36018" order="9" />
<setting key="physical_address" type="string" label="36021" value="0" order="10" />

<setting key="tv_vendor" type="int" value="0" configurable="0" />
<setting key="device_name" type="string" value="XBMC" configurable="0" />
<setting key="device_type" type="int" value="1" configurable="0" />
<setting key="cec_hdmi_port" type="int" value="1" label="36015" configurable="0" />
<setting key="connected_device" type="int" label="36019" value="0" configurable="0" />
<setting key="port" type="string" value="" label="36022" configurable="0" />
<setting key="wake_devices_advanced" type="string" value="" configurable="0" />
<setting key="standby_devices_advanced" type="string" value="" configurable="0" />
<setting key="double_tap_timeout_ms" type="int" min="0" value="2000" configurable="0" />
</peripheral>

<peripheral vendor_product="2548:1001,2548:1002" bus="usb" name="Pulse-Eight CEC Adapter" mapTo="cec">
<peripheral bus="cec" name="CEC Adapter" mapTo="cec">
<setting key="enabled" type="bool" value="1" label="305" order="1" />
<setting key="activate_source" type="bool" value="1" label="36020" order="2" />
<setting key="wake_devices" type="enum" value="36037" label="36007" lvalues="36037|36038|36039|231" order="3" />
Expand Down
4 changes: 2 additions & 2 deletions tools/android/depends/libcec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ DEPS= ../Makefile.include Makefile

# lib name, version
LIBNAME=libcec
VERSION=2.0.5-3
VERSION=2.1.0
SOURCE=$(LIBNAME)-$(VERSION)
ARCHIVE=$(SOURCE).tar.gz

# configuration settings
CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST) \
ac_cv_search_dlopen=yes

LIBDYLIB=$(PLATFORM)/src/lib/.libs/libcec.so.2.0.0
LIBDYLIB=$(PLATFORM)/src/lib/.libs/libcec.so.2.0.1

all: .installed-$(PLATFORM)

Expand Down
2 changes: 1 addition & 1 deletion tools/darwin/depends/libcec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include ../config.site.mk

# lib name, version
LIBNAME=libcec
VERSION=2.0.5-3
VERSION=2.1.0
SOURCE=$(LIBNAME)-$(VERSION)
ARCHIVE=$(SOURCE).tar.gz

Expand Down
7 changes: 6 additions & 1 deletion xbmc/peripherals/PeripheralTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ namespace PERIPHERALS
PERIPHERAL_BUS_UNKNOWN = 0,
PERIPHERAL_BUS_USB,
PERIPHERAL_BUS_PCI,
PERIPHERAL_BUS_RPI
PERIPHERAL_BUS_RPI,
PERIPHERAL_BUS_CEC
};

enum PeripheralFeature
Expand Down Expand Up @@ -143,6 +144,8 @@ namespace PERIPHERALS
return "pci";
case PERIPHERAL_BUS_RPI:
return "rpi";
case PERIPHERAL_BUS_CEC:
return "cec";
default:
return "unknown";
}
Expand All @@ -159,6 +162,8 @@ namespace PERIPHERALS
return PERIPHERAL_BUS_PCI;
else if (strTypeLowerCase.Equals("rpi"))
return PERIPHERAL_BUS_RPI;
else if (strTypeLowerCase.Equals("cec"))
return PERIPHERAL_BUS_CEC;

return PERIPHERAL_BUS_UNKNOWN;
};
Expand Down
11 changes: 6 additions & 5 deletions xbmc/peripherals/Peripherals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#include "bus/PeripheralBusUSB.h"
#include "dialogs/GUIDialogPeripheralManager.h"

#ifdef HAVE_CEC_RPI_API
#include "bus/linux/PeripheralBusRPi.h"
#if defined(HAVE_LIBCEC)
#include "bus/virtual/PeripheralBusCEC.h"
#endif

#include "threads/SingleLock.h"
Expand Down Expand Up @@ -84,8 +84,8 @@ void CPeripherals::Initialise(void)
#if defined(HAVE_PERIPHERAL_BUS_USB)
m_busses.push_back(new CPeripheralBusUSB(this));
#endif
#ifdef HAVE_CEC_RPI_API
m_busses.push_back(new CPeripheralBusRPi(this));
#if defined(HAVE_LIBCEC)
m_busses.push_back(new CPeripheralBusCEC(this));
#endif

/* initialise all known busses */
Expand Down Expand Up @@ -276,7 +276,8 @@ CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const Periphera

case PERIPHERAL_CEC:
#if defined(HAVE_LIBCEC)
peripheral = new CPeripheralCecAdapter(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId);
if (bus.Type() == PERIPHERAL_BUS_CEC)
peripheral = new CPeripheralCecAdapter(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId);
#else
if (!m_bMissingLibCecWarningDisplayed)
{
Expand Down
4 changes: 2 additions & 2 deletions xbmc/peripherals/bus/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ ifeq ($(findstring osx,@ARCH@),osx)
SRCS += osx/PeripheralBusUSB.cpp
endif

ifeq (@USE_CEC_RPI_API@,1)
SRCS += linux/PeripheralBusRPi.cpp
ifeq (@USE_LIBCEC@,1)
SRCS += virtual/PeripheralBusCEC.cpp
endif

LIB = peripheral-bus.a
Expand Down
69 changes: 0 additions & 69 deletions xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp

This file was deleted.

Loading

0 comments on commit 59171c7

Please sign in to comment.