From: Lars Op den Kamp Date: Mon, 27 Oct 2014 10:11:13 +0000 (+0100) Subject: fixed: don't stick a value larger than 255 in a byte X-Git-Tag: upstream/2.2.0~1^2~1^2~3^2~3 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=8d84f8b3cd5eaca3743e5518f1cb5a3fc0ecbe3c fixed: don't stick a value larger than 255 in a byte the solution isn't very nice, but it'll work for now without breaking binary compatibility. the member will be replaced in the next major release --- diff --git a/include/cectypes.h b/include/cectypes.h index 883642a..6df37d5 100644 --- a/include/cectypes.h +++ b/include/cectypes.h @@ -80,9 +80,10 @@ namespace CEC { #define CEC_BUTTON_TIMEOUT 500 /*! - * don't send the same key twice within this timeout in milliseconds + * don't send the same key twice within this timeout in units of 50 milliseconds + * 4 = 200ms */ -#define CEC_DOUBLE_TAP_TIMEOUT_MS 250 +#define CEC_DOUBLE_TAP_TIMEOUT_MS 4 /*! * don't query the power state for the same device within this timeout in milliseconds @@ -329,6 +330,8 @@ namespace CEC { #define MSGESC 0xFD #define ESCOFFSET 3 +#define DOUBLE_TAP_TIMEOUT_UNIT_SIZE (50) + // defines to make compile time checks for certain features easy #define CEC_FEATURE_CONFIGURABLE_COMBO_KEY 1 @@ -1524,7 +1527,8 @@ struct libcec_configuration uint8_t bMonitorOnly; /*!< won't allocate a CCECClient when starting the connection when set (same as monitor mode). added in 1.6.3 */ cec_version cecVersion; /*!< CEC spec version to use by libCEC. defaults to v1.4. added in 1.8.0 */ cec_adapter_type adapterType; /*!< type of the CEC adapter that we're connected to. added in 1.8.2 */ - uint8_t iDoubleTapTimeoutMs; /*!< prevent double taps withing this timeout. defaults to 200ms. added in 2.0.0 */ + uint8_t iDoubleTapTimeoutMs; /*!< prevent double taps withing this timeout, in units of 50ms. defaults to 200ms (value: 4). added in 2.0.0, + XXX changed meaning in 2.2.0 to not break binary compatibility. next major (3.0) release will fix it in a nicer way */ cec_user_control_code comboKey; /*!< key code that initiates combo keys. defaults to CEC_USER_CONTROL_CODE_F1_BLUE. CEC_USER_CONTROL_CODE_UNKNOWN to disable. added in 2.0.5 */ uint32_t iComboKeyTimeoutMs; /*!< timeout until the combo key is sent as normal keypress */ diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp index 837214f..12ca4ce 100644 --- a/src/lib/CECClient.cpp +++ b/src/lib/CECClient.cpp @@ -1466,7 +1466,7 @@ void CCECClient::CallbackAddKey(const cec_keypress &key) int64_t now = GetTimeMs(); if (m_lastKeypress.keycode != key.keycode || key.duration > 0 || - now - m_iLastKeypressTime >= m_configuration.iDoubleTapTimeoutMs) + now - m_iLastKeypressTime >= m_configuration.iDoubleTapTimeoutMs * DOUBLE_TAP_TIMEOUT_UNIT_SIZE) { // no double tap if (key.duration == 0)