When no windowing system is present,
the mouse, keyboard and touch input are
read directly via
evdev or using helper libraries like
Note that this requires that devices nodes
/dev/input/event* are readable by the user.
eglfs and linuxfb has all the evdev input handling code built-in.
Input on eglfs and linuxfb
Parameters like the device node name can be set in the environment variables
QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS. Additionally, the built-in input handlers can be disabled by setting
1. On some touch screens the coordinates will need to be rotated. This can be enabled by setting
The mouse cursor will show up whenever
QT_QPA_EGLFS_HIDECURSOR (for eglfs) or
QT_QPA_FB_HIDECURSOR (for linuxfb)
is not 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 will always show up unless explicitly disabled via the environment variable.
Hot plugging is supported, but only if Qt was configured with libudev support (that is, if the libudev development headers are present in the sysroot at configure time). This allows connecting or disconnecting an input device while the application is running.
The evdev keyboard handler supports the following extra parameters:
/dev/input/...- Specifies the name of the input device. When not given, Qt will look for a suitable device either via libudev or by walking through 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 do not have their terminal sessions disabled, the behavior when pressing a key can be confusing due to having the input event processed both by the Qt application and the tty. To overcome this, the following options are available:
LinuxFB and KMS attempt to disable the terminal keyboard on application startup by setting the tty's keyboard mode to
K_OFF. This prevents keystrokes from going to the terminal. If the standard behavior needs to be restored for some reason, set the environment variable
1. Note that this will not work when the application is launched from a remote console (for example, via
ssh) and the terminal keyboard input will remain enabled.
- An alternative approach is to use the evdev keyboard handler's
grabparameter by passing grab=1 in
QT_QPA_EVDEV_KEYBOARD_PARAMETERS. This results in trying to get a grab on the input device which, if successful, means that 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 started remotely as it does not need access to the tty device.
- Finally, for many specialized Embedded Linux images it will not make sense to have the standard terminal sessions enabled in the first place. Refer to your build environment's documentation on how to disable them. For example, when generating images using
the Yocto Project, unsetting
SYSVINIT_ENABLED_GETTYSwill result in having no
gettyprocess running, and thus no input, on any of the virtual terminals.
If the default, built-in keymap is not sufficient, a different one can be specified either via the
keymap parameter or by using the eglfs-specific
loadKeymap() function. The latter allows switching the keymap at runtime. Note however that this requires using eglfs' built-in keyboard handler; it is not supported when the keyboard handler is loaded via the
-plugin command-line parameter.
Note: Special system key combinations, such as console switching (Ctrl+Alt+Fx) or zap (Ctrl+Alt+Backspace) are not currently supported and will get ignored.
To generate a custom keymap, the kmap2qmap utility can be used. This can be found in the
qttools module. The source files have to be in standard Linux
kmap format that is e.g. understood by the kernel's
loadkeys command. This means one can use the following sources to generate
- The Linux Console Tools (LCT) project.
- Xorg X11 keymaps can be converted to the
kmapformat with the
kmapfiles are plain text files, they can also be hand crafted.
kmap2qmap is a command line program, that needs at least 2 files as parameters. The last one will be the generated
.qmap file, while all the others will be parsed as input
.kmap files. For example:
kmap2qmap i386/qwertz/de-latin1-nodeadkeys.kmap include/compose.latin1.inc de-latin1-nodeadkeys.qmap
kmap2qmap does not support all the (pseudo) symbols that the Linux kernel supports. When converting a standard keymap, a number of warnings will be shown regarding
Hex_A, and so on; these messages can safely be ignored.
For some resistive, single-touch touch screens it may be necessary to fall back to using tslib instead of relying on the Linux multitouch protocol and the event devices. For modern touch screens this should not be necessary. tslib support can be enabled
by setting the environment variable
QT_QPA_FB_TSLIB to 1. To change the device, set the environment variable
TSLIB_TSDEVICE or pass the device name on the command-line. Note that the tslib input handler generates mouse events and supports single touch only, as opposed to evdevtouch which generates true multi-touch
QTouchEvent events too.