我在嵌入式设备上遇到了一个奇怪的问题。当我运行qt5 时
someQt5App -platform eglfs -plugin tslib
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
EGLFS: Unable to query physical screen size, defaulting to 100 dpi.
EGLFS: To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
QTsLibMouseHandler "tslib" ""
Loading module /usr/lib/ts//input.so
Loading module /usr/lib/ts//pthres.so
Couldnt load module pthres
Error configuring
: No such file or directory
所以这首先让我觉得没有pthres.So,但确实有,我检查了一下。我认为pthres无法正确加载,我不知道为什么。我有一些strace输出
write(1, "Loading module /usr/lib/ts//pthr"..., 38) = 38
open("/usr/lib/ts//pthres.so", O_RDONLY|O_CLOEXEC) = 13
read(13, "177ELF111 3 ( 1 p5 004 "..., 512) = 512
fstat64(13, {st_mode=S_IFREG|0755, st_size=3940, ...}) = 0
mmap2(NULL, 35424, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 13, 0) = 0x2aae4000
mprotect(0x2aae5000, 28672, PROT_NONE) = 0
mmap2(0x2aaec000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 13, 0) = 0x2aaec000
close(13) = 0
munmap(0x2aae4000, 35424) = 0
write(2, "Couldnt load module pthresn", 27) = 27
close(12) = 0
munmap(0x2aae0000, 4096) = 0
write(2, "Error configuringn: No such file"..., 46) = 46
write(5, "1 ", 8) = 8
所以在这里我可以看到模块加载了,无论出于什么原因都关闭了,我不确定它为什么关闭。
Pthres可用
# ls -l /usr/lib/ts/pthres.so
-rwxr-xr-x 1 root root 3940 Feb 24 2014 /usr/lib/ts/pthres.so
仅供参考,我移动了pthres,这是尝试的strace
write(1, "Loading module /usr/lib/ts//pthr"..., 38) = 38
open("/usr/lib/ts//pthres.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, "Couldnt load module pthresn", 27) = 27
close(12) = 0
munmap(0x2abaa000, 4096) = 0
write(2, "Error configuringn: No such file"..., 46) = 46
设备环境(与qt4/qws一起使用)
# env
TSLIB_TSDEVICE=/dev/input/event2
USER=root
OLDPWD=/
HOME=/
PAGER=/usr/bin/less
TERM=vt102
PATH=/sbin:/usr/sbin:/bin:/usr/bin
TSLIB_CONFFILE=/etc/ts.conf
MANPAGER=/usr/bin/less
SHELL=/bin/sh
PWD=/usr/lib/ts
TZ=US/Eastern
POINTERCAL_FILE=/thermo/pointercal
TSLIB_CALIBFILE=/thermo/pointercal
发现,tslib的错误具有误导性。这是一个与pthres的链接错误,某个地方有人对此进行了修补。
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index c54a690..4aedac2 100644
@@ -107,15 +107,19 @@ pluginexec_LTLIBRARIES =
variance_la_SOURCES = variance.c
variance_la_LDFLAGS = -module $(LTVSN)
+variance_la_LIBADD = $(top_builddir)/src/libts.la
dejitter_la_SOURCES = dejitter.c
dejitter_la_LDFLAGS = -module $(LTVSN)
+dejitter_la_LIBADD = $(top_builddir)/src/libts.la
linear_la_SOURCES = linear.c
linear_la_LDFLAGS = -module $(LTVSN)
+linear_la_LIBADD = $(top_builddir)/src/libts.la
pthres_la_SOURCES = pthres.c
pthres_la_LDFLAGS = -module $(LTVSN)
+pthres_la_LIBADD = $(top_builddir)/src/libts.la
# hw access
corgi_la_SOURCES = corgi-raw.c
您可以像Kevin提到的那样修改makpile.am,也可以运行下面的命令并运行您的应用程序,而不需要任何提示。
export LD_PRELOAD=/usr/lib/libts-x.x.so.x.x.x
其中x是您正在使用的tslib的版本