简体   繁体   中英

Qt - Capturing QKeyEvent from /dev/input/event1 in embedded linux device (EGLFS)

I'm trying to get QKeyEvents on keypress/keyrelease on linux embedded device( EGLFS ) which uses custom keypad. /dev/input/event1 is the keyevent file.

With evtest the output is as expected. But in the Qt application running on EGLFS platform, the eventfilter detects the event type as QEvent::SockAct whenever key is pressed/released on custom keypad. The expected event type is QEvent::KeyPress/QEvent::KeyRelease which I'm not able to get.

I've tried setting the below environment variables ,

QT_QPA_EVDEV_KEYBOARD_PARAMETERS=/dev/input/event1;grab=1 QT_QPA_GENERIC_PLUGINS=evdevmouse,evdevkeyboard
QT_QPA_PLATFORM=eglfs
QT_QPA_EGLFS_DISABLE_INPUT = 1

Before setting these variables, I wasn't able to get any event on key press/release. But after setting these, it is detected as QEvent::SockAct.

Please suggest what needs to be set to get QKeyEvent on key press/release. Qt Version 5.14 running on embedded linux.

I have never programmed for any embedded platform, but I found that QEvent::SockAct is the event that occurs when

Socket activated, (and it's) used to implement QSocketNotifier .

And that

The QSocketNotifier class provides support for monitoring activity on a file descriptor.

here

I suppose that if you open() /dev/input/event1 you will get this file descriptor. I know I didn't provide a full solution, but as I said I have never done this kind of programming.

input was read by /dev/input/event not by qt app, what worked for me,

try exporting the variable thru script QT_QPA_GENERIC_PLUGINS = evdevkeyboard, then LD_LIBRARY_PATH=./ binNAme -platform linuxfb

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM