Inputs on an Embedded Linux Device▲
On your Embedded Linux device, when there's no windowing system present, the mouse, keyboard, and touch input are read directly via evdev or using helper libraries such as libinput or tslib. However, this behavior requires that device nodes /dev/input/event* are readable by the user. eglfs and linuxfb have all the input handling code compiled-in.
Use libinput▲
libinput is a library to handle input devices that offers an alternative to the Qt's own evdev input support. To enable using libinput, when you configure and build Qt, make sure that the development files for libudev and libinput are available. If you require keyboard support, then xkbcommon is also necessary. With eglfs and linuxfb, no further actions are necessary as these plugins use libinput by default. If libinput support is not available or the QT_QPA_EGLFS_NO_LIBINPUT environment variable is set, then Qt's own evdev handlers are used instead.
Input on eglfs and linuxfb without libinput▲
Parameters like the device node name can be set in the QT_QPA_EVDEV_MOUSE_PARAMETERS, QT_QPA_EVDEV_KEYBOARD_PARAMETERS and QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS environment variables; separate your entries with colons. These parameters are an alternative to passing the settings in the -plugin command-line argument, and with some backends they are essential. But eglfs and linuxfb use built-in input handlers so there's no separate -plugin argument in use.
Additionally, the built-in input handlers can be disabled by setting QT_QPA_EGLFS_DISABLE_INPUT (for eglfs) or QT_QPA_FB_DISABLE_INPUT (for linuxfb) to 1.
Mouse▲
The mouse cursor shows up whenever QT_QPA_EGLFS_HIDECURSOR (for eglfs) or QT_QPA_FB_HIDECURSOR (for linuxfb) isn't set and Qt's libudev-based device discovery reports that at least one mouse is available. When libudev support is not present, the mouse cursor is always displayed; unless it's explicitly disabled via the environment variable.
If Qt was configured with libudev support, connecting or disconnecting an input device while the application is running (hot plugging) is supported. Then libudev development headers are present in the sysroot at configure time.
The evdev mouse handler supports the following extra parameters:
Parameter |
Description |
---|---|
/dev/input/... |
Specifies the name of the input device. If unspecified, Qt looks for a suitable device either via libudev or by traversing the available nodes. |
nocompress |
By default, input events that don't lead to changing the position compared to the last Qt mouse event are compressed. A new Qt mouse event is sent only after a change in the position or button state. To disable this behavior, set the nocompress parameter. |
dejitter |
Specifies a jitter limit; disabled by default. |
grab |
When set to 1, Qt grabs the device for exclusive use. |
abs |
Some touchscreens report absolute coordinates and can't be differentiated from touchpads. In this case, pass abs to indicate that the device is using absolute events. |
Keyboard▲
The evdev keyboard handler supports the following extra parameters:
Parameter |
Description |
---|---|
/dev/input/... |
Specifies the name of the input device. If unspecified, Qt looks for a suitable device either via libudev or by traversing the available nodes. |
grab |
Enables grabbing the input device. |
keymap |
Specifies the name of a custom keyboard map file. |
enable-compose |
Enables compositing. |
repeat-delay |
Sets a custom key repeat delay. |
repeat-rate |
Sets a custom key repeat rate. |
On Embedded Linux systems that don't have their terminal sessions disabled, the behavior on a key press can be confusing, as the input event is processed by the Qt application and the tty. To overcome this, the following options are available:
-
On application startup, EGLFS and LinuxFB attempt to disable the terminal keyboard by setting the tty's keyboard mode to K_OFF. This prevents keystrokes from being sent to the terminal. If the standard behavior is required, set the QT_QPA_ENABLE_TERMINAL_KEYBOARD environment variable to 1. Note that this works only when the application is launched from a remote console, via ssh for example, and the terminal keyboard input remains enabled.
-
An alternative approach is to use the evdev keyboard handler's grab parameter by passing grab=1 in QT_QPA_EVDEV_KEYBOARD_PARAMETERS. This results in trying to get a grab on the input device. If the grab is successful, no other components in the system receive events from it, as long as the Qt application is running. This approach is more suitable for applications that start remotely as it doesn't need access to the tty device.
-
Finally, for many specialized Embedded Linux images it doesn't make sense to have the standard terminal sessions enabled in the first place. For more details on how to disable these terminal sessions, refer to your build environment's Documentation. For example, when generating images using the Yocto Project, unsetting SYSVINIT_ENABLED_GETTYS results in having no getty process running. This means, there's no input on any of the virtual terminals.
If the default built-in keymap is not suffi