Skip to content
Permalink
Browse files

[cec] suppress double keys within 250ms

workaround for Panasonic's cec implementation
  • Loading branch information
chbmuc committed Jan 18, 2014
1 parent bff4588 commit 6e5822d4fe648abbd575cf77ced943a1461e9ae5
@@ -56,6 +56,9 @@ using namespace std;
#define LOCALISED_ID_TV_AVR 36039
#define LOCALISED_ID_NONE 231

/* time in milliseconds to suppress a double key press */
#define CEC_SUPPRESS_DOUBLE_KEY 250

/* time in seconds to suppress source activation after receiving OnStop */
#define CEC_SUPPRESS_ACTIVATE_SOURCE_AFTER_ON_STOP 2

@@ -765,16 +768,20 @@ void CPeripheralCecAdapter::GetNextKey(void)

void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key)
{
CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration);
CLog::Log(LOGDEBUG, "%s - received key %2x duration %d timestamp %i", __FUNCTION__, key.iButton, key.iDuration, key.iTimestamp);

CSingleLock lock(m_critSection);
if (key.iDuration == 0 && key.iTimestamp - m_currentButton.iTimestamp < CEC_SUPPRESS_DOUBLE_KEY )
if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0)
// ignore this one, since it's already been handled by xbmc (workaround for buggy tv)
return;

if (key.iDuration > 0)
{
if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0)
{
// update the duration
if (m_bHasButton)
m_currentButton.iDuration = key.iDuration;
// update the duration
m_currentButton.iDuration = key.iDuration;
// ignore this one, since it's already been handled by xbmc
return;
}
@@ -802,6 +809,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const cec_keypress &key)
{
CecButtonPress xbmcKey;
xbmcKey.iDuration = key.duration;
xbmcKey.iTimestamp = XbmcThreads::SystemClockMillis();

switch (key.keycode)
{
@@ -72,6 +72,7 @@ namespace PERIPHERALS
{
int iButton;
unsigned int iDuration;
unsigned int iTimestamp;
} CecButtonPress;

typedef enum

12 comments on commit 6e5822d

@DavorSaric

This comment has been minimized.

Copy link

DavorSaric replied Jan 24, 2014

Hello, you posted this in my issue on Pulse-Eight / libcec on Git. I responded yesterday but today there are no issues or pull requests on that site, everything is empty. I wanted to know how can I use this on my Pi. I have arch arm installed and the package that installs xbmc is xbmc-rbp-git 13.20131021-1...

@chbmuc

This comment has been minimized.

Copy link
Owner Author

chbmuc replied Jan 24, 2014

@DavorSaric

This comment has been minimized.

Copy link

DavorSaric replied Jan 24, 2014

Tnx, but I need my Pi for some other stuf, OpenElec is great for XBMC but can't add other stuff so staying on arch. I'll go with crosscompiling.

I didn't get your answer becase they deleted all the tickets https://github.com/Pulse-Eight/libcec because they recreated the repository...

@DavorSaric

This comment has been minimized.

@Forage

This comment has been minimized.

Copy link

Forage replied May 24, 2014

I've got the same "double action" issue with my Panasonic TV since OpenElec 4 as well. Do you intent on getting this work-around pulled into XBMC? Otherwise I hope it's an option for OpenElec to include it as a separate patch.

@chbmuc

This comment has been minimized.

Copy link
Owner Author

chbmuc replied May 25, 2014

@Forage

This comment has been minimized.

Copy link

Forage replied May 25, 2014

If it's a fix that doesn't hurt CEC functioning in general, why not try to get it in XBMC by default? This would eliminate the need for custom builds.

@Forage

This comment has been minimized.

Copy link

Forage replied Jun 10, 2014

@chbmuc: FYI, your change has been included in the OpenElec buils by @MilhouseVH for more than a week now and it works like a charm: http://forum.xbmc.org/showthread.php?tid=192380&pid=1724854#pid1724854

I do, however, think libcec would be the most suitable place to get it fixed (Pulse-Eight/libcec#13), like it was in the past, to prevent suppression to be implemented in multiple places and thereby having click delays multiple times.

@KN0S

This comment has been minimized.

Copy link

KN0S replied Oct 24, 2014

Hey chbmuc I have been making custom Openelec builds with your fix for some time now (thank you). But the files seem to be gone from the newest build. Is this method of fixing panasonic double key press not applicable any more?

@chbmuc

This comment has been minimized.

Copy link
Owner Author

chbmuc replied Oct 25, 2014

@KN0S

This comment has been minimized.

Copy link

KN0S replied Oct 25, 2014

Thx for the replay chbmuc, I compile xbmc/kodi from the openelec Master. Only change the two files here to make it work on my pana tv. It's not for my RPi but my x86_64 media center with a Pulse Eight cec adapter. My problem is the two files are not present anymore? Did something change in the Way this workshop? could be me making a mistanke somewhere though.

@chbmuc

This comment has been minimized.

Copy link
Owner Author

chbmuc replied Oct 25, 2014

I think I know what it is: xbmc was renamed to kodi in openelec master. You will have to rename the patch as well:

https://github.com/chbmuc/OpenELEC.tv/commit/201b618df119dfd924829cddc6e22df4dc9d5859

Please sign in to comment.
You can’t perform that action at this time.