1.下载源码
git clone https://github.com/libts/tslib.git
2.安装其他工具
sudo apt-get install automake
sudo apt-get install autogen autoconf
sudo apt install automake libtool m4 autoconf
3.进入目录,配置
ubuntu@ubuntu:~/Downloads/tslib$ ./autogen.sh
报错
configure.ac:64: error: possibly undefined macro: AC_DISABLE_STATIC
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:65: error: possibly undefined macro: AC_ENABLE_SHARED
configure.ac:66: error: possibly undefined macro: AC_LIBTOOL_DLOPEN
configure.ac:67: error: possibly undefined macro: AC_PROG_LIBTOOL
configure:5988: error: possibly undefined macro: AC_MSG_ERROR
autoreconf: /usr/bin/autoconf failed with exit status: 1
解决
sudo cp /usr/share/aclocal/*.m4 /usr/local/share/aclocal/
原因
一般通过apt-get安装的软件都会在/usr目录下,既然提示无法找到AC_PROG_LIBTOOL,那么分析一般有两个原因:
1.安装包失败或者其他原因比如版本问题导致没有定义AC_PROG_LIBTOOL;
2.寻找路径有问题。
从这两点出发,可以在/usr目录下全局查找AC_PROG_LIBTOOL
可以看到在m4文件中能找到AC_PROG_LIBTOOL,那么就可能是路径问题;
大多数m4文件都在/usr/share/aclocal/目录下,但实际上configure的默认aclocal路径为/usr/local/share/aclocal,
那么可以有两种方法,
第一,将/usr/share/aclocal/下的*.m4文件都拷贝到usr/local/share/aclocal/目录下;
第二,指定aclocal的安装路径;
sudo cp /usr/share/aclocal/*.m4 /usr/local/share/aclocal/
再次./autogen.sh,就通过了。
此处参考报错"configure.ac: error: possibly undefined macro"的解决方案 - 朱果果 - 博客园 (cnblogs.com)
重新 ./autogen.sh
4.配置
./configure --host=mips64el-linux --cache-file=arm-linux.cache --prefix=/opt/tslib/
5.编译安装
sudo make -j8
sudo make install -j8
6.拷贝生成的整个文件夹到开发板/usr目录下
7.配置开发板环境
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_CONFFILE=/usr/tslib/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/tslib/lib/ts
export TSLIB_CALIBFILE=/etc/pointercal
7.11
1.进入目录,ts.conf拷贝之开发板/etc下
# cd tslib
# ls
bin etc include lib share
# cd etc
# ls
ts.conf
# vi ts.conf
# cp ts.conf /etc2.进入lib目录除pkgconfig,全部拷贝到开发板/lib下# cd tslib
# ls
bin etc include lib share
# cd lib
# ls
libts.la libts.so.0 pkgconfig
libts.so libts.so.0.10.4 ts
# cp libts.la /lib
# cp libts.so.0 /lib
# cp libts.so /lib
# cp libts.so.0.10.4 /lib
# cp -R ts/ /lib
#
配置文件/etc/profile修改为
#export TSLIB_TSDEVICE=/dev/input/touchscreen0
#export TSLIB_CONFFILE=/etc/ts.conf
#export TSLIB_PLUGINDIR=/lib/ts#export TSLIB_CALIBFILE=/etc/pointercal
#export TSLIB_CONSOLEDEVICE=none
#export TSLIB_FBDEVICE=/dev/fb0
有报错,但因为手边没有触摸屏,暂时不能继续下去
8.关于鼠标键盘的支持
cat/dev/input/event0 回车后按键盘终端有反应则键盘对应这个设备,鼠标同理
在/etc/profile中添加
export QT_QPA_GENERIC_PLUGINS=tslib,evdevkeyboard:/dev/input/event0,evdevmouse:/dev/input/mouse0
以此支持鼠标键盘
如有报错No such plugin for spec "tslib"
,则修改为
export QT_QPA_GENERIC_PLUGINS=evdevkeyboard:/dev/input/event0,evdevmouse:/dev/input/mouse0