Block send of keyboard input to terminal on embedded app (Raspberry Pi 3)
-
wrote on 26 Jan 2018, 11:12 last edited by Emerson Siega
Hello
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.
/etc/bash.bashrc:
QT_QPA_ENABLE_TERMINAL_KEYBOARD=0 QT_QPA_EVDEV_KEYBOARD_PARAMETERS=grab=1
If someone knows how to fix this, I will be very thankful.
-
Hello
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.
/etc/bash.bashrc:
QT_QPA_ENABLE_TERMINAL_KEYBOARD=0 QT_QPA_EVDEV_KEYBOARD_PARAMETERS=grab=1
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?
-
@Emerson-Siega Can't you put this in bash.bashrc of that user?
wrote on 26 Jan 2018, 11:59 last edited by@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. -
Hi,
Do you have any use of the keyboard for your application ?
-
wrote on 29 Jan 2018, 10:27 last edited by
@SGaist Hello,
Yes, basically all interaction come from keyboard input.
Disable this input to terminal it's a security issue... -
IIRC, in
/etc/init/
, you can find the tty related configuration. If you disable them, you shouldn't be able to access the tty. -
IIRC, in
/etc/init/
, you can find the tty related configuration. If you disable them, you shouldn't be able to access the tty.wrote on 1 Feb 2018, 11:47 last edited by@SGaist Thanks for your help.
I'll take a look at that and then I will post the result here. -
wrote on 21 Jan 2019, 16:50 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
I think
sudo
is needed because of what documentation says about/dev/input/event*
permissions. Also-E
option is needed so that sudo preserves the exported variables.I hope this help.
Input
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
Note that
export QT_QPA_EGLFS_NO_LIBINPUT=1
is necessary so Qt's ownevdev
handlers come in to play and consequentlyQT_QPA_EVDEV*
options take into account. That is what I could verify.Using libinput
... If libinput support is not available or the environment variableQT_QPA_EGLFS_NO_LIBINPUT
is 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
orSUDO -E
, since the directory/dev/input/event*
has read/write permissions for the'input'
group and my user is part of that group.Regards!
-
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
I think
sudo
is needed because of what documentation says about/dev/input/event*
permissions. Also-E
option is needed so that sudo preserves the exported variables.I hope this help.
Input
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
Note that
export QT_QPA_EGLFS_NO_LIBINPUT=1
is necessary so Qt's ownevdev
handlers come in to play and consequentlyQT_QPA_EVDEV*
options take into account. That is what I could verify.Using libinput
... If libinput support is not available or the environment variableQT_QPA_EGLFS_NO_LIBINPUT
is 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
orSUDO -E
, since the directory/dev/input/event*
has read/write permissions for the'input'
group and my user is part of that group.Regards!
wrote on 22 Jan 2019, 10:49 last edited byThis post is deleted!