+ CLibCEC *instance = CLibCEC::GetInstance();
+ CLockObject lock(instance->m_mutex);
+
+ AddLog(CEC_LOG_DEBUG, "key pressed: %1x", key.keycode);
+
+ if (instance->m_callbacks)
+ instance->m_callbacks->CBCecKeyPress(instance->m_cbParam, key);
+ else
+ instance->m_keyBuffer.Push(key);
+
+ instance->m_iCurrentButton = key.duration > 0 ? CEC_USER_CONTROL_CODE_UNKNOWN : key.keycode;
+ instance->m_buttontime = key.duration > 0 ? 0 : GetTimeMs();
+}
+
+void CLibCEC::SetCurrentButton(cec_user_control_code iButtonCode)
+{
+ /* push keypress to the keybuffer with 0 duration.
+ push another press to the keybuffer with the duration set when the button is released */
+ cec_keypress key;
+ key.duration = 0;
+ key.keycode = iButtonCode;
+
+ AddKey(key);