1

我在启用了EGLFS QPA的Ubuntu 16.04.3 LTS上构建Qt-5.9.2

我切换到Ctrl+Alt+F1屏幕上的终端。然后我运行我的Qt应用程序app(如果重要,基于Qt Quick):

# to debug input
export QT_LOGGING_RULES=qt.qpa.input=true
# to be able to close by Ctrl+C my application
export QT_QPA_ENABLE_TERMINAL_KEYBOARD=1
~/app -platform eglfs

到目前为止一切顺利:它正常启动,一切看起来都很好。但是Qt不处理触摸屏和鼠标输入。调试输出:

debug: libinput: opening input device '/dev/input/event1' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event1'.
debug: libinput: opening input device '/dev/input/event2' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event2'.
debug: libinput: opening input device '/dev/input/event0' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event0'.
debug: libinput: opening input device '/dev/input/event8' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event8'.
debug: libinput: opening input device '/dev/input/event3' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event3'.
debug: libinput: opening input device '/dev/input/event4' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event4'.
debug: libinput: opening input device '/dev/input/event7' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event7'.
debug: libinput: opening input device '/dev/input/event5' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event5'.
debug: libinput: opening input device '/dev/input/event6' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event6'.
debug: libinput: opening input device '/dev/input/event9' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event9'.
debug: libinput: opening input device '/dev/input/event10' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event10'.
debug: libinput: opening input device '/dev/input/event11' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event11'.
debug: libinput: opening input device '/dev/input/event12' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event12'.
debug: libinput: opening input device '/dev/input/event13' failed (Operation not permitted).
debug: libinput: failed to create input device '/dev/input/event13'.
debug: Using xkbcommon for key mapping

然后我按Ctrl+C

下一步是检查设备文件的文件权限:

$ ll /dev/input/event*
crw-rw---- 1 root input 13, 64 ноя  8 17:53 /dev/input/event0
crw-rw---- 1 root input 13, 65 ноя  8 17:53 /dev/input/event1
crw-rw---- 1 root input 13, 74 ноя  8 17:53 /dev/input/event10
crw-rw---- 1 root input 13, 75 ноя  8 17:53 /dev/input/event11
crw-rw---- 1 root input 13, 76 ноя  8 17:53 /dev/input/event12
crw-rw---- 1 root input 13, 77 ноя  8 17:53 /dev/input/event13
crw-rw---- 1 root input 13, 66 ноя  8 17:53 /dev/input/event2
crw-rw---- 1 root input 13, 67 ноя  8 17:53 /dev/input/event3
crw-rw---- 1 root input 13, 68 ноя  8 18:38 /dev/input/event4
crw-rw---- 1 root input 13, 69 ноя  8 17:53 /dev/input/event5
crw-rw---- 1 root input 13, 70 ноя  8 17:53 /dev/input/event6
crw-rw---- 1 root input 13, 71 ноя  8 18:38 /dev/input/event7
crw-rw---- 1 root input 13, 72 ноя  8 17:53 /dev/input/event8
crw-rw---- 1 root input 13, 73 ноя  8 17:53 /dev/input/event9

好的。我决定将当前用户添加到组input

sudo usermod -a -G input $USER

然后我在Ctrl+Alt+F1屏幕上重新登录。现在groups命令的输出包含input组。

我再次尝试运行我的应用程序:

~/app -platform eglfs

现在它正确地对鼠标和触摸屏输入事件做出反应,但没有呈现字体 - 甚至没有正确大小的矩形作为占位符而不是相应的字母。

我从组中删除用户input

sudo deluser $USER input

然后(重新登录后)我尝试只更改输入设备的文件权限:

sudo chmod o=g /dev/input/event*

效果是一样的。回滚:

sudo chmod o= /dev/input/event*

这种行为的原因是什么?

为什么我不能同时使用libinput和字体?

解决方法是使用 root 权限运行应用程序,但这可能会导致严重的安全漏洞。

是否有libinput解决问题的特定设置?

提供 ad-hoc 字体也没有效果:

wget https://github.com/dejavu-fonts/dejavu-fonts/releases/download/version_2_37/dejavu-fonts-ttf-2.37.tar.bz2
sudo mkdir -p /usr/local/Qt-5.9.2/lib/fonts
sudo tar --extract --verbose --strip-components=2 -C /usr/local/Qt-5.9.2/lib/fonts --file dejavu-fonts-ttf-2.37.tar.bz2 dejavu-fonts-ttf-2.37/ttf/
export QT_QPA_FONTDIR=/usr/local/Qt-5.9.2/lib/fonts
4

1 回答 1

0

作为一个错误提交。通过添加到input组和删除QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);标志来解决。

于 2017-11-09T15:52:43.400 回答