linux-kernel - 已安装触摸屏和驱动程序但 tslib 无法校准

标签 linux-kernel linux-device-driver embedded-linux touchscreen

我已经从 github (https://github.com/kergoth/tslib/commits/master) 交叉编译了最新的 tslib 提交。我的触摸屏连接到我的嵌入式板,我启用了供应商的驱动程序。当我启动并查看“cat/dev/input/touchscreen”的输出时,我可以看到在屏幕上移动手指会生成大量输出。内核还会向控制台输出格式良好的“finger1”和“finger2”消息。

但是我无法校准。当我如下所示设置我的环境变量并运行 ts_calibrate 时,它​​会吐出消息“xres = 640,yres = 480 tslib:所选设备不是触摸屏(必须支持 ABS 和 KEY 事件类型)”并且什么都不做。 .

所以 Linux 知道我的设备存在并且我可以看到滚动输出,但 tslib 无法校准。我做错了什么,我该如何解决?

# ls -rlt /dev/input/touchscreen
lrwxrwxrwx    1 root     root             6 Jan 17 21:06 /dev/input/touchscreen -> event1
# chmod 777 /dev/input/touchscreen
# chmod 777 /dev/input/event1

# cat /dev/input/touchscreen  | hexdump
0000000 9011 3883 565f 0001 0003 0030 0001 0000
0000010 9011 3883 565f 0001 0003 0032 0001 0000
0000020 9011 3883 565f 0001 0003 0035 04c9 0000
0000030 9011 3883 565f 0001 0003 0036 0c3f 0000
0000040 9011 3883 565f 0001 0000 0002 0000 0000
0000050 9011 3883 565f 0001 0000 0000 0000 0000
0000060 9011 3883 90a9 0001 0003 0030 0001 0000
0000070 9011 3883 90a9 0001 0003 0032 0001 0000

# cat /sys/devices/virtual/input/input1/uevent
PRODUCT=0/0/0/0
NAME="aura-touchscreen"
PROP=0
EV=9
ABS=650000 0
MODALIAS=input:b0000v0000p0000e0000-e0,3,kra30,32,35,36,mlsfw

# cat /etc/ts.conf
# Uncomment if you wish to use the linux input layer event interface
module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear

export TSLIB_TSEVENTTYPE=INPUT
export TSLIB_TSDEVICE=/dev/input/touchscreen
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CONSOLEDEVICE=none
export TSTS_INFO_FILE=/sys/devices/virtual/input/input1/uevent
export QWS_MOUSE_PROTO=tslib:/dev/input/touchscreen
export PATH=$PATH:/usr/bin
ts_calibrate
xres = 640, yres = 480
tslib: Selected device is not a touchscreen (must support ABS and KEY event types)

有趣的是,如果我执行 'cat/proc/bus/input/devices' 然后我可以看到我的触摸屏,但只有一个 ABS 条目(没有 KEY )并且 tslib 说我需要两者。我可以在这里分配一个“KEY”条目吗?

# cat /proc/bus/input/devices
I: Bus=0019 Vendor=0001 Product=0001 Version=0003
N: Name="TWL4030 Keypad"
P: Phys=twl4030_keypad/input0
S: Sysfs=/devices/platform/omap/omap_i2c.1/i2c-1/1-004a/twl4030_keypad/input/input0
U: Uniq=
H: Handlers=kbd event0
B: PROP=0
B: EV=100013
B: KEY=ffc
B: MSC=10

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="aura-touchscreen"
P: Phys=
S: Sysfs=/devices/virtual/input/input1
U: Uniq=
H: Handlers=event1
B: PROP=0
B: EV=9
B: ABS=650000 0

最佳答案

尝试添加

input_dev = input_allocate_device();
[..]
set_bit(EV_ABS, input_dev->evbit);
set_bit(EV_KEY, input_dev->evbit);

因此 tslib 将设备视为同时支持 EV_ABS 和 EV_KEY 事件(即使它实际上并未发送这两个事件)。

如果您有更多问题,您知道如何联系我...;)

关于linux-kernel - 已安装触摸屏和驱动程序但 tslib 无法校准,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11937287/

相关文章:

gcc - 编译外部内核模块时如何手动包含.config?

Linux 内核模块读/写文件

内核模块的配置文件

linux - KGDB远程调试报错

gcc - 汇编代码 `movl %1, %%ebx`是什么意思?

android-camera - V4l2 : difference between : Enque, 缓冲区的 Deque 和 Queue(ing)?

ubuntu - 启动时自动连接的 Yocto WiFi 配置

git - 将 br2-external 中保存的补丁应用到 buildroot 包

linux - 在一个驱动模块中处理多个 i2c_clients(使用 sysfs)

自定义 linux pcie 驱动程序 MSI 中断