RDKShell provides a way to map key codes to different values. Here are the steps to do so:
- Add a new file to the firmware (e.g. /opt/rdkshell_keymapping.json)
- Edit the file. The contents of the file should be in this format
{
"keyMappings":
[
{ "keyCode": 100, "mapped": { "keyCode": 50, "modifiers":["ctrl"] } },
{ "keyCode": 150, "mapped": { "keyCode": 52, "modifiers":[] } },
...
]
}
- The keyCode value is the value received from the operating system and the mapped keyCode and (optional) modifiers will be the new mapped HTML/JavaScript value
- Save the file
- Edit /lib/systemd/system/wpeframework.service
- Add the following to the [Service] block: Environment="RDKSHELL_KEYMAP_FILE=/opt/rdkshell_keymapping.json"
- Save the wpeframework.service file
- Restart the wpeframework service (systemctl daemon-reload; systemctl restart wpeframework) or reboot your box
- RDKShell will now use the key mappings specified in the .json file. All key codes that are not mentioned in the .json file are processed by RDKShell unmodified
- The default key mapping file is stored in /etc/rdkshell_keymapping.json