Important: Please read the Qt Code of Conduct -

Block send of keyboard input to terminal on embedded app (Raspberry Pi 3)

  • 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.



    If someone knows how to fix this, I will be very thankful.

  • Qt Champions 2019

    @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.

  • Lifetime Qt Champion


    Do you have any use of the keyboard for your application ?

  • @SGaist Hello,

    Yes, basically all interaction come from keyboard input.
    Disable this input to terminal it's a security issue...

  • Lifetime Qt Champion

    IIRC, in /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.

  • Hi, it works for me with:


    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.

    Qt for Embedded Linux

    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_WIDTH=1024
    export QT_QPA_EGLFS_HEIGHT=614

    Note that export QT_QPA_EGLFS_NO_LIBINPUT=1 is necessary so Qt's own evdev handlers come in to play and consequently QT_QPA_EVDEV* options take into account. That is what I could verify.

    Qt for Embedded Linux

    Using libinput
    ... If libinput support is not available or the environment variable QT_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 or SUDO -E, since the directory /dev/input/event* has read/write permissions for the 'input' group and my user is part of that group.


  • This post is deleted!

Log in to reply