Keyboard issues
-
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.
-
I don't understand how to use the native eglfs feature to catch the keyboard. Please, could you put me on the right way?
-
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 -
-
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
-
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!
-
Did you specify the exact device to use as a keyboard ?
-
Did you check whether you have the rights to access that device ?
-
Then call your application with QT_DEBUG_PLUGINS=1 set, you'll see if there's something happening with the plugins.
-
Can you show your configuration and the command used to launch your application ?
-
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.
-
What parameters did you set on QT_QPA_EVDEV_KEYBOARD_PARAMETERS ?
-
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.
-
Are you running your application through ssh ?