Release Precise touchscreen calibration


dimag0g

Very Active Member
Joined
Jan 12, 2011
Messages
608
Location
Strasbourg, France
Hello all,

Here is a little update to tslib library I was working on. On my system it cures most touchscreen-related problems. Using mouse-oriented interfaces became a lot more fun, as well as drawing and playing Starcraft :) Hope it'll do the same for you.

The tricky part is the new calibration utility which tries to record an accurate pressure profile during calibration. Basically, you have to put the stylus on the cross, then gradually increase the pressure to the max, then gradually decrease the pressure, all without moving the stylus. Decreasing is especially tricky, but hey, you only calibrate once!

PND file is now on the repo. Sources are inside the PND.

PS: For those who wonder if this could help them. If you have a cursor shifting when you change touch pressure, this is for you. If you click in the corner and end up selecting a small rectangle instead of a proper click, this should help as well. If sometimes you do two distinct clicks and instead you get a selection bound by those two clicks, this update should reduce the odds of this happening (if it still happens, edit /etc/ts.conf and decrease maxdelay to 50...100).

Any other issues you may have will probably not be addressed.

PPS: If you have bugs to report, please consider attaching your /etc/pointercal file and/or a small log from ts_print_raw recoded during the bug, if you think these files would be relevant to the problem.
 
Last edited by a moderator:
It's like a challenge at the beginning !! You should add a scoreboard to show who is the fastest calibrator !! :D

Anyway works like a charm !! Thank you !!

I've never seen the pointer so precisely under the stylus everywhere on the entire display !!
 
Any chance of getting this on the repo?
Yes, once it is confirmed that it doesn't crash XFCE for anyone. With an early version of the installer, I once had to login via tty to fix the mess, and it was impossible to start any GUI.

In the long run, if this proves useful for many pandoras, I hope to have this included in the firmware.
 
Does not work here, tried many times... cant get the first point to work (pressing: fast, slow, short, long...) . Dont know but when lifting the stylus makes the "cross" animate from the upper left corner to it's original position.
 
Does not work here, tried many times... cant get the first point to work (pressing: fast, slow, short, long...) . Dont know but when lifting the stylus makes the "cross" animate from the upper left corner to it's original position.
The animation is made specifically to tell you that the calibration utility has discarded the last point and you have to try again. It actually makes your life much easier, because making one successful touch is easier than to make 5 successful touches in a row - once you made the first point, you have to work on the second one, etc.

If you're comfortable with command line, you can run ts_print_raw and make a touch with the stylus. The raw data then will be printed in the format "time, x coordinate, y coordinate, pressure", so you will see what exactly your touch is worth. In order to be suitable for calibration, your touch must produce more than 10 samples, the sample with maximum pressure must be at least 3 samples apart from beginning/end, and the first/last sample's pressure must be less than 3/4 of the maximum pressure achieved. Moreover, samples with pressure less than 1/4 of the maximum get discarded.

I could make validation conditions less strict, so calibration will be easy, but that would affect the resulting precision I'm afraid. And there is no point in releasing a "decent precision" version because the original tslib already does that. People won't see much of improvement (or worse, a loss in precision) and lose all interest.

Maybe people who have successfully calibrated could post their /etc/pointercal files here, and you could try one of these? I'd like to try it myself because I'm interested how different pandora touchscreens are, but I doubt it will be useful in practice. There is a reason they make you calibrate your touchscreen on YOUR pandora when you first boot.
 
Last edited by a moderator:
Calibration worked quite well (after a little practice).

Unfortunately this didn't help with the problems I had with Kami Retro and selecting units in Starcraft on my device. :(

Simple pointing is very acurate though...
 
Calibration worked quite well (after a little practice).

Unfortunately this didn't help with the problems I had with Kami Retro and selecting units in Starcraft on my device. :(

Simple pointing is very acurate though...
Could you please describe the problems you are having in more details? I can only fix something I know about.

Another question - is simple pointing noticeably more accurate than before? Is there a significant improvement?
 
Hy dimag0g!

I don't know if this will be fixable by the calibration so you probably won't be able to do something against it:

In StarCraft when drawing a rectangle around units the selection occurs too early while I am still dragging so not all unites I wanted to are selected.

In Kami Retro It's very hard to hit the little guy right to make him jump - I guess it's the same reason: The touchscreen sometimes "loosing touch" while dragging.

(There were a couple of people having trouble like this a there was a thread about it last year or so - but I can't find it ATM).

I've been calibrating an testing several times with harder and softer pressure while calibrating but I couldn't fix this.

Acuracy while pointing is just perfect! I can't really say if it's better than before but it's definitely not worse (and couldn't be better IMHO)!

Anyway - thanks for making this.
 
Last edited by a moderator:
Gandi,

Here's what you can do. Open a terminal and run ts_print_raw > /tmp/ts_log. Don't close the terminal and start the program which has bugs, preferably with as little touchscreen interaction as possible (using nubs perhaps). When you're ready for the action, go on and try to reproduce the bug using touchscreen. Once the bug has been reproduced, quit the program, again, without using touchscreen. After that, briefly touch the 4 corners of the display and the middle (so I will see this sequence just after the bug). Now close the terminal and PM me the log file.

I don't promise anything, but at least I will be able to say if I can fix this or not. In fact, I'm surprised to hear you have such a problem, because on my pandora it was the opposite - two consecutive touches were often merged into one, like if I was dragging the stylus between two clicks. So I actually added a few pen_up events in the code to cope with my problem, but I may have made yours worse.
 
Does not work here, tried many times... cant get the first point to work (pressing: fast, slow, short, long...) . Dont know but when lifting the stylus makes the "cross" animate from the upper left corner to it's original position.
itami, I also forgot one more thing - you should go to the maximum pressure during each calibration touch. Maybe you weren't pushing hard enough... Although don't overdo it, the stylus shouldn't go through the screen :) You can use ts_print_raw to see for yourself at what force the touchscreen pressure gets saturated.
 
Does not work here, tried many times... cant get the first point to work (pressing: fast, slow, short, long...) . Dont know but when lifting the stylus makes the "cross" animate from the upper left corner to it's original position.
The animation is made specifically to tell you that the calibration utility has discarded the last point and you have to try again. It actually makes your life much easier, because making one successful touch is easier than to make 5 successful touches in a row - once you made the first point, you have to work on the second one, etc.

If you're comfortable with command line, you can run ts_print_raw and make a touch with the stylus. The raw data then will be printed in the format "time, x coordinate, y coordinate, pressure", so you will see what exactly your touch is worth. In order to be suitable for calibration, your touch must produce more than 10 samples, the sample with maximum pressure must be at least 3 samples apart from beginning/end, and the first/last sample's pressure must be less than 3/4 of the maximum pressure achieved. Moreover, samples with pressure less than 1/4 of the maximum get discarded.


I could make validation conditions less strict, so calibration will be easy, but that would affect the resulting precision I'm afraid. And there is no point in releasing a "decent precision" version because the original tslib already does that. People won't see much of improvement (or worse, a loss in precision) and lose all interest.


Maybe people who have successfully calibrated could post their /etc/pointercal files here, and you could try one of these? I'd like to try it myself because I'm interested how different pandora touchscreens are, but I doubt it will be useful in practice. There is a reason they make you calibrate your touchscreen on YOUR pandora when you first boot.
I tried ts_print_raw, the pressure doesn't go below 237... Weird thing is: now if I click and don't move the stylus I see the cursor/pointer move horizontal very fast, when doing this with output the x coordinates changes rapidly between about 5 points. Releasing the stylus always shows x=10420 y=474. And when pressing at the bottomright side of the screen I see x=1001 and upperright x=846 upperleft shows x=-54 and lowerleft x=7 (these numbers are again with the rappid variations of about 5 points).
 
itami,

You got some weird stuff going on indeed, I don't even know where to start... In my experience, the raw pressure varies between 0 (stylus up, not touching the screen) and about 150 (stylus down, max pressure), and raw x and y values are always positive in range of about 400-4000 (although raw x/y values are not really important). There are a few things you could do:

1. Run ts_print_raw>/tmp/ts_logfile in background during calibration. A logfile would be easier for me to read than a description.

2. Uninstall my update by running the PND the second time, and then again run ts_print_raw>/tmp/ts_logfile in background during calibration. I'd like to see the original values you get. My update concerns tslib, not the driver, so in fact you should see similar values here.

3. Make sure you have the latest firmware. If not, please send me the file /lib/modules/3.2.xxx/input/touchscreen/ads7846.ko (it is 20925 bytes long on my system).

And please don't reflash right away. If there is a bug which only appears on your OS version, this is an opportunity to catch it.
 
Last edited by a moderator:
It works, but I don't know, whether it is better than before. But at least it is not worse!

However the hints are quite confusing.

I thought, I have to do this successive, not with one long stylus push... ^^'
 
It works, but I don't know, whether it is better than before. But at least it is not worse!
Maybe your touchscreen was all right from the beginning? Sure there is no improvement if there's nothing to improve. On my unit, the cursor was moving depending on the pressure, so I could not make proper clicks in the corners (I ended up selecting a region instead of a click). Could you post your /etc/pointercal? If the last 6 constants are small (<1000 <10 <10 <1000 <10 <10) that would mean you're better off with the old tslib.

If you can think of better hints during calibration, please write your suggestions here. They must be short enough to fit on one line. I would gladly include them in the calibration tool before pushing it to the repo.
 
Last edited by a moderator:
itami,

You got some weird stuff going on indeed, I don't even know where to start... In my experience, the raw pressure varies between 0 (stylus up, not touching the screen) and about 150 (stylus down, max pressure), and raw x and y values are always positive in range of about 400-4000 (although raw x/y values are not really important). There are a few things you could do:

1. Run ts_print_raw>/tmp/ts_logfile in background during calibration. A logfile would be easier for me to read than a description.

2. Uninstall my update by running the PND the second time, and then again run ts_print_raw>/tmp/ts_logfile in background during calibration. I'd like to see the original values you get. My update concerns tslib, not the driver, so in fact you should see similar values here.

3. Make sure you have the latest firmware. If not, please send me the file /lib/modules/3.2.xxx/input/touchscreen/ads7846.ko (it is 20925 bytes long on my system).

And please don't reflash right away. If there is a bug which only appears on your OS version, this is an opportunity to catch it.
Here the results:

updated:

threshold is now 1

1397971954.110797:   3941   3424    246

1397971954.118546:   3944   3426    247

1397971954.135998:   3947   3425    247

1397971954.152625:   3947   3425    248

1397971954.219217:   3948   3425    248

1397971954.302509:   3949   3426    248

1397971954.319200:   3948   3426    248

1397971954.335889:   3948   3425    248

1397971954.369178:   3948   3426    248

1397971954.385839:   3948   3425    248

1397971954.435791:   3949   3425    248

1397971954.452514:   3948   3424    248

1397971955.406860:      0      0      0

 

original:

1397972150.797517:   3940   3451    247

1397972150.815766:   3945   3453    248

1397972150.849120:   3945   3455    248

1397972150.865814:   3947   3459    248

1397972150.882507:   3948   3460    248

1397972150.899139:   3947   3460    248

1397972150.915771:   3948   3460    248

1397972150.932434:   3947   3460    248

1397972150.949127:   3944   3461    247

1397972150.968200:   3944   3461      0

 

As for the ads7846.ko file... it's missing. there isn't even a folder named input in 3.2.53.

 

But without your update the weird rapid horizontal moving is gone.
 
Could you determine which file is used on your system as touchscrdeen driver? Probably the one from /lib/modules/2.6.xxx/input. I will try to boot 2.6 kernel today to check how my modified tslib behaves.
 
Could you determine which file is used on your system as touchscrdeen driver? Probably the one from /lib/modules/2.6.xxx/input. I will try to boot 2.6 kernel today to check how my modified tslib behaves.
Hmm, also no input folder in 2.6.27.57-omap1.
 
Back
Top