无法让 tslib 与 FT5x06 一起使用 [英] can't get tslib to work with FT5x06

查看:18
本文介绍了无法让 tslib 与 FT5x06 一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于 arm 的板,上面有嵌入式 linux,我相信它有一个 FT5x06 触摸屏控制器,但似乎 tslib 在多点触控电容式触摸屏控制器方面存在一些问题.我用 arm-linux-gcc4.5.1 交叉编译了 tslib,当我运行 ts_calibrate 时,在复制必要的文件并为目标上的 tslib 设置必要的环境变量后,会出现一个窗口,它说:

I have a arm based board with embedded linux on it and I believe it has a FT5x06 touch screen controller but seems like tslib has some problems with multitouch capacitive touch screen controllers. I cross compiled tslib with arm-linux-gcc4.5.1 and when after copying necessary files and setting necassary environmental variables for tslib on the target when I ran ts_calibrate a window shows up and it says that:

tslib: Selected device is not a touchscreen (must support ABS_X and ABS_Y events)

它不接受我的触摸.现在我想不知何故我应该让 tslib 作为一个单一的触摸设备与控制器一起工作,但我不确定如何做到这一点或要更改哪个文件.我是否必须在内核中编辑驱动程序文件并重新构建它?

And it doesn't accept my touches. Now I think somehow I'm supposed to get tslib to work with the controller as a single touch device but I'm not sure how to do that or which file to change. Do I have to edit driver file in kernel and rebuild it too?

你有什么想法吗?

我想使用 tslib 作为我的 Qt4 程序的输入.

I want to use tslib as an input for my Qt4 program.

推荐答案

Tslib 需要设置多个文件和/或环境变量才能开箱即用.这是一些环境变量的示例,

Tslib will require the setup of several files and/or environment variables to work out of the box. Here is a sample of some environment variables,

 TSLIB_CONSOLEDEVICE=none
 TSLIB_FBDEVICE=/dev/fb0
 TSLIB_TSDEVICE=/dev/input/touch
 TSLIB_CALIBFILE=/etc/pointercal
 TSLIB_CONFFILE=/etc/ts.conf

使用 tslib 运行 Qt 不需要许多变量.但是,您将需要 TSLIB_TSDEVICETSLIB_CALIBFILETSLIB_CONFFILE 与 Qt 一起使用.二进制文件 ts_calibrate 将使用 TSLIB_FBDEVICE 设备来显示一些文本.然后,这会将配置写入 TSLIB_CALIBFILE.

Many variables are not needed to run Qt with tslib. However, you will need the TSLIB_TSDEVICE, TSLIB_CALIBFILE, and TSLIB_CONFFILE to use with Qt. The binaries ts_calibrate will use the TSLIB_FBDEVICE device to display some text. This will then write a configuration to the TSLIB_CALIBFILE.

要确定要使用的正确TSLIB_TSDEVICE,可以检查文件/sys/class/input/input*/name.名称应该类似于FT5202 Touchscreen.在上面的示例中,我在启动时使用此信息将 /dev/input/inputX 软链接到 /dev/input/touch.inputX 文件可能会随着其他输入驱动程序插入系统(例如 USB 鼠标等)而发生变化.这些文件位置可能取决于 udev 的类型>mdev 用于用户空间中的 /dev 目录填充.

To determine the correct TSLIB_TSDEVICE to use, the files /sys/class/input/input*/name can be examined. The name should be something like FT5202 Touchscreen. I use this information at boot time to soft link /dev/input/inputX to /dev/input/touch in the example above. The inputX file may change as other input drivers are plugged into a system, such as a USB mouse, etc. These file locations may depend on the type of udev or mdev you use for the /dev directory population in user space.

ts.conf 文件是要加载的模块列表.这是Focal Tech"设备的示例,

The ts.conf file is a list of modules to load. Here is an example for the 'Focal Tech' device,

module_raw input
module linear

Tslib 由多个模块(共享库)构成,这些模块在运行时动态加载.通常,这些模块需要加载到 /usr/lib/ts 并且您的内核和文件系统 (libc) 需要支持共享库.具体来说,线性模块将使用ts_calibrate程序的输出将触摸坐标映射到屏幕坐标em>.这对于电阻式触摸技术更有用,其中 xy 参数可以相互混合,包括剪切等.

Tslib is structured with several modules (shared libraries) which are loaded dynamically at run time. Typically, these modules need to be loaded to /usr/lib/ts and your kernel and filesystem (libc) need to support shared libraries. Specifically, the linear module will use the output of the ts_calibrate program to map touch co-ordinates to screen co-ordinates. This was much more useful with resistive touch technology where x and y parameters may inter-mix, including sheering, etc.

注意:可以避免此校准步骤,如果您要大量制造,这是非常可取的.

Note: it is possible to avoid this calibration step, which is highly desirable if you are manufacturing large quantities.

/etc/pointercal 中的数字被读入数组 a[0] -> a[7].公式是这样的,

The numbers in the /etc/pointercal are read into an array a[0] -> a[7]. The formula is like this,

x' = (a2 + a0 *x + a1 * y) / a6;
y' = (a5 + a3 *x + a4 * y) / a6;

对于电容式外壳,没有纯粹的.此外,FocalTech 设备的值似乎受到限制,因此屏幕位置 (0,0) 是触摸位置 (0,0),并且所有设备都给出相同的最大 (x,y) 值.所以方程简化为,

For the capacitive case, there is no sheer. Moreover, the values for the FocalTech devices seem to be restricted so that screen position (0,0) is touch position (0,0) and all the devices give the same maximum (x,y) values. So the equations reduce to,

x' = (a1 * x) / a6;
y' = (a4 * y) / a6;

因此pointercal文件的唯一目的是将触摸映射到屏幕坐标并且对于每个设备都是相同的.因此,当您反向求解最大屏幕位置的方程时,您可以手动对 pointercal 文件进行十六进制编辑.您可以通过 ts_print_raw 二进制文件获取此信息.

So the only purpose of the pointercal file is to map touch to screen co-ordinates AND the same for each device. So you can manual hex-edit a pointercal file when you back solve the equations for the maximum screen positions. You can get this information via the ts_print_raw binary.

最后,可以使用Qt Mouse Calibration class完全避免tslib.您只需要具有将转换坐标的固定三个常量的代码.您完全避免使用 tslib 包.

Finally, the Qt Mouse Calibration class can be used to completely avoid tslib. You only need code with the fixed three constants that will transform the co-ordinates. You avoid the tslib package entirely.

这篇关于无法让 tslib 与 FT5x06 一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆