mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-12-08 23:03:46 +00:00
74 lines
2.7 KiB
Diff
74 lines
2.7 KiB
Diff
|
From 6e5822d4fe648abbd575cf77ced943a1461e9ae5 Mon Sep 17 00:00:00 2001
|
||
|
From: Christian Brunner <chb@muc.de>
|
||
|
Date: Sat, 18 Jan 2014 13:20:56 -0800
|
||
|
Subject: [PATCH] [cec] suppress double keys within 250ms
|
||
|
|
||
|
workaround for Panasonic's cec implementation
|
||
|
---
|
||
|
xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 16 ++++++++++++----
|
||
|
xbmc/peripherals/devices/PeripheralCecAdapter.h | 1 +
|
||
|
2 files changed, 13 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
|
||
|
index 8919380..4bf5f89 100644
|
||
|
--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
|
||
|
+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
|
||
|
@@ -56,6 +56,9 @@
|
||
|
#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)
|
||
|
{
|
||
|
diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.h b/xbmc/peripherals/devices/PeripheralCecAdapter.h
|
||
|
index 0809b03..cfd4ba9 100644
|
||
|
--- a/xbmc/peripherals/devices/PeripheralCecAdapter.h
|
||
|
+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.h
|
||
|
@@ -72,6 +72,7 @@
|
||
|
{
|
||
|
int iButton;
|
||
|
unsigned int iDuration;
|
||
|
+ unsigned int iTimestamp;
|
||
|
} CecButtonPress;
|
||
|
|
||
|
typedef enum
|
||
|
--
|
||
|
1.8.5.1
|
||
|
|