Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Keyboard issues
Qt 6.11 is out! See what's new in the release blog

Keyboard issues

Scheduled Pinned Locked Moved Mobile and Embedded
16 Posts 3 Posters 8.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi,
    I'm developing with Qt 5.3, linux host and linux target (buildroot on RPi).
    Console application without X (eglfs).

    I need to handle keypress events from my Qt5 application.

    1. I don't understand how to use the native eglfs feature to catch the keyboard. Please, could you put me on the right way?

    2. I tried a workaround using getch from ncurses in a separate thread and it works, but only from the same terminal the application is launched from. It's ok, but I can't send key from QtCreator. How to?

    Thanks!
    Mark

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      eglfs is only handles the graphic part, you'll need to use e.g. the evdev plugin for your keyboard. More about this "here":http://doc.qt.io/qt-5/embedded-linux.html

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Hi,
        I've already read that document but still I cannot get it works.

        I export QT_QPA_EVDEV_KEYBOARD_PARAMETERS='grab=1', then I create my CoreApp class upon QCoreApplication. Here I reimplement the virtual bool event(QEvent *e).

        But no events are generated while pressing keys on the keyboard.

        Surely I'm missing something!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Did you specify the exact device to use as a keyboard ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            I think is not necessary because there is only one input device: the keyboard itself.

            Anyway I tried to set that env var to '/dev/input/input0;grab=1' with no chance.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Did you check whether you have the rights to access that device ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                Yes I did. Currently, I'm running the application as root to avoid any problem related to the rights.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Then call your application with QT_DEBUG_PLUGINS=1 set, you'll see if there's something happening with the plugins.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #9

                    Setting QT_DEBUG_PLUGINS=1 leads to no warnings nor messages. The pressed keys are still sent to the console.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Can you show your configuration and the command used to launch your application ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #11

                        It's a Raspberry Pi Model B+ running a linux buildroot o.s.:

                        @

                        uname -a

                        Linux rpi 3.12.26 #1 PREEMPT Thu Oct 2 20:45:27 CEST 2014 armv6l GNU/Linux
                        @

                        Here the command I use to launch my application:

                        @
                        ./myapp
                        @

                        I also tried:

                        @
                        ./myapp < /dev/tty1
                        @

                        Even with the QT_QPA_EVDEV_KEYBOARD_PARAMETERS variable set, when I hit any key on the keyboard it will show the char on the console, instead of being grabbed by the application. I.e. no QCoreApplication::event() is emitted.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          What parameters did you set on QT_QPA_EVDEV_KEYBOARD_PARAMETERS ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #13

                            As I said in a previous post I tried the following:

                            @
                            export QT_QPA_EVDEV_KEYBOARD_PARAMETERS=‘grab=1’
                            export QT_QPA_EVDEV_KEYBOARD_PARAMETERS=‘/dev/input/input0;grab=1’
                            @

                            Anyway the keyboard is the only input device available and also the only USB device connected.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              Are you running your application through ssh ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • ? Offline
                                ? Offline
                                A Former User
                                wrote on last edited by
                                #15

                                The behavior is the same if either I launch the application through ssh or locally.

                                1 Reply Last reply
                                0
                                • Halo_HaoH Offline
                                  Halo_HaoH Offline
                                  Halo_Hao
                                  wrote on last edited by
                                  #16

                                  run:cat /proc/bus/input/devices

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved