fixed - new combo key handling broke samsung's vendor specific remote buttons. github...
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 18 Oct 2012 14:45:54 +0000 (16:45 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 18 Oct 2012 15:33:23 +0000 (17:33 +0200)
src/lib/CECClient.cpp
src/lib/implementations/ANCommandHandler.cpp

index a5a960ea36b00e4c804c3362b088e855550fdde3..3004d870a1d9daf603e1c591d4e5924086fd1e4e 100644 (file)
@@ -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)
index 648f4a0de21501cefd521eedb94aed67a955a91c..92b4464b2fe82dd06325d0c8f723ec9e41b4b547 100644 (file)
@@ -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;