Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Block send of keyboard input to terminal on embedded app (Raspberry Pi 3)
Emerson Siega last edited by Emerson Siega
I have an embedded app (Qt 5.7) running on Raspbian Lite, with parameter
-platform linuxfb. All keyboard input is send to terminal and allow an expert user to close the application and get access to the terminal, for instance. I need to block this behavior.
With the environment variables bellow, I can do what I want, but, only works if the app is running with root user, and I do not want this. There is a specific user, with the right privileges to run the application.
If someone knows how to fix this, I will be very thankful.
@Emerson-Siega Can't you put this in bash.bashrc of that user?
@jsulm Thank's for your answer!
Yes, I already tried this, but doesn't work.
I tried to put this on command line when run the app, but failed too.
Do you have any use of the keyboard for your application ?
Yes, basically all interaction come from keyboard input.
Disable this input to terminal it's a security issue...
/etc/init/, you can find the tty related configuration. If you disable them, you shouldn't be able to access the tty.
@SGaist Thanks for your help.
I'll take a look at that and then I will post the result here.
Francisco01 last edited by Francisco01
Hi, it works for me with:
export QT_QPA_EVDEV_KEYBOARD_PARAMETERS=grab=1 export QT_QPA_EVDEV_MOUSE_PARAMETERS=grab=1
and running with:
sudo -E ./myapp -platform eglfs
sudois needed because of what documentation says about
-Eoption is needed so that sudo preserves the exported variables.
I hope this help.
When no windowing system is present, the mouse, keyboard, and touch input are read directly via evdev or using helper libraries such as libinput or tslib. Note that this requires that device nodes /dev/input/event* are readable by the user. eglfs and linuxfb have all the input handling code compiled-in.
I want to share additional information about my previous post:
This is the list of exports with which I prevent that the mouse and keyboard events were passed to the terminal and the X11 system from my app:
export QT_QPA_EGLFS_PHYSICAL_WIDTH=155 export QT_QPA_EGLFS_PHYSICAL_HEIGHT=86 export QT_QPA_EGLFS_WIDTH=1024 export QT_QPA_EGLFS_HEIGHT=614 export QT_QPA_EVDEV_KEYBOARD_PARAMETERS=grab=1 export QT_QPA_EVDEV_MOUSE_PARAMETERS=grab=1 export QT_QPA_EGLFS_NO_LIBINPUT=1
export QT_QPA_EGLFS_NO_LIBINPUT=1is necessary so Qt's own
evdevhandlers come in to play and consequently
QT_QPA_EVDEV*options take into account. That is what I could verify.
... If libinput support is not available or the environment variable
QT_QPA_EGLFS_NO_LIBINPUTis set, Qt's own evdev handlers come in to play.
Also, as a comment, I tried this configuration, first with a mouse and keyboard controlled with a same USB (Logitech) and like that: the keyboard worked correctly but not the mouse. So I decided to try with independent mouse and keyboard, and now both (mouse & keyboard) work correctly.
Nor do I have to run my application with
SUDO -E, since the directory
/dev/input/event*has read/write permissions for the
'input'group and my user is part of that group.
Francisco01 last edited by
This post is deleted!