General

Gen7 and gen8 Archos devices with resistive touchscreen use  TI ADS784x controller.

Stock Gingerbread doesn't support touchscreen calibration, TS range is simply scaled to screen resolution. To add calibration capabilities we use a  patch. Calibration values are read from /system/usr/idc/ADS784x Touchscreen.idc, that defines 6 properties

touch.5pointcalib.xscale = 0.207832898
touch.5pointcalib.xymix = 0
touch.5pointcalib.xoffset = -24.934986945
touch.5pointcalib.yxmix = 0
touch.5pointcalib.yscale = 0.132637076
touch.5pointcalib.yoffset = -30.497127937

Screen coordinates are calculated as

Xscreen = xscale * Xtouch +  xymix * Ytouch + xoffset
Yscreen =  yxmix * Xtouch + yscale * Ytouch + yoffset

If the calibration file doesn't exist or any of the values is badly formatted, the system will scale TS range to screen resolution.

Calibration Application

Since static calibration values don't work for some devices, the app to define these values was made.

Building

Sources are hosted on gitorious  https://gitorious.org/touchscreen-calibrator

cd device/archos/common
git clone git://gitorious.org/touchscreen-calibrator/touchscreen-calibrator.git

To build the app (assuming you are familiar with building openaos cyanogenmod) Edit device/archos/gen7/gen7.mk (replace gen7 with gen8 if needed) and add TSCalibrator to PRODUCT_PACKAGES list. When you build the platform, the app would be built too and placed to out/target/product/gen7/system/app/TSCalibrator.apk.

Alternative way is

. build/envsetup.sh
lunch gen7-userdebug
make TSCalibrator

Requirements

Since I (illifant) haven't found a way to get raw values from input device, the app uses existing calibration values, calculates correction and writes result to /data/data/org.openaos.tscalibrator/files/ADS784x Touchscreen.idc. For doing this, the system calibration file /system/usr/idc/ADS784x Touchscreen.idc must be world-readable.

If the file doesn't exist, calibration will start right after boot. To apply new values you have to reboot. The script  /system/xbin/apply_calibration.sh will move newly written .idc file to the location in /system/usr/idc and make sure it's world-readable.