1. 确认触摸事件id使用以下命令查看触摸屏对应的id root@fl-imx6ull:~# xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ iMX6UL TouchScreen Controller id=6 [slave pointer (2)] ⎜ ↳ goodix-ts id=8 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ 20cc000.snvs:snvs-powerkey id=7 [slave keyboard (3)] 飞凌7寸电容屏的事件为goodix-ts,对应id为8。 2.测试触摸使用以下命令测试 root@fl-imx6ull:~# xinput test 8 其中,8为上一节看到的触摸事件的id,请以实际为准。 此时点击屏幕,会有事件上报如下: root@fl-imx6ull:~# xinput test 8 motion a[0]=16 a[1]=38 a[2]=1 button press 1 motion a[2]=0 button release 1 其中, a[0]和a[1]为x、y轴坐标; a[2]为用于表示触摸是否按下,按下时a[2]为1,松手后a[2]为0; button press为1表示手指已经按下; button release为1表示手指已经松开; |