From: Lars Op den Kamp Date: Thu, 18 Oct 2012 14:45:54 +0000 (+0200) Subject: fixed - new combo key handling broke samsung's vendor specific remote buttons. github... X-Git-Tag: upstream/2.2.0~1^2~13^2~15 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=68d3ecae2e6de6e497b8554da38f47dcfcc75485;p=deb_libcec.git fixed - new combo key handling broke samsung's vendor specific remote buttons. github issue #54 --- diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp index a5a960e..3004d87 100644 --- a/src/lib/CECClient.cpp +++ b/src/lib/CECClient.cpp @@ -940,15 +940,15 @@ void CCECClient::AddKey(const cec_keypress &key) // send back the previous key if there is one AddKey(); + if (key.keycode > CEC_USER_CONTROL_CODE_MAX && + key.keycode < CEC_USER_CONTROL_CODE_SELECT) + return; + cec_keypress transmitKey(key); { CLockObject lock(m_mutex); - if (key.duration > 0 || key.keycode > CEC_USER_CONTROL_CODE_MAX) - { - transmitKey.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; - } - else if (m_iCurrentButton == COMBO_KEY) + if (m_iCurrentButton == COMBO_KEY && key.duration == 0) { // stop + ok -> exit if (key.keycode == CEC_USER_CONTROL_CODE_SELECT) @@ -968,8 +968,11 @@ void CCECClient::AddKey(const cec_keypress &key) m_buttontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); } - LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); - CallbackAddKey(transmitKey); + if (key.keycode != COMBO_KEY || key.duration > 0) + { + LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); + CallbackAddKey(transmitKey); + } } void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) diff --git a/src/lib/implementations/ANCommandHandler.cpp b/src/lib/implementations/ANCommandHandler.cpp index 648f4a0..92b4464 100644 --- a/src/lib/implementations/ANCommandHandler.cpp +++ b/src/lib/implementations/ANCommandHandler.cpp @@ -68,23 +68,9 @@ int CANCommandHandler::HandleVendorRemoteButtonDown(const cec_command &command) cec_keypress key; key.duration = CEC_BUTTON_TIMEOUT; - key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; + key.keycode = (cec_user_control_code)command.parameters[0]; - switch (command.parameters[0]) - { - case CEC_USER_CONTROL_CODE_AN_RETURN: - key.keycode = client && client->GetClientVersion() >= CEC_CLIENT_VERSION_1_5_0 ? - CEC_USER_CONTROL_CODE_AN_RETURN : - CEC_USER_CONTROL_CODE_EXIT; - break; - case CEC_USER_CONTROL_CODE_AN_CHANNELS_LIST: - key.keycode = CEC_USER_CONTROL_CODE_AN_CHANNELS_LIST; - break; - default: - break; - } - - if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN && client) + if (client) client->AddKey(key); return COMMAND_HANDLED;