rpi: handle vendor specific remote control presses. closes #42
authorLars Op den Kamp <lars@opdenkamp.eu>
Wed, 5 Sep 2012 09:26:35 +0000 (11:26 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Wed, 5 Sep 2012 13:07:59 +0000 (15:07 +0200)
src/lib/adapter/RPi/RPiCECAdapterCommunication.cpp

index a89ebf6e79bac7d7a84dc8b08c861504138fc133..9176647f9f02630e212fa5d7363f84a26798620d 100644 (file)
@@ -168,10 +168,14 @@ void CRPiCECAdapterCommunication::OnDataReceived(uint32_t header, uint32_t p0, u
     }
     break;
   case VC_CEC_BUTTON_PRESSED:
+  case VC_CEC_REMOTE_PRESSED:
     {
       // translate into a cec_command
       cec_command command;
-      cec_command::Format(command, (cec_logical_address)CEC_CB_INITIATOR(p0), (cec_logical_address)CEC_CB_FOLLOWER(p0), CEC_OPCODE_USER_CONTROL_PRESSED);
+      cec_command::Format(command,
+                          (cec_logical_address)CEC_CB_INITIATOR(p0),
+                          (cec_logical_address)CEC_CB_FOLLOWER(p0),
+                          reason == VC_CEC_BUTTON_PRESSED ? CEC_OPCODE_USER_CONTROL_PRESSED : CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN);
       command.parameters.PushBack((uint8_t)CEC_CB_OPERAND1(p0));
 
       // send to libCEC
@@ -179,10 +183,14 @@ void CRPiCECAdapterCommunication::OnDataReceived(uint32_t header, uint32_t p0, u
     }
     break;
   case VC_CEC_BUTTON_RELEASE:
+  case VC_CEC_REMOTE_RELEASE:
     {
       // translate into a cec_command
       cec_command command;
-      cec_command::Format(command, (cec_logical_address)CEC_CB_INITIATOR(p0), (cec_logical_address)CEC_CB_FOLLOWER(p0), CEC_OPCODE_USER_CONTROL_RELEASE);
+      cec_command::Format(command,
+                          (cec_logical_address)CEC_CB_INITIATOR(p0),
+                          (cec_logical_address)CEC_CB_FOLLOWER(p0),
+                          reason == VC_CEC_BUTTON_PRESSED ? CEC_OPCODE_USER_CONTROL_RELEASE : CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP);
       command.parameters.PushBack((uint8_t)CEC_CB_OPERAND1(p0));
 
       // send to libCEC
@@ -220,8 +228,6 @@ void CRPiCECAdapterCommunication::OnDataReceived(uint32_t header, uint32_t p0, u
     }
     break;
   case VC_CEC_TOPOLOGY:
-  case VC_CEC_REMOTE_PRESSED:
-  case VC_CEC_REMOTE_RELEASE:
     break;
   default:
     LIB_CEC->AddLog(CEC_LOG_DEBUG, "ignoring unknown reason %x", reason);