0

I need to remotely control a Qt / QML application on an embedded ARM instrument. I intended to do that using VNC. This doesn't work. An USB keyboard plugged in the instrument doesn't work either.

NB: Normally this application is controlled by the hard keys on the instrument connected to GPIO and converted through custom application code to send Qt events:

QCoreApplication::postEvent(..., new QKeyEvent(QEvent::KeyPress, ...));

Now, I'm trying to send keys remotely using VNC. To test the remote session, I type the following command on the instrument console:

x11vnc -rawfb map:/dev/fb0@800x480x32 -forever -rotate -90 -dk

After getting a Wifi connection between my Linux PC and the instrument (whose IP address is 192.168.1.1), I type the following command on my Linux PC:

gvncviewer 192.168.1.1:0

I do see the screen of the instrument correctly displayed on my PC in a window with the right geometry, color, and orientation...

BUT...

My Qt application doesn't care about the key strokes. It doesn't seem to receive any keyboard event.

More context: the Qt application is started on the instrument using a systemd service. I tried to attach the systemd service to a TTY so it would have a stdin.. The service looks like this:

[Unit]
Description=Instrument IHM
After=network.target

[Service]
StandardInput=tty-force
StandardOutput=tty
StandardError=tty
TTYPath=/dev/tty0
Restart=always
ExecStartPost=/path/to/my_application --platform linuxfb:fb=/dev/fb0:rotation=90 -plugin evdevkeyboard:/dev/input/event0
Restart=on-failure
RestartSec=2s

[Install]
WantedBy=multi-user.target

When I type the keys corresponding to the instrument's hardkeys on my VNC client, the VNC server on the instrument receives correctly the keyboard events, as shown by this extract of the logs of the VNC server:

05/03/2024 09:17:23 Using tight encoding for client 192.168.1.10
05/03/2024 09:17:24 Sending rfbEncodingExtDesktopSize for size (480x800) 
05/03/2024 09:17:24 client 1 network rate 119.5 KB/sec (6395.0 eff KB/sec)
05/03/2024 09:17:24 client 1 latency:  0.9 ms
05/03/2024 09:17:24 dt1: 0.0575, dt2: 0.1834 dt3: 0.0009 bytes: 28741
05/03/2024 09:17:24 link_rate: LR_BROADBAND - 1 ms, 119 KB/s
05/03/2024 09:17:24 client_set_net: 192.168.1.10  0.0066
05/03/2024 09:17:30 # keyboard(down, 0xff54 "Down") uip=0  14.6279
05/03/2024 09:17:31 # keyboard(up, 0xff54 "Down") uip=0  14.7875
05/03/2024 09:17:32 # keyboard(down, 0xff52 "Up") uip=0  15.7994
05/03/2024 09:17:32 # keyboard(up, 0xff52 "Up") uip=0  15.8880
05/03/2024 09:17:32 # keyboard(down, 0x20 "space") uip=0  16.6078
05/03/2024 09:17:33 # keyboard(up, 0x20 "space") uip=0  16.6684
05/03/2024 09:17:33 # keyboard(down, 0xff1b "Escape") uip=0  17.5182
05/03/2024 09:17:33 # keyboard(up, 0xff1b "Escape") uip=0  17.5997
05/03/2024 09:17:34 # keyboard(down, 0xff0d "Return") uip=0  18.3625
05/03/2024 09:17:34 # keyboard(up, 0xff0d "Return") uip=0  18.4278

But still my Qt application doesn't care.

3
  • 1
    I was going to write some answer but e2e.ti.com/support/processors-group/processors/f/… seems like it's discussing the exact same thing, so I'll just point out that the ExecStart "evdev..." part of your command specifically tells your program to read events from that single device and nowhere else... Commented Mar 6 at 6:29
  • Thanks for your comment and the reference to this forum post. I'm experimenting with this (after tweaking some more my kernel defconfig) Commented Mar 6 at 9:58
  • Just so people with the same problem know, I made it work, using the post mentioned in the comment above, along with this post: forum.qt.io/topic/65397/… Hope it helps. Commented Mar 7 at 9:45

1 Answer 1

1

In the kernel, you need to activate:

  • CONFIG_INPUT_UINPUT=y
  • CONFIG_INPUT_EVDEV=y

Once activated, you must launch vnc this way:

x11vnc -rawfb /dev/fb0 -pipeinput UINPUT:direct_abs=/dev/uinput

And it should work! (be carefull, your app and vnc must be launched from the same session)

Not the answer you're looking for? Browse other questions tagged or ask your own question.