[Feature Request] Handle Android SOURCE_HDMI CEC remotes generically
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 14.1k
- Forks
- 2.2k
- Avg merge
- 7h 35m
- Merged PRs (30d)
- 51
Description
Feature request
Handle Android HDMI-CEC key events as a generic navigation source instead of
requiring a fictitious joypad autoconfiguration profile.
Tested environment
- RetroArch
1.22.2_GIT, 32-bit Android build. - Android 10 / API 29 TV box, Allwinner H616.
- HDMI-CEC confirmed with two Sony 3D televisions:
| Television | Result |
|---|---|
| Sony KDL-46HX855 | working |
| Sony KDL-46EX725 | working |
Both sets send D-pad Up/Down/Left/Right, D-pad Center, and Back. Android
delivers them in this form:
KeyEvent(
deviceId=-1,
source=0x02000001 (SOURCE_HDMI),
scanCode=0,
keyCode=23
)
The other observed keycodes are standard Android keycodes 4 and 19–22.
Why a controller profile cannot represent this
deviceId=-1 is a framework-injected virtual event. It has no stable physical
device name, vendor ID, or product ID, while RetroArch joypad autoconfiguration
selects profiles by the exact name/VID/PID triple.
Creating a Virtual profile would be unsafe because it could also capture
unrelated synthetic input. Creating Sony-model profiles would be inaccurate:
both televisions arrive through the same anonymous SOURCE_HDMI path.
Current RetroArch master documents CEC as a Virtual device inside the
NVIDIA SHIELD-specific block in input/drivers/android_input.c, but there is
no generic source-specific path for SOURCE_HDMI.
Requested behavior
Please consider one of these source-specific approaches:
- Route
SOURCE_HDMIkey events to the Android keyboard/navigation port, so
normal RetroArch key bindings handle arrows, Enter/Center, and Back. - Expose a dedicated synthetic identity such as
Android HDMI-CEC Remote,
selected by event source rather than by the genericVirtualdevice name.
Either approach should key off SOURCE_HDMI, not TV model or Virtual.
Android's framework already translates the CEC UI-command set to Android
keycodes; the set of buttons received depends on what each TV transmits.
Reproduction/evidence
- Enable HDMI-CEC on an Android TV device and either tested Sony television.
- Focus RetroArch and press the television remote arrows, OK, and Back.
- Inspect Android's recent input queue with
dumpsys input. - Observe
deviceId=-1,source=0x02000001,scanCode=0. - Try to create a controller profile: there is no physical device identity
that can be represented without colliding with unrelated virtual input.
No existing RetroArch issue matching SOURCE_HDMI, Android CEC, or
HDMI remote Android TV was found before filing this report.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in input/drivers/android_input.c, especially the existing CEC handling in the NVIDIA SHIELD-specific block, and trace how Android key events are classified and routed. Reproduce the SOURCE_HDMI events with the listed D-pad and Back keycodes, then verify that generic Android HDMI-CEC input works without matching a Virtual or TV-specific controller profile.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, c
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100