玩转mini2440开发板之【在Ubuntu 14.04下编译安装tslib 1.4版本】

版权声明:个人心得,欢迎来信来函交流。转载请注明出处! https://blog.csdn.net/LEON1741/article/details/82113425

今天在研究mini2440的QT程序时,发现缺少tslib,于是想办法安装。

一开始想直接去tslib官网上下载最新版本的,但是编译时发现无法通过,于是只好按照大多数网友的做法,取了一个最成熟最稳定的版本(1.4版)来使用。步骤记录如下:

1、准备工作

首先执行以下命令,确认tslib所需的各个库都已正常安装。

# apt-get install autoconf
# apt-get install automake
# apt-get install libtool

2、下载源码

这里我使用的是CSDN网友上传的版本,经测试在我本人的开发环境下(64位Ubuntu 14.04)是可用的,大家自行下载即可(https://download.csdn.net/download/devil_box/9544319)。

3、配置编译

下载完后解压,进入该目录,按顺序执行以下命令:

./autogen-clean.sh
./autogen.sh
./configure --host=arm-linux ac_cv_func_malloc_0_nonnull=yes --cache-file=arm-linux-.cache --prefix=/usr/local/tslib/
make
sudo make install

注1:“–host=arm-linux”语句的作用就是指定目标系统的编译器。因为我使用的是友善之臂官方发布的arm-linux-gcc 4.4.3,安装在/opt/FiendyARM/toolschain目录下,且已加入了环境变量,所以这里可以使用这个语句进行定义。

注2、”–prefix=/usr/local/tslib/“语句的作用是为了指定最后tslib的安装位置。查阅资料的过程中,发现部分网友将这个目录改成了别的目录,虽然最后的编译和安装都能成功,但是根据部分网络上的资料显示,会对后续的使用带来一些麻烦。因此还是建议大家老老实实的使用推荐的目录,也就是我这里使用的这个目录(/usr/local/tslib/)。

注3:这里记录一下我的配置和编译过程,以便有需要的同学可以参考:

3.1、清理

leon@Ubuntu:~/tslib$ ./autogen-clean.sh 
Removing autogenned files...
Done.

3.2、生成

leon@Ubuntu:~/tslib$ ./autogen.sh 
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in `m4/internal'.
libtoolize: copying file `m4/internal/libtool.m4'
libtoolize: copying file `m4/internal/ltoptions.m4'
libtoolize: copying file `m4/internal/ltsugar.m4'
libtoolize: copying file `m4/internal/ltversion.m4'
libtoolize: copying file `m4/internal/lt~obsolete.m4'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
configure.ac:19: installing './compile'
configure.ac:28: installing './config.guess'
configure.ac:28: installing './config.sub'
configure.ac:7: installing './install-sh'
configure.ac:7: installing './missing'
plugins/Makefile.am:14: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
plugins/Makefile.am: installing './depcomp'
tests/Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')

3.3、配置

leon@Ubuntu:~/tslib$ ./configure --host=arm-linux ac_cv_func_malloc_0_nonnull=yes --cache-file=arm-linux-.cache --prefix=/usr/local/tslib/
configure: creating cache arm-linux-.cache
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-strip... arm-linux-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for arm-linux-g++... arm-linux-g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether arm-linux-g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of arm-linux-g++... gcc3
checking for arm-linux-gcc... arm-linux-gcc
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gcc accepts -g... yes
checking for arm-linux-gcc option to accept ISO C89... none needed
checking whether arm-linux-gcc understands -c and -o together... yes
checking dependency style of arm-linux-gcc... gcc3
checking how to run the C preprocessor... arm-linux-gcc -E
checking whether the C compiler supports -fvisibility=hidden... yes
checking whether to use -fvisibility=hidden... yes
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by arm-linux-gcc... /opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/bin/ld
checking if the linker (/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-nm -B
checking the name lister (/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-nm -B) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to arm-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/bin/ld option to reload object files... -r
checking for arm-linux-objdump... arm-linux-objdump
checking how to recognize dependent libraries... pass_all
checking for arm-linux-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for arm-linux-ar... arm-linux-ar
checking for archiver @FILE support... @
checking for arm-linux-strip... (cached) arm-linux-strip
checking for arm-linux-ranlib... arm-linux-ranlib
checking command to parse /opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-nm -B output from arm-linux-gcc object... ok
checking for sysroot... no
checking for arm-linux-mt... no
checking for mt... mt
configure: WARNING: using cross tools not prefixed with host triplet
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if arm-linux-gcc supports -fno-rtti -fno-exceptions... no
checking for arm-linux-gcc option to produce PIC... -fPIC -DPIC
checking if arm-linux-gcc PIC flag -fPIC -DPIC works... yes
checking if arm-linux-gcc static flag -static works... yes
checking if arm-linux-gcc supports -c -o file.o... yes
checking if arm-linux-gcc supports -c -o file.o... (cached) yes
checking whether the arm-linux-gcc linker (/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... no
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... cross
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... arm-linux-g++ -E
checking for ld used by arm-linux-g++... /opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/bin/ld
checking if the linker (/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/bin/ld) is GNU ld... yes
checking whether the arm-linux-g++ linker (/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/bin/ld) supports shared libraries... yes
checking for arm-linux-g++ option to produce PIC... -fPIC -DPIC
checking if arm-linux-g++ PIC flag -fPIC -DPIC works... yes
checking if arm-linux-g++ static flag -static works... yes
checking if arm-linux-g++ supports -c -o file.o... yes
checking if arm-linux-g++ supports -c -o file.o... (cached) yes
checking whether the arm-linux-g++ linker (/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for dlopen in -ldl... (cached) yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for ANSI C header files... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for size_t... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking whether arm-linux-gcc needs -traditional... no
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... (cached) yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... no
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking types of arguments for select... int,fd_set *,struct timeval *
checking return type of signal handlers... void
checking whether lstat correctly handles trailing slash... no
checking whether stat accepts an empty string... yes
checking for vprintf... yes
checking for _doprnt... no
checking for bzero... yes
checking for gettimeofday... yes
checking for memmove... yes
checking for memset... yes
checking for munmap... yes
checking for select... yes
checking for strcasecmp... yes
checking for strchr... yes
checking for strdup... yes
checking for strtoul... yes
checking whether linear modules is requested... yes
checking whether dejitter module is requested... yes
checking whether linear-h2200 module is requested... yes
checking whether variance module is requested... yes
checking whether pthres module is requested... yes
checking whether ucb1x00 module is requested... yes
checking whether corgi module is requested... yes
checking whether collie module is requested... yes
checking whether h3600 module is requested... yes
checking whether mk712 module is requested... yes
checking whether arctic2 module is requested... yes
checking whether input module is requested... yes
checking where to place modules... ${libdir}/ts/
checking whether to enable debugging... no
configure: updating cache arm-linux-.cache
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating etc/Makefile
config.status: creating plugins/Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating tslib-0.0.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

3.4、编译

leon@Ubuntu:~/tslib$ make > make.log
linear.c: In function 'linear_xyswap':
linear.c:86: warning: unused parameter 'str'
linear.c:86: warning: unused parameter 'data'
linear.c: In function 'mod_init':
linear.c:101: warning: unused parameter 'dev'
dejitter.c: In function 'mod_init':
dejitter.c:200: warning: unused parameter 'dev'
variance.c: In function 'mod_init':
variance.c:164: warning: unused parameter 'dev'
pthres.c: In function 'mod_init':
pthres.c:134: warning: unused parameter 'dev'
ucb1x00-raw.c: In function 'ucb1x00_read':
ucb1x00-raw.c:25: warning: unused variable 'nr'
ucb1x00-raw.c:21: warning: unused variable 'total'
ucb1x00-raw.c: In function 'mod_init':
ucb1x00-raw.c:52: warning: unused parameter 'dev'
ucb1x00-raw.c:52: warning: unused parameter 'params'
corgi-raw.c: In function 'corgi_read':
corgi-raw.c:24: warning: unused variable 'nr'
corgi-raw.c:20: warning: unused variable 'total'
corgi-raw.c: In function 'mod_init':
corgi-raw.c:50: warning: unused parameter 'dev'
corgi-raw.c:50: warning: unused parameter 'params'
collie-raw.c: In function 'collie_read':
collie-raw.c:24: warning: unused variable 'nr'
collie-raw.c:20: warning: unused variable 'total'
collie-raw.c: In function 'mod_init':
collie-raw.c:51: warning: unused parameter 'dev'
collie-raw.c:51: warning: unused parameter 'params'
h3600-raw.c: In function 'h3600_read':
h3600-raw.c:24: warning: unused variable 'nr'
h3600-raw.c:20: warning: unused variable 'total'
h3600-raw.c: In function 'mod_init':
h3600-raw.c:50: warning: unused parameter 'dev'
h3600-raw.c:50: warning: unused parameter 'params'
mk712-raw.c: In function 'mk712_read':
mk712-raw.c:24: warning: unused variable 'nr'
mk712-raw.c:20: warning: unused variable 'total'
mk712-raw.c: In function 'mod_init':
mk712-raw.c:53: warning: unused parameter 'dev'
mk712-raw.c:53: warning: unused parameter 'params'
arctic2-raw.c: In function 'arctic2_read':
arctic2-raw.c:25: warning: unused variable 'nr'
arctic2-raw.c:21: warning: unused variable 'total'
arctic2-raw.c: In function 'mod_init':
arctic2-raw.c:51: warning: unused parameter 'dev'
arctic2-raw.c:51: warning: unused parameter 'params'
linear-h2200.c: In function 'mod_init':
linear-h2200.c:109: warning: unused parameter 'dev'
linear-h2200.c:109: warning: unused parameter 'params'
input-raw.c: In function 'mod_init':
input-raw.c:234: warning: unused parameter 'dev'
input-raw.c:234: warning: unused parameter 'params'
font_8x8.c:2581: warning: pointer targets in initialization differ in signedness
font_8x16.c:4629: warning: pointer targets in initialization differ in signedness
ts_harvest.c: In function 'main':
ts_harvest.c:123: warning: comparison between signed and unsigned integer expressions
ts_harvest.c:128: warning: comparison between signed and unsigned integer expressions
ts_harvest.c:70: warning: unused variable 'samp'

3.5、安装

leon@Ubuntu:~/tslib$ sudo make install
Making install in etc
make[1]: 正在进入目录 `/home/leon/tslib/etc'
make[2]: 正在进入目录 `/home/leon/tslib/etc'
 /bin/mkdir -p '/usr/local/tslib/etc'
 /usr/bin/install -c -m 644 ts.conf '/usr/local/tslib/etc'
make[2]: 没有什么可以做的为 `install-data-am'。
make[2]:正在离开目录 `/home/leon/tslib/etc'
make[1]:正在离开目录 `/home/leon/tslib/etc'
Making install in src
make[1]: 正在进入目录 `/home/leon/tslib/src'
make[2]: 正在进入目录 `/home/leon/tslib/src'
 /bin/mkdir -p '/usr/local/tslib/lib'
 /bin/sh ../libtool   --mode=install /usr/bin/install -c   libts.la '/usr/local/tslib/lib'
libtool: install: /usr/bin/install -c .libs/libts-0.0.so.0.1.1 /usr/local/tslib/lib/libts-0.0.so.0.1.1
libtool: install: (cd /usr/local/tslib/lib && { ln -s -f libts-0.0.so.0.1.1 libts-0.0.so.0 || { rm -f libts-0.0.so.0 && ln -s libts-0.0.so.0.1.1 libts-0.0.so.0; }; })
libtool: install: (cd /usr/local/tslib/lib && { ln -s -f libts-0.0.so.0.1.1 libts.so || { rm -f libts.so && ln -s libts-0.0.so.0.1.1 libts.so; }; })
libtool: install: /usr/bin/install -c .libs/libts.lai /usr/local/tslib/lib/libts.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/tslib/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/tslib/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /bin/mkdir -p '/usr/local/tslib/include'
 /usr/bin/install -c -m 644 tslib.h '/usr/local/tslib/include'
make[2]:正在离开目录 `/home/leon/tslib/src'
make[1]:正在离开目录 `/home/leon/tslib/src'
Making install in plugins
make[1]: 正在进入目录 `/home/leon/tslib/plugins'
make[2]: 正在进入目录 `/home/leon/tslib/plugins'
 /bin/mkdir -p '/usr/local/tslib/lib/ts/'
 /bin/sh ../libtool   --mode=install /usr/bin/install -c   linear.la dejitter.la variance.la pthres.la ucb1x00.la corgi.la collie.la h3600.la mk712.la arctic2.la linear_h2200.la input.la '/usr/local/tslib/lib/ts/'
libtool: install: /usr/bin/install -c .libs/linear.so /usr/local/tslib/lib/ts/linear.so
libtool: install: /usr/bin/install -c .libs/linear.lai /usr/local/tslib/lib/ts/linear.la
libtool: install: /usr/bin/install -c .libs/dejitter.so /usr/local/tslib/lib/ts/dejitter.so
libtool: install: /usr/bin/install -c .libs/dejitter.lai /usr/local/tslib/lib/ts/dejitter.la
libtool: install: /usr/bin/install -c .libs/variance.so /usr/local/tslib/lib/ts/variance.so
libtool: install: /usr/bin/install -c .libs/variance.lai /usr/local/tslib/lib/ts/variance.la
libtool: install: /usr/bin/install -c .libs/pthres.so /usr/local/tslib/lib/ts/pthres.so
libtool: install: /usr/bin/install -c .libs/pthres.lai /usr/local/tslib/lib/ts/pthres.la
libtool: install: /usr/bin/install -c .libs/ucb1x00.so /usr/local/tslib/lib/ts/ucb1x00.so
libtool: install: /usr/bin/install -c .libs/ucb1x00.lai /usr/local/tslib/lib/ts/ucb1x00.la
libtool: install: /usr/bin/install -c .libs/corgi.so /usr/local/tslib/lib/ts/corgi.so
libtool: install: /usr/bin/install -c .libs/corgi.lai /usr/local/tslib/lib/ts/corgi.la
libtool: install: /usr/bin/install -c .libs/collie.so /usr/local/tslib/lib/ts/collie.so
libtool: install: /usr/bin/install -c .libs/collie.lai /usr/local/tslib/lib/ts/collie.la
libtool: install: /usr/bin/install -c .libs/h3600.so /usr/local/tslib/lib/ts/h3600.so
libtool: install: /usr/bin/install -c .libs/h3600.lai /usr/local/tslib/lib/ts/h3600.la
libtool: install: /usr/bin/install -c .libs/mk712.so /usr/local/tslib/lib/ts/mk712.so
libtool: install: /usr/bin/install -c .libs/mk712.lai /usr/local/tslib/lib/ts/mk712.la
libtool: install: /usr/bin/install -c .libs/arctic2.so /usr/local/tslib/lib/ts/arctic2.so
libtool: install: /usr/bin/install -c .libs/arctic2.lai /usr/local/tslib/lib/ts/arctic2.la
libtool: install: /usr/bin/install -c .libs/linear_h2200.so /usr/local/tslib/lib/ts/linear_h2200.so
libtool: install: /usr/bin/install -c .libs/linear_h2200.lai /usr/local/tslib/lib/ts/linear_h2200.la
libtool: install: /usr/bin/install -c .libs/input.so /usr/local/tslib/lib/ts/input.so
libtool: install: /usr/bin/install -c .libs/input.lai /usr/local/tslib/lib/ts/input.la
libtool: install: warning: remember to run `libtool --finish /usr/local/tslib/lib/ts/'
make[2]: 没有什么可以做的为 `install-data-am'。
make[2]:正在离开目录 `/home/leon/tslib/plugins'
make[1]:正在离开目录 `/home/leon/tslib/plugins'
Making install in tests
make[1]: 正在进入目录 `/home/leon/tslib/tests'
make[2]: 正在进入目录 `/home/leon/tslib/tests'
 /bin/mkdir -p '/usr/local/tslib/bin'
  /bin/sh ../libtool   --mode=install /usr/bin/install -c ts_test ts_calibrate ts_print ts_print_raw ts_harvest '/usr/local/tslib/bin'
libtool: install: /usr/bin/install -c .libs/ts_test /usr/local/tslib/bin/ts_test
libtool: install: /usr/bin/install -c .libs/ts_calibrate /usr/local/tslib/bin/ts_calibrate
libtool: install: /usr/bin/install -c .libs/ts_print /usr/local/tslib/bin/ts_print
libtool: install: /usr/bin/install -c .libs/ts_print_raw /usr/local/tslib/bin/ts_print_raw
libtool: install: /usr/bin/install -c .libs/ts_harvest /usr/local/tslib/bin/ts_harvest
make[2]: 没有什么可以做的为 `install-data-am'。
make[2]:正在离开目录 `/home/leon/tslib/tests'
make[1]:正在离开目录 `/home/leon/tslib/tests'
make[1]: 正在进入目录 `/home/leon/tslib'
make[2]: 正在进入目录 `/home/leon/tslib'
make[2]: 没有什么可以做的为 `install-exec-am' /bin/mkdir -p '/usr/local/tslib/lib/pkgconfig'
 /usr/bin/install -c -m 644 tslib-0.0.pc '/usr/local/tslib/lib/pkgconfig'
make[2]:正在离开目录 `/home/leon/tslib'
make[1]:正在离开目录 `/home/leon/tslib'

最后进入到/usr/local目录下查看一下相关文件是否已经安装成功:

leon@Ubuntu:~$ cd /usr/local/
leon@Ubuntu:/usr/local$ ls
bin  etc  games  include  lib  man  sbin  share  src  tslib
leon@Ubuntu:/usr/local$ cd tslib/
leon@Ubuntu:/usr/local/tslib$ ll
总用量 24
drwxr-xr-x  6 root root 4096  827 14:56 ./
drwxr-xr-x 11 root root 4096  827 14:56 ../
drwxr-xr-x  2 root root 4096  827 14:56 bin/
drwxr-xr-x  2 root root 4096  827 14:56 etc/
drwxr-xr-x  2 root root 4096  827 14:56 include/
drwxr-xr-x  4 root root 4096  827 14:56 lib/

4、拷贝安装

上面的步骤完成了tslib库的编译工作,并且将必要的文件统一拷贝到了指定的目录下。但是,这些文件最终都不是在PC上运行的,而是要在目标开发板(即此处的mini2440)上运行的,所以,接下来我们就要将他们拷贝安装到开发板上去。

4.1、修改内容

打开安装路径下的/etc/ts.conf文件,修改其内容。

找到“module_raw input”,把行首的注释符去掉,但要注意行首不要留有空格,即文字是顶格的,不然之后会出现段错误 (segmentational fault)。

  1 # Uncomment if you wish to use the linux input layer event interface
  2 module_raw input
  3 
  4 # Uncomment if you're using a Sharp Zaurus SL-5500/SL-5000d
  5 # module_raw collie
  6 
  7 # Uncomment if you're using a Sharp Zaurus SL-C700/C750/C760/C860
  8 # module_raw corgi
  9 
 10 # Uncomment if you're using a device with a UCB1200/1300/1400 TS interface
 11 # module_raw ucb1x00
 12 
 13 # Uncomment if you're using an HP iPaq h3600 or similar
 14 # module_raw h3600
 15 
 16 # Uncomment if you're using a Hitachi Webpad
 17 # module_raw mk712
 18 
 19 # Uncomment if you're using an IBM Arctic II
 20 # module_raw arctic2

注1:这里指的是安装目录(即/usr/local/tslib),不是编译的目录,切记!
注2:如果你用的是普通用户,记得用sudo命令来提升权限,否则可能会无法写入。

4.2、拷贝安装

将整个目录下的文件打包,并原封不动的拷贝安装到开发板的对应目录下(我本人放置在/usr/local/tslib目录下)。

4.3、环境变量

这里要设置一下开发板的环境变量,使得系统能够调用到tslib库。

打开环境变量文件/etc/profile,添加如下代码(该文件内已经存在tslib的环境变量,这里只是稍作修改):

export TSLIB_ROOT=/usr/local/tslib
export TSLIB_TSDEVICE=/dev/input/event1 
export QWS_MOUSE_PROTO=tslib:/dev/input/event1
export TSLIB_CALIBFILE=/etc/pointercal   
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf    
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts  
export TSLIB_FBDEVICE=/dev/fb0   
export TSLIB_CONSOLEDEVICE=none   
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TSLIB_ROOT/lib

注1:这里的修改是针对开发板的,不是针对PC的,切记!
注2:对上文的几个变量进行一下说明。注意其中部分变量需根据你自己开发板的实际情况修改:

TSLIB_ROOT                      // 你在开发板上实际存放的路径。
TSLIB_TSDEVICE                  // 触摸屏设备文件名,在/dev/input/目录下查看。
QWS_MOUSE_PROTO                 // 同TSLIB_TSDEVICE
TSLIB_CALIBFILE                 // 校准的数据文件,由ts_calibrate校准程序生成。 
TSLIB_CONFFILE                  // 配置文件名。 
TSLIB_PLUGINDIR                 // 插件目录。
TSLIB_CONSOLEDEVICE             // 控制台设备文件名。
TSLIB_FBDEVICE                  // 设备名。

4.4、测试验证

完成环境变量的设置后,重启开发板(目的是使系统读取profile环境变量),然后进入tslib/bin目录执行下面的程序进行验证和测试。

./ts_calibrate                      # 进行触摸屏的校准测试
./ts_test                           # 进行触摸屏的绘图测试

如果没有这两个测试文件,可以到我们编译安装的目录/usr/local/tslib目录下进行复制,如果测试成功话那tslib的移植就到此结束了。

5、后记

到这里其实还不算完结,后面还有一些事情要做,不过我目前还没完全搞懂,待我日后慢慢细说。

另外,我也还会再抽空研究一下如何使用最新版的tslib进行编译,待成功之日再来分享。

猜你喜欢

转载自blog.csdn.net/LEON1741/article/details/82113425