一、调试
1、驱动路径
bsp/drivers/input/ctp/gt9xx/gt9xx_ts.c
2、硬件接口
挂载在TWI0下
3、中断复位脚
4、设备树
&twi0 {
clock-frequency = <400000>;
pinctrl-0 = <&twi0_pins_default>;
pinctrl-1 = <&twi0_pins_sleep>;
pinctrl-names = "default", "sleep";
/* For stability and backwards compatibility, we recommend setting ‘twi_drv_used’ to 1 */
twi_drv_used = <1>;
twi-supply = <®_dcdc4>;
status = "okay";
gt9xx {
compatible = "goodix,gt9xx";
reg = <0x5d>;
status = "okay";
irq-gpios = <&pio PD 20 GPIO_ACTIVE_LOW>;
irq-flags = <2>;
reset-gpios = <&pio PD 21 GPIO_ACTIVE_LOW>;
vdd_ana-supply = <®_dcdc4>;
touchscreen-max-id = <11>;
touchscreen-size-x = <1280>;
touchscreen-size-y = <800>;
touchscreen-max-w = <512>;
touchscreen-max-p = <512>;
//touchscreen-key-map = <172>, <158>; /*KEY_HOMEPAGE=172, KEY_BACK=158,KEY_MENU=139*/
goodix,slide-wakeup = <0>;
goodix,type-a-report = <1>;
goodix,driver-send-cfg = <0>;
goodix,send-cfg-id = <0>;
goodix,resume-in-workqueue = <0>;
goodix,int-sync = <1>;
goodix,revert_x = <0>;
goodix,revert_y = <0>;
goodix,swap-x2y = <0>;
goodix,tp_idle_support = <1>;
goodix,esd-protect = <1>;
goodix,auto-update-cfg = <0>;
goodix,power-off-sleep = <1>;
goodix,pen-suppress-finger = <0>;
/* GT9271_Config_20221222_v67.cfg*/
goodix,cfg-group0 = [
B4 00 05 20 03 0A 3D 00 01 0A
28 0F 50 32 03 05 00 00 00 00
00 00 06 17 19 1F 14 8E 2E 99
2D 2F 35 11 00 00 00 1A 03 10
00 00 00 00 00 00 00 00 00 00
00 32 50 94 D5 02 07 00 00 04
8E 48 00 8A 4D 00 86 53 00 83
59 00 80 60 00 80 00 00 00 00
00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00
00 00 00 01 04 05 06 07 08 09
0C 0D 0E 0F 10 11 14 15 16 17
FF FF FF FF FF FF FF FF FF FF
FF FF 28 27 26 25 24 23 22 21
20 1F 1E 1C 1B 19 13 12 11 10
0F 0D 0C 0A 08 07 06 04 02 00
FF FF FF FF FF FF FF FF FF FF
FF FF FF FF AB 01
];
};
};
5、buildroot 构建
项目根路径执行./build.sh buildroot_menuconfig,选择tslib相关配置:
问题1:编译烧录无tslib插件,厂家的opengl库被qt覆盖的问题的。
makefile 修改后编译无法执行,需要删除out目录下,才会重新执行。
rm -rf out/t527/demo_linux_car/buildroot/buildroot/build/gpu_um_pub/
发现: qtbase 也会编译 eglfs, 导致覆盖了了厂家库, 需要执行上面的操作,让最后生成的厂家库覆盖qt编译的opengl。
二、验证测试
1、驱动
烧录后加载了对应驱动
2、系统指令 hexdump 测试
hexdump /dev/input/event3可以读取触摸/dev/input/eventX设备的原始数据,确认驱动可以上报数据。
3、读取事件
cat /dev/input/event3
4、文件系统存在 tslib 插件库。
存在
5、文件系统配置 Qt 插件路径和tslib 环境变量。
env查看环境变量,更改自己的配置
(rootfs修改:buildroot/package/auto/rootfs/etc/profile.d/qtenv.sh)
缺少tslib的库文件,触摸无反应,移植现有的tslib的库文件到buildroot/package/auto/rootfs/usr/lib目录下(需要库文件可联系我)
修改环境变量:
6、Qt GUI验证
Qt显示旋转方向和触摸旋转方向不一致
在buildroot/package/auto/rootfs/etc/profile.d/qtenv.sh中修改:
修改后应用启动后验证触摸和显示一一映射,准确且正确映射。
7、触摸不准
之前用ts_calibrate校准过,电容屏不需要校准,删除校准文件pointercal
路径:export TSLIB_CALIBFILE=/etc/pointercal