Advertisement
Guest User

Untitled

a guest
Feb 11th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.36 KB | None | 0 0
  1. From ae0e1e2e0545137daf868cb6cf86dd4dc72ffa51 Mon Sep 17 00:00:00 2001
  2. From: popcornmix <popcornmix@gmail.com>
  3. Date: Mon, 19 Dec 2016 14:21:40 +0000
  4. Subject: [PATCH] [cec] Drop CEC_DOUBLE_TAP_TIMEOUT_MS_OLD code
  5.  
  6. Kodi won't even build with libcec 3, so supporting a libcec 2.2 setting is of no value
  7. ---
  8. xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 7 +------
  9. 1 file changed, 1 insertion(+), 6 deletions(-)
  10.  
  11. diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
  12. index 54dc37e..73872e3 100644
  13. --- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
  14. +++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
  15. @@ -1391,13 +1391,8 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void)
  16. m_configuration.bPowerOffOnStandby = iStandbyAction == LOCALISED_ID_SUSPEND ? 1 : 0;
  17. m_bShutdownOnStandby = iStandbyAction == LOCALISED_ID_POWEROFF;
  18.  
  19. -#if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD)
  20. - // double tap prevention timeout in ms. libCEC uses 50ms units for this in 2.2.0, so divide by 50
  21. - m_configuration.iDoubleTapTimeout50Ms = GetSettingInt("double_tap_timeout_ms") / 50;
  22. -#else
  23. - // backwards compatibility. will be removed once the next major release of libCEC is out
  24. + // double tap prevention timeout in ms
  25. m_configuration.iDoubleTapTimeoutMs = GetSettingInt("double_tap_timeout_ms");
  26. -#endif
  27.  
  28. if (GetSettingBool("pause_playback_on_deactivate"))
  29. {
  30.  
  31. From 621b8ae48c61791ad74a44f57387ad4ac5c5feca Mon Sep 17 00:00:00 2001
  32. From: popcornmix <popcornmix@gmail.com>
  33. Date: Mon, 19 Dec 2016 14:21:40 +0000
  34. Subject: [PATCH] [cec] Add settings for configuring button repeats
  35.  
  36. ---
  37. addons/resource.language.en_gb/resources/strings.po | 15 +++++++++++++++
  38. system/peripherals.xml | 4 +++-
  39. xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 11 +++++++++++
  40. 3 files changed, 29 insertions(+), 1 deletion(-)
  41.  
  42. diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
  43. index 490ac35..dad7905 100644
  44. --- a/addons/resource.language.en_gb/resources/strings.po
  45. +++ b/addons/resource.language.en_gb/resources/strings.po
  46. @@ -20424,3 +20424,18 @@ msgstr ""
  47. msgctxt "#39014"
  48. msgid "Would you also like to remove all related data (e.g. settings) of this add-on?"
  49. msgstr ""
  50. +
  51. +#: system/peripherals.xml
  52. +msgctxt "#38050"
  53. +msgid "Remote button press delay before repeating (ms)"
  54. +msgstr ""
  55. +
  56. +#: system/peripherals.xml
  57. +msgctxt "#38051"
  58. +msgid "Remote button press repeat rate (ms)"
  59. +msgstr ""
  60. +
  61. +#: system/peripherals.xml
  62. +msgctxt "#38052"
  63. +msgid "Remote button press release time (ms)"
  64. +msgstr ""
  65. diff --git a/system/peripherals.xml b/system/peripherals.xml
  66. index d5704b2..02b1a9e 100644
  67. --- a/system/peripherals.xml
  68. +++ b/system/peripherals.xml
  69. @@ -31,7 +31,9 @@
  70. <setting key="device_type" type="int" value="1" configurable="0" />
  71. <setting key="wake_devices_advanced" type="string" value="" configurable="0" />
  72. <setting key="standby_devices_advanced" type="string" value="" configurable="0" />
  73. - <setting key="double_tap_timeout_ms" type="int" min="0" value="300" configurable="0" />
  74. + <setting key="double_tap_timeout_ms" type="int" min="50" max="1000" step="50" value="300" label="38050" order="16" />
  75. + <setting key="button_repeat_rate_ms" type="int" min="0" max="250" step="10" value="0" label="38051" order="17" />
  76. + <setting key="button_release_delay_ms" type="int" min="0" max="500" step="50" value="0" label="38052" order="18" />
  77. </peripheral>
  78.  
  79. <peripheral vendor_product="2548:1001,2548:1002" bus="usb" name="Pulse-Eight CEC Adapter" mapTo="cec">
  80. diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
  81. index 73872e3..92c901e 100644
  82. --- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
  83. +++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
  84. @@ -1296,6 +1296,15 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu
  85. m_configuration.bActivateSource = config.bActivateSource;
  86. bChanged |= SetSetting("activate_source", m_configuration.bActivateSource == 1);
  87.  
  88. + m_configuration.iDoubleTapTimeoutMs = config.iDoubleTapTimeoutMs;
  89. + bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeoutMs);
  90. +
  91. + m_configuration.iButtonRepeatRateMs = config.iButtonRepeatRateMs;
  92. + bChanged |= SetSetting("button_repeat_rate_ms", (int)m_configuration.iButtonRepeatRateMs);
  93. +
  94. + m_configuration.iButtonReleaseDelayMs = config.iButtonReleaseDelayMs;
  95. + bChanged |= SetSetting("button_release_delay_ms", (int)m_configuration.iButtonReleaseDelayMs);
  96. +
  97. m_configuration.bPowerOffOnStandby = config.bPowerOffOnStandby;
  98.  
  99. m_configuration.iFirmwareVersion = config.iFirmwareVersion;
  100. @@ -1393,6 +1402,8 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void)
  101.  
  102. // double tap prevention timeout in ms
  103. m_configuration.iDoubleTapTimeoutMs = GetSettingInt("double_tap_timeout_ms");
  104. + m_configuration.iButtonRepeatRateMs = GetSettingInt("button_repeat_rate_ms");
  105. + m_configuration.iButtonReleaseDelayMs = GetSettingInt("button_release_delay_ms");
  106.  
  107. if (GetSettingBool("pause_playback_on_deactivate"))
  108. {
  109.  
  110. From 2309e7d697eb3c25bf29c629b51977a308484bfb Mon Sep 17 00:00:00 2001
  111. From: popcornmix <popcornmix@gmail.com>
  112. Date: Mon, 19 Dec 2016 14:21:40 +0000
  113. Subject: [PATCH] [cec] Don't discard buttons when repeat mode is enabled
  114.  
  115. ---
  116. xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 5 ++++-
  117. 1 file changed, 4 insertions(+), 1 deletion(-)
  118.  
  119. diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
  120. index 92c901e..da99db9 100644
  121. --- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
  122. +++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
  123. @@ -803,7 +803,10 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key)
  124. CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration);
  125.  
  126. CSingleLock lock(m_critSection);
  127. - if (key.iDuration > 0)
  128. + // avoid the queue getting too long
  129. + if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5)
  130. + return;
  131. + if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0)
  132. {
  133. if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0)
  134. {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement