Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
opdenkamp committed Feb 29, 2012
2 parents 0f1b44d + 0fabd36 commit 0eb7639
Show file tree
Hide file tree
Showing 52 changed files with 956 additions and 523 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Expand Up @@ -14,10 +14,10 @@
*.suo
*.user

/support/sign-binary.cmd
/support/create-cat.cmd
/support/private

/driver/p8usb-cec.cat
/bootloader-driver/p8_usb_dfu.cat

aclocal.m4
autom4te.cache
Expand Down
61 changes: 30 additions & 31 deletions COPYING
@@ -1,34 +1,33 @@
/*
* This file is part of the libCEC(R) library.
*
* libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved.
* libCEC(R) is a original work, containing original code.
*
* libCEC(R) is a trademark of Pulse-Eight Limited.
*
* This program is dual-licensed; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
* Alternatively, you can license this library under a commercial license,
* please contact Pulse-Eight Licensing for more information.
*
* For more information contact:
* Pulse-Eight Licensing <license@pulse-eight.com>
* http://www.pulse-eight.com/
* http://www.pulse-eight.net/
*/
This file is part of the libCEC(R) library.

libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved.
libCEC(R) is a original work, containing original code.

libCEC(R) is a trademark of Pulse-Eight Limited.

This program is dual-licensed; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Alternatively, you can license this library under a commercial license,
please contact Pulse-Eight Licensing for more information.

For more information contact:
Pulse-Eight Licensing <license@pulse-eight.com>
http://www.pulse-eight.com/
http://www.pulse-eight.net/



GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Expand Down
57 changes: 57 additions & 0 deletions ChangeLog
@@ -1,3 +1,60 @@
libcec (1.5-2) unstable; urgency=low

* changed/added:
* added Toshiba's vendor id, and set the device ID of the primary device to
Toshiba's and transmit it when starting
* lock in SyncedBuffer
* added a timeout to StopThread()
* also add commands to unsupported features when receiving
CEC_ABORT_REASON_REFUSED
* cec-config-gui: set cbPortNumber enabled when the physical address
override isn't checked instead
* cec-config-gui: added support for the new 'send inactive source' setting

* interface changes:
* added an 'send inactive source' option to libcec_configuration, only
supported by client/server 1.5.1 and up. bugzid: 439
* added a command to the interface to start the bootloader directly,
without going through all checks. bugzid: 218
* LibCecSharp: implemented support for the new 'send inactive source'
setting

* fixed:
* don't send an updated configuration when libCEC hasn't been initialised
fully. bugzid: 459
* don't send an updated configuration back when initialising. let the
client call the GetCurrentConfiguration() method. bugzid: 459
* configuration updates from libCEC. bugzid: 459
* fixed accidental double deref. the method parameter already does that.
github #24
* use CLOCK_MONOTONIC for timing info, since gettimeofday is affected by
ntp and by manually adjusting the system time
* the timeout value of pthread_cond_timedwait has to be referenced to
CLOCK_REALTIME
* don't add data to the input buffer in CUSBCECAdapterCommunication before
it's fully initialised
* fixed return value of CUSBCECAdapterCommunication::ParseMessage(). fixes
messages not being parsed in certain occasions
* don't try to transmit when the processor is being stopped
* set the server version in the LibCEC's constructor, since this is
checked by clients. fixes 'invalid libCEC version' popup when inserting
the adapter
* don't wait for the full timeout to pass in CCECProcessor::
OpenConnection(), but retry to connect 2 times. fixes 'port busy' errors
when initialising libCEC. bugzid: 436
* use the correct Sleep() method in CCECProcessor::OpenConnection(). the
thread hasn't been started there yet, so the sleep wasn't working. fixes
'device or resource busy' when plugging in the adapter. bugzid: 436
* check the adapter ping and firmware before starting the reader thread, so
we really leave the com port alone for a second when it fails because of
a busy error. bugzid: 436
* ensure that the connection is really closed before retrying to connect.
bugzid: 436
* LibCecSharp: recreate the delegates properly when (re)connecting to
LibCecSharp

-- Pulse-Eight Packaging <packaging@pulse-eight.com> Tue, 28 Feb 2012 21:19:00 +0100

libcec (1.5-1) unstable; urgency=low

* changed/added:
Expand Down
57 changes: 57 additions & 0 deletions debian/changelog
@@ -1,3 +1,60 @@
libcec (1.5-2) unstable; urgency=low

* changed/added:
* added Toshiba's vendor id, and set the device ID of the primary device to
Toshiba's and transmit it when starting
* lock in SyncedBuffer
* added a timeout to StopThread()
* also add commands to unsupported features when receiving
CEC_ABORT_REASON_REFUSED
* cec-config-gui: set cbPortNumber enabled when the physical address
override isn't checked instead
* cec-config-gui: added support for the new 'send inactive source' setting

* interface changes:
* added an 'send inactive source' option to libcec_configuration, only
supported by client/server 1.5.1 and up. bugzid: 439
* added a command to the interface to start the bootloader directly,
without going through all checks. bugzid: 218
* LibCecSharp: implemented support for the new 'send inactive source'
setting

* fixed:
* don't send an updated configuration when libCEC hasn't been initialised
fully. bugzid: 459
* don't send an updated configuration back when initialising. let the
client call the GetCurrentConfiguration() method. bugzid: 459
* configuration updates from libCEC. bugzid: 459
* fixed accidental double deref. the method parameter already does that.
github #24
* use CLOCK_MONOTONIC for timing info, since gettimeofday is affected by
ntp and by manually adjusting the system time
* the timeout value of pthread_cond_timedwait has to be referenced to
CLOCK_REALTIME
* don't add data to the input buffer in CUSBCECAdapterCommunication before
it's fully initialised
* fixed return value of CUSBCECAdapterCommunication::ParseMessage(). fixes
messages not being parsed in certain occasions
* don't try to transmit when the processor is being stopped
* set the server version in the LibCEC's constructor, since this is
checked by clients. fixes 'invalid libCEC version' popup when inserting
the adapter
* don't wait for the full timeout to pass in CCECProcessor::
OpenConnection(), but retry to connect 2 times. fixes 'port busy' errors
when initialising libCEC. bugzid: 436
* use the correct Sleep() method in CCECProcessor::OpenConnection(). the
thread hasn't been started there yet, so the sleep wasn't working. fixes
'device or resource busy' when plugging in the adapter. bugzid: 436
* check the adapter ping and firmware before starting the reader thread, so
we really leave the com port alone for a second when it fails because of
a busy error. bugzid: 436
* ensure that the connection is really closed before retrying to connect.
bugzid: 436
* LibCecSharp: recreate the delegates properly when (re)connecting to
LibCecSharp

-- Pulse-Eight Packaging <packaging@pulse-eight.com> Tue, 28 Feb 2012 21:19:00 +0100

libcec (1.5-1) unstable; urgency=low

* changed/added:
Expand Down
6 changes: 6 additions & 0 deletions include/cec.h
Expand Up @@ -443,6 +443,12 @@ extern "C" DECLSPEC void * CECInit(const char *strDeviceName, CEC::cec_device_ty
*/
extern "C" DECLSPEC void * CECInitialise(CEC::libcec_configuration *configuration);

/*!
* @brief Try to connect to the adapter and send the "start bootloader" command, without initialising libCEC and going through all checks
* @return True when the command was send, false otherwise.
*/
extern "C" DECLSPEC bool CECStartBootloader(void);

/*!
* @brief Unload the CEC adapter library.
*/
Expand Down
66 changes: 66 additions & 0 deletions include/cecloader.h
Expand Up @@ -111,6 +111,34 @@ void UnloadLibCec(CEC::ICECAdapter *device)
g_libCEC = NULL;
}

/*!
* @brief Start the bootloader on the first device that was detected.
* @param strLib The name of and/or path to libCEC
* @return True when the command was sent, false otherwise.
*/
bool LibCecBootloader(const char *strLib = NULL)
{
if (!g_libCEC)
#if defined(_WIN64)
g_libCEC = LoadLibrary(strLib ? strLib : "libcec.x64.dll");
#else
g_libCEC = LoadLibrary(strLib ? strLib : "libcec.dll");
#endif
if (!g_libCEC)
return NULL;

typedef bool (__cdecl*_LibCecBootloader)(void);
_LibCecBootloader LibCecBootloader;
LibCecBootloader = (_LibCecBootloader) (GetProcAddress(g_libCEC, "CECStartBootloader"));
if (!LibCecBootloader)
return false;

bool bReturn = LibCecBootloader();
FreeLibrary(g_libCEC);
g_libCEC = NULL;
return bReturn;
}

#else

#include <dlfcn.h>
Expand Down Expand Up @@ -206,6 +234,44 @@ void UnloadLibCec(CEC::ICECAdapter *device)
dlclose(g_libCEC);
}

/*!
* @brief Start the bootloader on the first device that was detected.
* @param strLib The name of and/or path to libCEC
* @return True when the command was sent, false otherwise.
*/
bool LibCecBootloader(const char *strLib = NULL)
{
if (!g_libCEC)
{
#if defined(__APPLE__)
g_libCEC = dlopen(strLib ? strLib : "libcec.dylib", RTLD_LAZY);
#else
g_libCEC = dlopen(strLib ? strLib : "libcec.so", RTLD_LAZY);
#endif
if (!g_libCEC)
{
#if defined(__APPLE__)
cout << "cannot find " << (strLib ? strLib : "libcec.dylib") << dlerror() << endl;
#else
cout << "cannot find " << (strLib ? strLib : "libcec.so") << dlerror() << endl;
#endif
return NULL;
}
}

typedef bool _LibCecBootloader(void);
_LibCecBootloader* LibCecBootloader = (_LibCecBootloader*) dlsym(g_libCEC, "CECStartBootloader");
if (!LibCecBootloader)
{
cout << "cannot find CECStartBootloader" << endl;
return NULL;
}

bool bReturn = LibCecBootloader();
dlclose(g_libCEC);
return bReturn;
}

#endif

#endif /* CECLOADER_H_ */
17 changes: 12 additions & 5 deletions include/cectypes.h
Expand Up @@ -72,12 +72,14 @@ namespace CEC {
#define CEC_BUTTON_TIMEOUT 500
#define CEC_POWER_STATE_REFRESH_TIME 30000
#define CEC_FW_VERSION_UNKNOWN 0xFFFF
#define CEC_CONNECT_TRIES 3

#define CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE 1
#define CEC_DEFAULT_SETTING_ACTIVATE_SOURCE 1
#define CEC_DEFAULT_SETTING_POWER_OFF_SHUTDOWN 1
#define CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER 1
#define CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY 1
#define CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE 1

#define CEC_DEFAULT_TRANSMIT_RETRY_WAIT 500
#define CEC_DEFAULT_TRANSMIT_TIMEOUT 1000
Expand Down Expand Up @@ -620,6 +622,7 @@ typedef enum cec_vendor_id
CEC_VENDOR_YAMAHA = 0x00A0DE,
CEC_VENDOR_PHILIPS = 0x00903E,
CEC_VENDOR_SONY = 0x080046,
CEC_VENDOR_TOSHIBA = 0x000039,
CEC_VENDOR_UNKNOWN = 0
} cec_vendor_id;

Expand Down Expand Up @@ -944,13 +947,15 @@ typedef struct ICECCallbacks
typedef enum cec_client_version
{
CEC_CLIENT_VERSION_PRE_1_5 = 0,
CEC_CLIENT_VERSION_1_5_0 = 0x1500
CEC_CLIENT_VERSION_1_5_0 = 0x1500,
CEC_CLIENT_VERSION_1_5_1 = 0x1501
} cec_client_version;

typedef enum cec_server_version
{
CEC_SERVER_VERSION_PRE_1_5 = 0,
CEC_SERVER_VERSION_1_5_0 = 0x1500
CEC_SERVER_VERSION_1_5_0 = 0x1500,
CEC_SERVER_VERSION_1_5_1 = 0x1501
} cec_server_version;

typedef struct libcec_configuration
Expand All @@ -974,6 +979,7 @@ typedef struct libcec_configuration
uint8_t bActivateSource; /*!< make libCEC the active source on the bus when starting the player application */
uint8_t bPowerOffScreensaver; /*!< put devices in standby mode when activating the screensaver */
uint8_t bPowerOffOnStandby; /*!< put this PC in standby mode when the TV is switched off */
uint8_t bSendInactiveSource; /*!< send an 'inactive source' message when stopping the player. added in 1.5.1 */

void * callbackParam; /*!< the object to pass along with a call of the callback methods. NULL to ignore */
ICECCallbacks * callbacks; /*!< the callback methods to use. set this to NULL when not using callbacks */
Expand All @@ -999,11 +1005,12 @@ typedef struct libcec_configuration
#if CEC_DEFAULT_SETTING_POWER_OFF_SHUTDOWN == 1
powerOffDevices.Set(CECDEVICE_BROADCAST);
#endif
#if CEC_DEFAULT_SETTING_ACTIVATE_SOURCE == 1
wakeDevices.Set(CECDEVICE_TV);
#endif
#if CEC_DEFAULT_SETTING_ACTIVATE_SOURCE == 1
wakeDevices.Set(CECDEVICE_TV);
#endif
bPowerOffScreensaver = CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER;
bPowerOffOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY;
bSendInactiveSource = CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE;

callbackParam = NULL;
callbacks = NULL;
Expand Down
2 changes: 2 additions & 0 deletions project/libcec.vcxproj
Expand Up @@ -36,6 +36,7 @@
<ClInclude Include="..\src\lib\devices\CECTV.h" />
<ClInclude Include="..\src\lib\implementations\ANCommandHandler.h" />
<ClInclude Include="..\src\lib\implementations\CECCommandHandler.h" />
<ClInclude Include="..\src\lib\implementations\RLCommandHandler.h" />
<ClInclude Include="..\src\lib\implementations\SLCommandHandler.h" />
<ClInclude Include="..\src\lib\implementations\VLCommandHandler.h" />
<ClInclude Include="..\src\lib\LibCEC.h" />
Expand Down Expand Up @@ -66,6 +67,7 @@
<ClCompile Include="..\src\lib\devices\CECTV.cpp" />
<ClCompile Include="..\src\lib\implementations\ANCommandHandler.cpp" />
<ClCompile Include="..\src\lib\implementations\CECCommandHandler.cpp" />
<ClCompile Include="..\src\lib\implementations\RLCommandHandler.cpp" />
<ClCompile Include="..\src\lib\implementations\SLCommandHandler.cpp" />
<ClCompile Include="..\src\lib\implementations\VLCommandHandler.cpp" />
<ClCompile Include="..\src\lib\LibCEC.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions project/libcec.vcxproj.filters
Expand Up @@ -128,6 +128,9 @@
<ClInclude Include="..\src\lib\adapter\USBCECAdapterMessage.h">
<Filter>adapter</Filter>
</ClInclude>
<ClInclude Include="..\src\lib\implementations\RLCommandHandler.h">
<Filter>implementations</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\lib\CECProcessor.cpp" />
Expand Down Expand Up @@ -173,6 +176,9 @@
<ClCompile Include="..\src\lib\adapter\USBCECAdapterDetection.cpp">
<Filter>adapter</Filter>
</ClCompile>
<ClCompile Include="..\src\lib\implementations\RLCommandHandler.cpp">
<Filter>implementations</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="libcec.rc" />
Expand Down

0 comments on commit 0eb7639

Please sign in to comment.