[Issue]: HDMI-CEC OK/Select button does not work on Google TV

Author: mrsricCreated Sep 18, 2026Updated Sep 18, 2026
Labelsbug

Describe the bug

On Google TV / Android TV devices using the TV remote through HDMI-CEC, the directional buttons work correctly in Moonlight, but the remote's OK/Select button does not activate/select focused items.

I reproduced this on a Chromecast with Google TV using the Android version of Moonlight.

My use case is controlling Kodi running on my Windows PC from the TV using the TV remote through the Chromecast with Google TV and Moonlight. The directional buttons work as expected, but the OK/Select button does not.

The same TV remote works correctly in other Android TV interfaces, and the Android KEYCODE_ENTER event works correctly in Moonlight when injected through ADB.

Environment

  • Device: Chromecast with Google TV
  • Platform: Google TV / Android TV
  • Moonlight Android: v12.2
  • Host: Windows 10/11
  • Streaming host: Sunshine/Apollo
  • Remote: TV remote via HDMI-CEC
  • Use case: controlling Kodi running on the Windows PC

Reproduction

  1. Connect the Chromecast with Google TV to the TV via HDMI.
  2. Enable HDMI-CEC so the TV remote can control the Chromecast.
  3. Open Moonlight and connect to the Windows PC.
  4. Open/use Kodi on the PC.
  5. Navigate using the TV remote's directional buttons.
  6. Press the remote's OK/Select button.

Result: directional navigation works, but OK/Select does not activate the focused item.

Investigation

Using ADB, I confirmed that:

  • adb shell input keyevent 66 (KEYCODE_ENTER) works correctly in Moonlight.
  • adb shell input keyevent 23 (KEYCODE_DPAD_CENTER) does not activate the focused item.
  • adb shell input keyevent 96 (KEYCODE_BUTTON_A) does not activate the focused item.

At the Moonlight input layer, the physical HDMI-CEC OK button is received as:

  • key code: KEYCODE_DPAD_CENTER
  • source: 0x02000001 (SOURCE_HDMI + button class)
  • device name: Virtual
  • device ID: -1

Tested workaround / proposed fix

I tested a small change in Game.java that converts only HDMI-originated DPAD_CENTER events to KEYCODE_ENTER before the normal key handling:

java
private KeyEvent remapCecSelectToEnter(KeyEvent event) {
    if (event.getSource() == InputDevice.SOURCE_HDMI &&
            event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER) {

        return new KeyEvent(
                event.getDownTime(),
                event.getEventTime(),
                event.getAction(),
                KeyEvent.KEYCODE_ENTER,
                event.getRepeatCount(),
                event.getMetaState(),
                event.getDeviceId(),
                event.getScanCode(),
                event.getFlags(),
                event.getSource()
        );
    }

    return event;
}

I applied this before the normal key handling in both handleKeyDown() and handleKeyUp().

This fixed the issue on my Chromecast with Google TV: the TV remote's OK/Select button works normally in Moonlight.

The important part is that the remapping is restricted to InputDevice.SOURCE_HDMI, so normal gamepad DPAD_CENTER events are not affected.

If useful, I can also provide the complete patch/PR for this change.

Source: moonlight-stream/moonlight-android