tslib 编译(i.Mx8&i.Mx6)

【生活经历分享】华师国培 华师伴学 合同都是坑 消费者付款后无法退款
和华师国培签合同需小心,合同中都是保护华师的条款,没有保护消费者的条款。
收到钱,就算你因对培训质量不满意,也不能退款。因合同消费者维权肯定十分艰难。
华师伴学的授课方式是看录制的视频,不是真人现场教学。是否是您和孩子想要的学习方式?
各位打算报名的,交费要谨慎!
其他人在小红书上发的,转:
深圳市华师国培教育科技有限公司,黑心机构,大家擦亮眼睛,别被骗了,消费欺诈,虚假承诺,签合同各种坑,收到钱了不履行承诺不退款,乱扣费,维权艰难! - 小红书
【工作要用到的技术,之前记录在云笔记中,因时间太久已经不记得出处。如果有问题请联系我,会及时配合处理】

 

 

开始前请先安装如下工具:sudo apt-get install autoconf automake libtool
#tslib路径
QMAKE_INCDIR += /home/ecd_1403046_182762140718/source/tslib/tslib/include
QMAKE_LIBDIR += /home/ecd_1403046_182762140718/source/tslib/tslib
QMAKE_INCDIR += /home/ecd_1403046_182762140718/source/tslib/mtdev/include
QMAKE_LIBDIR += /home/ecd_1403046_182762140718/source/tslib/mtdev/lib
========================编译mtdev=====================================
1 准备源码: tar -zxvf mtdev-1.1.5.tar.gz
2 进入 mtdev-1.1.5
3 配置源码, 注意这里CFLAGS 需要和QT库一致
CFLAGS="-march=armv8-a -mcpu=cortex-a35"
./configure --target=aarch64-poky-linux --host=aarch64-poky-linux --build=x86_64-linux -prefix=/home/ecd_1403046_182762140718/source/tslib-1.4ins/mtdev
4 编译安装
make
make install
========================编译tslib========================================
1 准备源码: tar -zxvf tslib-1.4.tar.gz
2 进入 tslib
3 生成基础文件
./autogen.sh
生成的config.h.in中如果有这两行,就屏蔽掉:
#undef malloc
#undef realloc
4 生成cache文件
echo "ac_cv_func_malloc_0_nonnull=yes">arm-none-linux-gnueabi.cache
5 配置源码, 注意这里CFLAGS 需要和QT库一致
CFLAGS="-march=armv8-a -mcpu=cortex-a35"
#V1.4
./configure --target=aarch64-poky-linux --host=aarch64-poky-linux --build=x86_64-linux --prefix=/home/ecd_1403046_182762140718/source/tslib-1.4ins/tslib ac_cv_func_malloc_0_nonnull=yes --enable-inputapi=no
configure: WARNING: unrecognized options: --enable-inputapi
./configure --prefix=/usr/local/tslib/ --host=aarch64-poky-linux
V1.22
./configure --target=aarch64-poky-linux --host=aarch64-poky-linux --build=x86_64-linux --prefix=/home/ecd_1403046_182762140718/source/tslib/tslib ac_cv_func_malloc_0_nonnull=yes --with-sdl2 LDFLAGS=-L/home/ecd_1403046_182762140718/source/git-tslib/SDL2-2.0.14-arm/_install/lib CPPFLAGS=-I/home/ecd_1403046_182762140718/source/git-tslib/SDL2-2.0.14-arm/_install/include
6 编译安装
make
make install
7 修改 /etc/ts.conf
屏蔽掉module_raw input。
Leo: 但此文件需要至少放开一行 module_raw 定义,否则会报错: No raw modules loaded.
Leo: 此步在嵌入式设备操作时不需要执行!!!
8 aliyun@zhyh:~/source/tslib-1.4$ libtool --finish /home/ecd_1403046_182762140718/source/tslib/tslib/lib/ts/
libtool: finish: PATH="/bin:/usr/bin:/usr/X11R6/bin:/snap/bin:/opt/Citrix/VDA/bin:/sbin:/sbin" ldconfig -n /home/ecd_1403046_182762140718/source/tslib/tslib/lib/ts/
----------------------------------------------------------------------
Libraries have been installed in:
/home/ecd_1403046_182762140718/source/tslib/tslib/lib/ts/
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.
----------------------------------------------------------------------
9 tslib 使用(将tslib目录拷贝到板子的/usr/local目录下,运行/usr/local/tslib/bin/的执行文件进行屏幕校正)
将安装路径tmp目录下的bin、etc、lib目录拷贝到开发板中;
修改/etc/ts.conf,将“module_raw input”这行屏蔽掉;——同 7
修改/etc/profile,添加以下语句(涉及到dev目录的内容根据实际情况调整):
export TSLIB_ROOT=/app/tslib
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf # export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts # export TSLIB_PLUGINDIR=/lib/ts
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TSLIB_ROOT/lib
export TSLIB_CONSOLEDEVICE=none # 设定控制台设备为: none,否则默认为: /dev/tty.这样可以避免出现“open consoledevice: No such file or directory KDSETMODE: Bad file descriptor”的错误
export TSLIB_FBDEVICE=/dev/fb0 # 指定帧缓冲设备
重启设备,执行命令进入校准:
# 电阻屏校准命令,可删除前面 TSLIB_CALIBFILE 指定的文件进行重新校准
ts_calibrate
# 多点触摸电容屏校准命令
ts_test_mt
 
错误一:
aliyun@zhyh:~/source/mtdev-1.1.5$ ./configure --target=aarch64-poky-linux --host=aarch64-poky-linux --build=x86_64-linux -prefix=/home/ecd_1403046_182762140718/source/tslib/mtdev
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/home/ecd_1403046_182762140718/source/mtdev-1.1.5/config-aux/missing: Unknown `--is-lightweight' option
Try `/home/ecd_1403046_182762140718/source/mtdev-1.1.5/config-aux/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
checking for aarch64-poky-linux-strip... no
checking for strip... strip
configure: WARNING: using cross tools not prefixed with host triplet
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... Invalid configuration `aarch64-poky-linux': machine `aarch64-poky' not recognized
configure: error: /bin/bash config-aux/config.sub aarch64-poky-linux failed
解决方法:
下载新的config.sub和config.guess,替换掉旧的;
wget -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'
wget -O config.sub 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'

 

错误二:
font_8x16.c:4629:2: note: (near initialization for ‘font_vga_8x16.data’)
mv -f .deps/font_8x16.Tpo .deps/font_8x16.Po
/bin/bash ../libtool --tag=CC --mode=link gcc -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -o ts_test ts_test.o fbutils.o font_8x8.o font_8x16.o ../src/libts.la -ldl
libtool: link: gcc -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -o .libs/ts_test ts_test.o fbutils.o font_8x8.o font_8x16.o ../src/.libs/libts.so -ldl -Wl,-rpath -Wl,/home/ecd_1403046_182762140718/source/tslib/tslib/lib
fbutils.o: In function `open_framebuffer':
fbutils.c:(.text+0x14c): undefined reference to `rpl_malloc'
collect2: error: ld returned 1 exit status
Makefile:452: recipe for target 'ts_test' failed
make[2]: *** [ts_test] Error 1
make[2]: 离开目录“/home/ecd_1403046_182762140718/source/tslib-1.4/tests”
Makefile:481: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: 离开目录“/home/ecd_1403046_182762140718/source/tslib-1.4”
Makefile:392: recipe for target 'all' failed
make: *** [all] Error 2
解决方法:
修改 configure.ac 文件,屏蔽: # AC_FUNC_MALLOC

 

错误三:
/bin/bash ../libtool --tag=CC --mode=link gcc -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -o ts_test ts_test.o fbutils.o font_8x8.o font_8x16.o ../src/libts.la -ldl
libtool: link: gcc -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -o .libs/ts_test ts_test.o fbutils.o font_8x8.o font_8x16.o ../src/.libs/libts.so -ldl -Wl,-rpath -Wl,/home/ecd_1403046_182762140718/source/tslib/tslib/lib
gcc -DHAVE_CONFIG_H -I. -I.. -I../src -DGCC_HASCLASSVISIBILITY -O2 -Wall -W -MT ts_calibrate.o -MD -MP -MF .deps/ts_calibrate.Tpo -c -o ts_calibrate.o ts_calibrate.c
ts_calibrate.c: In function ‘main’:
ts_calibrate.c:234:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write (cal_fd, cal_buffer, strlen (cal_buffer) + 1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/fcntl.h:290:0,
from /usr/include/x86_64-linux-gnu/sys/fcntl.h:1,
from ts_calibrate.c:20:
In function ‘open’,
inlined from ‘main’ at ts_calibrate.c:227:11:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:4: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
__open_missing_mode ();
^~~~~~~~~~~~~~~~~~~~~~
In function ‘open’,
inlined from ‘main’ at ts_calibrate.c:229:11:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:4: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
__open_missing_mode ();
^~~~~~~~~~~~~~~~~~~~~~
Makefile:472: recipe for target 'ts_calibrate.o' failed
make[2]: *** [ts_calibrate.o] Error 1
make[2]: 离开目录“/home/ecd_1403046_182762140718/source/tslib-1.4/tests”
Makefile:481: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: 离开目录“/home/ecd_1403046_182762140718/source/tslib-1.4”
Makefile:392: recipe for target 'all' failed
make: *** [all] Error 2
解决方法:
由于 gcc 新版本编译器对语法检查严格,在源文件 ./tests/ts_calibrate.c 中
if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {
cal_fd = open (calfile, O_CREAT | O_RDWR);
} else {
cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR);
}
需要修改为(open函数当第二个参数用 O_CREAT 表示创建文件时,需要使用第三个参数将文件赋予权限,所以增加第三个参数 0777):
if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {
cal_fd = open (calfile, O_CREAT | O_RDWR, 0777);
} else {
cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR, 0777);
}保存后重新编译即可。
至此,i.Mx8平台 tslib 编译成功!

运行错误记录:
1 root@imx8qxpc0mek:/app/tslib/bin# ./ts_calibrate
open fbdevice: No such file or directory
未指定 TSLIB_FBDEVICE,还是报了上面的错误。

2 root@imx8qxpc0mek:/app/tslib/bin# ./ts_calibrate // 屏蔽掉文件 etc/ts.conf 的 module_raw input
No raw modules loaded.
ts_config: No such file or directory

 

以下为i.Mx6平台编译记录:
========================编译mtdev==================================
1 准备源码
tar -zxvf mtdev-1.1.5.tar.gz
2进入 mtdev-1.1.5
3配置源码, 注意这里CFLAGS 需要和QT库一致
CFLAGS="-march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mthumb-interwork -mfloat-abi=hard -mtune=cortex-a9 -mno-unaligned-access"
./configure --host=arm-none-linux-gnueabi --cache-file=arm-none-linux-gnueabi.cache --enable-inputapi=no -prefix=/home/builder_b/tools/mtdev-1.1.5/mtdev
4编译安装
make
make install

========================编译tslib==================================
1 准备源码
tar -zxvf tslib-1.4.tar.gz
2进入 tslib
3生成基础文件
./autogen.sh
生成的config.h.in中如果有这两行,就屏蔽掉:
#undef malloc
#undef realloc
4生成cache文件
echo "ac_cv_func_malloc_0_nonnull=yes">arm-none-linux-gnueabi.cache
5配置源码, 注意这里CFLAGS 需要和QT库一致
CFLAGS="-march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mthumb-interwork -mfloat-abi=hard -mtune=cortex-a9 -mno-unaligned-access"
./configure --host=arm-none-linux-gnueabi --cache-file=arm-none-linux-gnueabi.cache --enable-inputapi=no -prefix=/home/builder_b/tools/tslib-1.4/tslib
./configure --prefix=/usr/local/tslib/ --host=arm-none-linux-gnueabi ac_cv_func_malloc_0_nonnull=yes
6编译安装
make
make install
7修改 etc/ts.conf
屏蔽掉module_raw input
#tslib路径
QMAKE_INCDIR += /home/builder_b/tools/tslib-1.4/tslib/include
QMAKE_LIBDIR += /home/builder_b/tools/tslib-1.4/tslib/lib
QMAKE_INCDIR += /home/builder_b/tools/mtdev-1.1.5/mtdev/include
QMAKE_LIBDIR += /home/builder_b/tools/mtdev-1.1.5/mtdev/lib
 
SDL2-2.0.14.tar.gz
portable ts_calibrate and ts_test_mt using SDL2
In case you cannot draw directly on the framebuffer, there is an experimental implementation of the necessary graphical tools using SDL2. They are more portable, but require more resources to run. To use them, make sure you have SDL2 and the development headers installed and use ./configure --with-sdl2.
  • libsdl2-dev (only when using --with-sdl2 for SDL2 graphical applications)
SDL 编译
CFLAGS="-march=armv8-a -mcpu=cortex-a35"
./configure --prefix=$PWD/_install --target=aarch64-poky-linux --host=aarch64-poky-linux --build=x86_64-linux
make && make install

QML 多点触控方案:
MultiPointTouchArea {
id:multiTouch
z:10
anchors.fill: parent
minimumTouchPoints : 1
maximumTouchPoints : 3
mouseEnabled : false
touchPoints: [
TouchPoint { id: touch1 },
TouchPoint { id: touch2 }
]

  onPressed: {

console.log("---onPressed---");
if(touch1.pressed)
{
console.log("***touch1***", "pressed:", touch1.pressed, touch1.x, touch1.y);
autoctl.sendTouchData(touch1.x, touch1.y, 0, 0);
}
else
{
}
if(touch2.pressed)
{
console.log("***touch2***", "pressed:", touch2.pressed, touch2.x, touch2.y);
autoctl.sendTouchData(touch2.x, touch2.y, 0, 1);
}
else
{
}
}

onUpdated: {
console.log("---onUpdated---");
if(touch1.pressed)
{
console.log("***touch1***", "pressed:", touch1.pressed, touch1.x, touch1.y);
autoctl.sendTouchData(touch1.x, touch1.y, 2, 0);
}
else 
{ 
} 
if(touch2.pressed) 
{ 
console.log("***touch2***", "pressed:", touch2.pressed, touch2.x, touch2.y); 
autoctl.sendTouchData(touch2.x, touch2.y, 2, 1); 
} 
else 
{ 
} 
}

  onReleased: { 

console.log("---onReleased---"); 
if(touch1.pressed) 
{ 
console.log("***touch1***", "pressed:", touch1.pressed, touch1.x, touch1.y); 
} 
else 
{ 
autoctl.sendTouchData(touch1.x, touch1.y, 1, 0); 
} 
if(touch2.pressed) 
{ 
console.log("***touch2***", "pressed:", touch2.pressed, touch2.x, touch2.y); 
} 
else 
{
autoctl.sendTouchData(touch2.x, touch2.y, 1, 1); 
} 
} 
}
posted @ 2025-07-07 14:33  91program  阅读(32)  评论(0)    收藏  举报