2010年2月9日星期二

linux 触摸屏校准

最近更新了sam9263的angstrom,导致触摸屏不好用了,表现为触摸不准。当然启动的时候是有触摸校准的。google了一番,好像是最新的X是使用Xorg了,不能直接支持tslib了,要使用X的Xf86-input-tslib驱动才行,使用openembedded编译了该驱动,并将其加入到了文件系统中,修改xorg.conf为:
Section "ServerLayout"
    Identifier "default"
    InputDevice "atmel-ts" "CorePointer"
EndSection

#Section "InputDevice"
#    Identifier "atmel-ts"
  #  Driver "evdev"
#    Option "SwapAxes" "1"
#    Option "Device" "/dev/input/touchscreen0"
    #Option "Calibrate"  "1"
#EndSection

Section "InputDevice"
         Identifier      "atmel-ts"
         Driver          "tslib"
         Option          "CorePointer"           "true"
         Option          "SendCoreEvents"        "true"
         Option          "Device"                "/dev/input/touchscreen0"
         Option          "Protocol"              "Auto"
          Option          "Width"                 "240"
          Option          "Height"                "320"
          Option          "EmulateRightButton"    "1"
#EndSection
启动后,更加不行了,查看var/log/Xorg.0.log,加载也没有问题。有可能是编译xorg时没有使能tslib。
在xorg.conf中看到,默认是使用的evdev驱动,google了半天其校准的方法,貌似xinput-calibrator才是正道,编译,复制到文件系统,在串口终端中运行DISPLAY=:0  xinput_calibrator,会出现校准窗口,校准完后就OK了,不过貌似这样每次启动后都需要重新校准,无需重新校准的方法,运行xinput_calibrator时会提示的,一种是使用hal,创建一个touchscreen.fdi文件,一种是之间写到xorg.conf中。
这样就OK了!!
原来默认启动时的校准窗口是tslib的校准,仅适用于xf86-input-tslib。

一个很好的文章:
A snapshot of the state-of-affairs on 20 december 2009

A new generic calibrator

Since I originally created this overview, I have started the xinput_calibrator project, hosted on freedesktop.org. Xinput_calibrator is an easy to use generic touchscreen calibration program that can calibrate all Xorg drivers (except tslib).

To understand how touchscreens are handled nowadays, check out this other page that tries to explain it all.

Historical overview

The rest of this page gives an overview of other calibration software for Linux.

Unfortuantely, most calibration software either works for only one Xorg driver, or only event devices (and no other Xorg drivers). This overview is a result of my long search to find a generic one for my dynapro serial touchscreen. I ended up combining the best interface(from soren) with the best approach(from tkxinput), which resulted in xinput_calibrator.

Historical calibration software overview:

NameApplicationConfigNotesRequires
tslibts_calibratedynamicAppearently the standard for touchscreens on embedded ARM systems (according to this post). Originally developed for Kdrive, but there is a port for Xorg called xf86-input-tslib (packaged in ubuntu and gentoo among others).a /dev/input/eventX device and a /dev/fbY video framebuffer device
tkxinputtkxinputin xorg.confA calibration program that gets coordinates by registering for xinput events. Not driver dependent (but the brittle gui wrongly makes you believe it is)none (uses XInput)
Soren's calibratormy_calibrator.ccdynamicA small and clean fullscreen app that gets coordinates from the GUI and calculates the new values.usbtouchscreen driver
evtouchev_calibratein xorg.confAimed to integrate pointer support for X, but seems unmaintained at the moment. According to this post it has a calibration utility called ev_calibrate. According to this post evtouch is superseded by evdev now (though a calibration program may not yet been written).a /dev/input/eventX device
joystickjscalin custom configAccording to this post it is possible to use the calibration of the joystick driver.a /dev/input/js0 device? not sure...
tabletvkcalibraterin custom configAccording to this page it can be used for devices using the input event layer.a /dev/input/eventX device, I suppose
touchkit usbcalibratorin xorg.confUses plain X stuff to draw the gui, but it didn't read any touches from the device file ?a /dev/input/eventX device, I suppose
plpevtechgetcal.shin xorg.confAnother event device driver that can calibrate (like tslib and evtouch but written by one man). Calibration is not with a program but by checking your logfile for printouts.a /dev/input/eventX device
touchcaltouchcalin xorg.confSelf declared as 'loosely maintained', only for 2 drivers.mutouch or elographics driver


Other projects interested in clearing the touchscreen calibration jungle:



没有评论: