[HOW TO] Calibrate your Touch Screen on Newer Kernels in GBX0C/GBX0*

Caldair

Senior Member
Dec 28, 2008
616
673
123
I take no credit for any of this, I have just put together things I have found on various threads.

As you all know the touch screen calibration that runs at boot does not work with any of the newer kernels as you cannot see some of the cross hairs to tap. I have personally NEVER been able to produce my own accurate ts-calibration file and have been using an ancient one that I downloaded back in the early days of FRX (thank you arrrghhh). Hopefully you have a somewhat functional ts-calibration file as you need to carry out this procedure from within Android. Here we go... (it's easy)

1. Download HtcCalibrate_WVGA.apk, thanks to lukas.pce, attached to first post here http://forum.xda-developers.com/showthread.php?t=1457343 to your device.

2. Install HtcCalibrate_WVGA.apk

3. Run HTC Calibrate and follow the instructions, tapping all the points (I used a toothpick for added accuracy)

4. When complete the app will report 'Calibration complete', tap 'Done'. Your screen should now be accurately calibrated for this session. Test to make sure it is working correctly before proceding to next step.

5. Now to get the calibration data to stick after reboot: Open your file explorer (MUST HAVE ROOT ACCESS; I use ES File Explorer with Menu>Settings>'Up to Root' checked) and navigate to /sys/devices/virtual/input/input3/ there you should see a file named calibration_points.

**It seems that in some builds (perhaps depending on kernel version?) that the devices get defined differently and I have found the file calibration_points in /sys/devices/virtual/input/input2/.
**So if you can't find it in input3/ then check input2/ (I haven't seen it anywhere else, but it probably could be in input1/, 4/, or 5/ as well, if not in the first two).
6. Finally copy calibration_points to /sdcard/ (the root of your SD card), delete your existing ts-calibration file (or backup somewhere if you want) and rename calibration_points to ts-calibration.

**Nand users see this (thanks wizardnight!):
BTW on the nand version (GBX0* + 3.3.x kernel) it needs to be placed in /data/

Done. Your phone should now boot with the calibration data you created.
 
Last edited:

wizardknight

Senior Member
Nov 1, 2009
1,001
293
113
Seattle WA
So that is where it sticks the file. I have been trying to find that out forever. Cool beans.:)
I had been using an old version of GBX0B on an sd card to make a decent ts-calibration file. Kind of a pain as you have to load up WM, then GBX0B to make the file at boot time (and it wasn't as accurate as the HTC one), copy it , and then reload the GBX and paste it.

BTW on the nand version (GBX0* + 3.3.x kernel) it needs to be placed in /data/
 
Last edited:
  • Like
Reactions: Caldair

Caldair

Senior Member
Dec 28, 2008
616
673
123
Ha! :D Sorry, I just found it today. Your problem was prbably that you looked virtually everywhere! ;) It does seem an odd place for the file to be.
 

wizardknight

Senior Member
Nov 1, 2009
1,001
293
113
Seattle WA
I was taking a look at the data and time stamps on calibration_points, and it seems that there is a script somewhere that takes ts-calibration and overwrites calibration_points at boot time. If that is correct disabling that overwrite would mean the app could work fine as-is.

Unfortunately just renaming the ts-calibration is not enough. During the boot process it creates a new one with a set of values.

I found this bit of code that might explain why we are seeing this overwriting.
http://gitorious.org/xdandroid/rootfs/merge_requests/4
 
Last edited:

Caldair

Senior Member
Dec 28, 2008
616
673
123
Part 1 locates the touch screen manager directory

Part 2 looks for ts-calibration in /data/ and if it finds it overwrites calibration_points
otherwise it creates a new ts-calibration using a default set of values and then overwrites calibration_points

So what we want to do is have it overwrite /data/ts-calibration with $touchscreendir/calibration_points as long as calibration has been completed previously within android.

Now I haven't really written code/scripts in a decade and am not yet too familiar with linux but something like:
(tiad8's commit, edited poorly by me)

## Ts Calibration
for i in /sys/class/input/input* ; do
if [ "`cat $i/name`" = "tssc-manager" ] ; then
touchscreendir=$i
echo "Touchscreen device directory is $i"
fi
done

if [ -f /data/ts-calibration ] ; then
echo "Using Saved Touchscreen Calibration"
echo 128,128,1903,128,128,1907,1903,1907,1024,1024 > $touchscreendir/calibration_screen
cat /data/ts-calibration > $touchscreendir/calibration_points
else
if [ -f "$touchscreendir/calibration_points"="0,0,0,0,0,0,0,0,0,0" ] ; then
echo "Using Default Calibration Values"
echo 821,860,197,868,500,517,829,172,191,171 > /data/ts-calibration
cat /data/ts-calibration > $touchscreendir/calibration_points
else
echo "Using Last Calibration Values"
echo 128,128,1903,128,128,1907,1903,1907,1024,1024 > $touchscreendir/calibration_screen
cat $touchscreendir/calibration_points > /data/ts-calibration
fi
fi

I am sure that my commands and syntax above are wrong, it's the concept that I am trying to convey.

I want to look to see if there is a ts-calibration and if not then look to see if there is valid calibration data in calibration_screen and if there is then write that value to ts-calibration. Thus to update calibration all you need to do is run HTC Calibration, and delete ts-calibration.

I guess you could also compare calibration_screen to ts-calibration and if there are differences (and calibration_screen is valid) have ts-calibration overwritten, removing the need to delete it!

I am assuming that before calibration or having ts-calibration written to it that calibration_screen has the value 0,0,0,0,0,0,0,0,0,0 but it could also be 0 or empty i don't know really and am probably wrong!

Also for GBX0C /data/ would have to be /sdcard/
 

CodaHighland

Senior Member
Feb 24, 2012
139
23
0
One major problem with that plan:

/sys/ isn't a real filesystem.

It's a virtual file system, like /proc/, created programmatically by kernel drivers. It's not stored anywhere.

That boot script is writing the node because that's the only way to get the data into the kernel. If you don't do that, the calibration gets purged (or more accurately, not initialized) every boot.

That's why I proposed a bind-mount: make an access to one place in the filesystem affect another place. Though I realize another problem with that... The driver doesn't read from the filesystem! You have to actually write to the node to get the data into the driver. So that busts that plan.

It might be theoretically possible to modify the kernel driver to signal a userspace process to copy that data out, but... I don't know what would go into that, or even if it's ideal.
 
  • Like
Reactions: Caldair

Caldair

Senior Member
Dec 28, 2008
616
673
123
I have been using the latest kernel, 3.4 with a new build of GBX0C and decided to re-calibrate my screen:

Strange.... When I went looking for calibration_points in /sys/devices/virtual/input/input3/ it wasn't there, it had moved to /sys/devices/virtual/input/input2/

Before I edit the first post can anyone who is using the 3.4 linux kernel confirm this, please?
 

arrrghhh

Inactive Recognized Developer
Feb 10, 2007
11,907
3,853
0
where to copy? does not have memory card
What does not have a memory card? The RHOD certainly has a slot for one...

Edit - I just realized why your question is so poorly worded. You're running NAND, and this thread assumes you're on a SD build.

I responded to you here.
 
Last edited:
  • Like
Reactions: Caldair

hijackzx1

Member
Dec 1, 2007
6
0
0
I recently started working on a Android based Car solution and decided to buy the MK802 units. My car used to have a Windows based PC, so I already have VGA touchscreens installed. I didnt want to replace the screens, so I bought a HDMI to VGA converter and the MK802.

I plugged the touchscreen into the MK802, assuming it wouldnt do anything. But sure enough, it works. Problem is the calibration is off and up and down are reversed. So say I tap the bottom of the screen, the mouse pointer appears on the top of the screen and vis versa. My understanding (Im very new to this) is that you have to be rooted, which is the way these devices come.

So my question is, will this calibration tool work? I know most Androids use a multi-touch screen. Mine are 4-wire touch panels. Also, what do I have to look for and edit to get Up to Up and Down to Down?

Thanks in advance!
 

wizardknight

Senior Member
Nov 1, 2009
1,001
293
113
Seattle WA
I recently started working on a Android based Car solution and decided to buy the MK802 units. My car used to have a Windows based PC, so I already have VGA touchscreens installed. I didnt want to replace the screens, so I bought a HDMI to VGA converter and the MK802.

I plugged the touchscreen into the MK802, assuming it wouldnt do anything. But sure enough, it works. Problem is the calibration is off and up and down are reversed. So say I tap the bottom of the screen, the mouse pointer appears on the top of the screen and vis versa. My understanding (Im very new to this) is that you have to be rooted, which is the way these devices come.

So my question is, will this calibration tool work? I know most Androids use a multi-touch screen. Mine are 4-wire touch panels. Also, what do I have to look for and edit to get Up to Up and Down to Down?

Thanks in advance!
This tool was made for HTC phones. You will need to find the group for your device to get support for it.
 
  • Like
Reactions: Caldair

syedwasi

New member
Nov 16, 2010
2
0
0
Calibration problem

Hello,
I am not able to calibrate screen on htc touch pro2 sprint modem (T7380) PocketPC
there is a software problem due to which i had to reset factory restore button inside handset ,and restarted device
but it stuck on calibrate option ,continuous prompt to press all 4 side and centre ,even though i had done multiple time
but no further progress ,would like to know how to come out from this problem
now the handset is completely not starting ...i am on calibrate mode screen.

please suggest any solution .
 

Caldair

Senior Member
Dec 28, 2008
616
673
123
Hello,
I am not able to calibrate screen on htc touch pro2 sprint modem (T7380) PocketPC
there is a software problem due to which i had to reset factory restore button inside handset ,and restarted device
but it stuck on calibrate option ,continuous prompt to press all 4 side and centre ,even though i had done multiple time
but no further progress ,would like to know how to come out from this problem
now the handset is completely not starting ...i am on calibrate mode screen.

please suggest any solution .
It sounds like you are having this issue with a Windows Mobile ROM and this thread is dedicated to Android on the Touch Pro2. However...

OFF TOPIC:
I had a similar problem with my old Acer M900 and the solution was to put an empty text file in the root (no folders) of your SD card and rename it welcome.not and this will bypass the screen calibration on your first boot. I was then able to successfully run the calibration afterwards from the settings menu. Here, to make it easy I attached the file here:View attachment welcome.zip. Simply unzip the file and place the file welcome.not on your storage card.​
 
Last edited:
  • Like
Reactions: wizardknight

isruco

Senior Member
Jul 31, 2009
52
4
0
Palm Springs
I take no credit for any of this, I have just put together things I have found on various threads.

As you all know the touch screen calibration that runs at boot does not work with any of the newer kernels as you cannot see some of the cross hairs to tap. I have personally NEVER been able to produce my own accurate ts-calibration file and have been using an ancient one that I downloaded back in the early days of FRX (thank you arrrghhh). Hopefully you have a somewhat functional ts-calibration file as you need to carry out this procedure from within Android. Here we go... (it's easy)

1. Download HtcCalibrate_WVGA.apk, thanks to lukas.pce, attached to first post here http://forum.xda-developers.com/showthread.php?t=1457343 to your device.

2. Install HtcCalibrate_WVGA.apk

3. Run HTC Calibrate and follow the instructions, tapping all the points (I used a toothpick for added accuracy)

4. When complete the app will report 'Calibration complete', tap 'Done'. Your screen should now be accurately calibrated for this session. Test to make sure it is working correctly before proceding to next step.

5. Now to get the calibration data to stick after reboot: Open your file explorer (MUST HAVE ROOT ACCESS; I use ES File Explorer with Menu>Settings>'Up to Root' checked) and navigate to /sys/devices/virtual/input/input3/ there you should see a file named calibration_points.
...
..

**Nand users see this (thanks wizardnight!):



Done. Your phone should now boot with the calibration data you created.
I have had a little bit of an alingment problem with my screen on my TP2. The NAND GBX works great so far. The only small but nevertheless important issue is finding a way to calibrate the screen and all Google searches lead back to the same forum post here , which has many files in the zip but NO apk inside.

Anyway, if anybody has any information of where to find an apk that will work, or maybe information on how to use the included files in the above mentioned link would be much appreciated.

My sincere thanks to all the developers that make all this modding possible, thank you all.:)
 

Caldair

Senior Member
Dec 28, 2008
616
673
123
I have had a little bit of an alingment problem with my screen on my TP2. The NAND GBX works great so far. The only small but nevertheless important issue is finding a way to calibrate the screen and all Google searches lead back to the same forum post here , which has many files in the zip but NO apk inside.

Anyway, if anybody has any information of where to find an apk that will work, or maybe information on how to use the included files in the above mentioned link would be much appreciated.

My sincere thanks to all the developers that make all this modding possible, thank you all.:)


I just redownloaded the WVGA calibration from the link you refered to here:
[URL="http://forum.xda-developers.com/showthread.php?t=1457343"]http://forum.xda-developers.com/showthread.php?t=1457343

And the file seems to be intact and unchanged.

Those attached files on said thread ARE apk's already, they don't need to be extracted, just installed on your TP2.:good: Hope that helps!