cec: don't hack around the issue that samsung's vendor specific keypresses aren't...
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 3 Nov 2011 19:35:36 +0000 (20:35 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 3 Nov 2011 19:35:39 +0000 (20:35 +0100)
src/lib/CECProcessor.cpp
src/lib/CECProcessor.h
src/lib/LibCEC.cpp
src/lib/LibCEC.h
src/lib/implementations/ANCommandHandler.cpp

index c83bdc05486d158140313c5a602840f2e0188478..f781b6fb58b94f99f970a8eb2248937f958aa1cc 100644 (file)
@@ -394,6 +394,11 @@ void CCECProcessor::AddCommand(const cec_command &command)
   m_controller->AddCommand(command);
 }
 
+void CCECProcessor::AddKey(cec_keypress &key)
+{
+  m_controller->AddKey(key);
+}
+
 void CCECProcessor::AddKey(void)
 {
   m_controller->AddKey();
index 895445ff14ee0e1aa3056ea17f5dc793a25a2359..d865167e114ff6e9332682a665c8873e31e30c9d 100644 (file)
@@ -75,6 +75,7 @@ namespace CEC
 
       virtual void SetCurrentButton(cec_user_control_code iButtonCode);
       virtual void AddCommand(const cec_command &command);
+      virtual void AddKey(cec_keypress &key);
       virtual void AddKey(void);
       virtual void AddLog(cec_log_level level, const CStdString &strMessage);
 
index 0efef00b2bb1ea4ef30b67845b0d7c8e7b9f5596..95e2a2e42e72d1a5cadb37f2be924c207a19a322 100644 (file)
@@ -227,6 +227,13 @@ void CLibCEC::AddLog(cec_log_level level, const string &strMessage)
   }
 }
 
+void CLibCEC::AddKey(cec_keypress &key)
+{
+  m_keyBuffer.Push(key);
+  m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN;
+  m_buttontime = 0;
+}
+
 void CLibCEC::AddKey(void)
 {
   if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN)
index 203facb43c15c9ec73a19c41a037160e606a9ce4..1997039f375e3d26e092b7bf7bd4bb0881c532dc 100644 (file)
@@ -82,6 +82,7 @@ namespace CEC
 
       virtual void AddLog(cec_log_level level, const std::string &strMessage);
       virtual void AddKey(void);
+      virtual void AddKey(cec_keypress &key);
       virtual void AddCommand(const cec_command &command);
       virtual void CheckKeypressTimeout(void);
       virtual void SetCurrentButton(cec_user_control_code iButtonCode);
index ef972f8a5408c9f9c357403c0c5810324ee1029d..f1e3dd5b1c2da7b7ec7fe50bb96e80ebeaf97cdd 100644 (file)
@@ -46,28 +46,26 @@ bool CANCommandHandler::HandleVendorRemoteButtonDown(const cec_command &command)
 {
   if (command.parameters.size > 0)
   {
-    m_busDevice->GetProcessor()->AddKey();
+    cec_keypress key;
+    key.duration = CEC_BUTTON_TIMEOUT;
+    key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN;
 
-    uint8_t iButton = 0;
     switch (command.parameters[0])
     {
     case CEC_AN_USER_CONTROL_CODE_RETURN:
-      iButton = CEC_USER_CONTROL_CODE_PREVIOUS_CHANNEL;
+      key.keycode = CEC_USER_CONTROL_CODE_EXIT;
       break;
     default:
       break;
     }
 
-    if (iButton > 0 && iButton <= CEC_USER_CONTROL_CODE_MAX)
+    if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN)
     {
       CStdString strLog;
-      strLog.Format("key pressed: %1x", iButton);
+      strLog.Format("key pressed: %1x", key.keycode);
       m_busDevice->AddLog(CEC_LOG_DEBUG, strLog);
 
-      m_busDevice->GetProcessor()->SetCurrentButton((cec_user_control_code) command.parameters[0]);
-
-      // these ones don't send key release events
-      m_busDevice->GetProcessor()->AddKey();
+      m_busDevice->GetProcessor()->AddKey(key);
     }
   }