Custom Keyboard Guide for Interactivity

Intro

If your screen uses a keyboard for an interactive App, you may want to replace or extend the key bindings for the interactivity actions. This can be easily done by using the Advanced Player Directives. Keyboards come in many forms and flavors, so the key replacements must be declared in key code form.


Finding the key codes for your device

To find the key codes for the keyboard of your choice, you must first attach it to the player and then ssh to the same player. Then, the key code for any specific key can be retrieved using the evtest utility.

Running evtest will initially present you with a choice of input devices:

$ evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: Dell KB216 Wired Keyboard
/dev/input/event1: Dell KB216 Wired Keyboard System Control
/dev/input/event2: Dell KB216 Wired Keyboard Consumer Control
Select the device event number [0-2]: 0
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x413c product 0x2113 version 0x111
Input device name: "Dell KB216 Wired Keyboard"

Upon selection, the input device, which in our case is the device 0 , the utility displays some basic information about the keyboard and waits for input.

Select the device event number [0-2]: 0
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x413c product 0x2113 version 0x111
Input device name: "Dell KB216 Wired Keyboard"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 1 (KEY_ESC)
Event code 2 (KEY_1)
Event code 3 (KEY_2)
Event code 4 (KEY_3)
(more event codes...)
Properties:
Testing ... (interrupt to exit)

By pressing any desired key, the program responds with detailed event information, including the key code. For example, pressing the spacebar button yields the following response:

Event: time 1694082009.896384, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7002c
Event: time 1694082009.896384, type 1 (EV_KEY), code 57 (KEY_SPACE), value 1
Event: time 1694082009.896384, -------------- SYN_REPORT ------------

The EV_KEY event contains the desired information, as the KEY_SPACE the key corresponds to the 57 key code.


Customizing interactivity action key bindings

Currently, the supported actions to be customized are enter and exit, which defaults to spacebar and esc respectively.

You can configure this under the Advanced Player Directives (Screen configuration→ Advanced → Customization → Advanced Player Directives) using a directive of this type:

custom_keyboard_configuration={"enter": [30, 31], "exit": [37, 38]}

In this example, the enter keys implement action A(30) and S(31), and the exit keys implement action K(37), L(38).