How to configure tslib for use with finger input

bluscape
Tslib is working fine when I use a stylus to touch objects on the screen.
But when I touch the objects with my finger it does not respond that well.
The objects are large enough such that they cover the area of my finger tip

I guess my finger generates quite a bit of jitter/noise due to several
points being activated within a short time period.

How can I increase the sensitivity of tslib when operating the touchscreen
with a finger?

I've tried different values for the parameters in ts.conf but would like to
know what would be the best way or settings.

Juergen Beisert
You should first have a look to the raw data the touchscreen driver sends
to the tslib when you are using your fingers. The little tool "evtest" can
help you. If you have an idea what kind of "broken" data the touchscreen
driver generates, you can adapt the touchscreen's platformdata. You can try
to change the time between the x and y scan or configure the driver to do
more than one scan per measurement. Maybe these steps help to get more
accurate position data.

Laurent
I have been facing the same problem. 

It seems I could improve this by adding the "skip" plugin
(https://lists.berlios.de/pipermail/tslib-general/2008-November/000149.ht...
basically allow to skip n samples at the beginning and/or the end of a
press/release session. my current ts.conf is as follow ;

module_raw input

module pthres pmin=1
module variance delta=30
module dejitter delta=100
module skip nhead=3 ntail=1
module linear

However, i'd like to get some more feedback on how people solve this.

fatbrain
Hi Laurent

I tried the skip module and it only work for me for the baby and the ring
fingers. Any ideas to what will be the values for nhead and ntail
parameters so it detects the index and middle fingers. 


thanks
--fatbrain

Laurent
hi,

Indeed, it doesn't work perfectly. Actually, it works pretty well when you
point your finger at 90° relative to the screen. This way, the surface in
contact with the screen is reduced and chances are you'll hit the screen
with the tip of your nail, which is very similar to a stylus.


From my observation, the faulty points occurs when your finger don't apply
enough pressure on the screen. This happens when your finger reach and/or
leave the screen. You can check with ts_test (in draw mode). As long as you
press hard enough on the screen, the drawed line correctly follow your
finger, but as soon as you release the pressure, the line have a tendancy
to move back and fortth to the center of the screen which is what causes
faulty hits.

>How can I increase the sensitivity of tslib when operating the touchscreen
with a finger?
Actually i think we have to lower the sensitivity of the screen in order to
ignore low pressure touches.

From there, another thing i haven't tried yet, but which maybe help is to
not apply the tslib-nopressure patch (which, if i understand well, consider
any pressure > 1 as beeing = 1) and to use pthres plugin to ignore low
pressure touch. 
I'll give this a try tomorrow if i have enough time.

Laurent

Laurent
btw, are you also playing with the 7" display ?

bluscape
Thanks for the replies guys!

Laurent, I'm not sure who you are asking, but I'm using a 3.5" display.

fatbrain
Hi Laurent
I'm using a 4.3 inch display on a mini2440. What i observed is ,you have to
apply quite a lot of pressure for the touchscreen to register the index and
the middle finger. My requirements are  to detect all the fingers without
applying to much pressure at all . My touch areas in my app are pretty
large and are as big as the middle finger. I not looking at the  accuracy
of the coordinates but it is far more important to detect a touch event
with as less pressure as possible.

Any suggestions?

thanks
--fatbrain

Laurent
well, first i wanted to put some threshold on the pressure but this seems
impossible as it seems touchscreen and/or kernel doesn't give pressure
information. So this was a no-way :-(

I checked deeper in the kernel and it seems s3c2410_ts.c (the touchscreen
driver) changed quite a lot between the 2.6.32 i was using (openembedded)
and the 'latest' 2.6.39 as supplied by ptxdist. The major differences
beeing the version i was using implement some filtering at kernel level 
(group, median, mean & linear). Filters parameters are configurable in
mach-mini2440.c. The driver supplied by ptxdist doesn't do any filtering at
all. 
At first i played with the different parameters of the kernel build-in
filter without much success.

Luckily, i'm learning ptxdist since a couple of weeks and i thought it
would be worth to give a try to the latest kernel :-) 
With ptxdist 2.6.39 kernel and the following ts.conf I have the feelings
things improved quite a lot, but it's late already here and i may just take
my wishes for reality ... Moreover i'm not using the same display as at the
office, i'm on a W35 here.

Here is my ts.conf :
module_raw input                                                          
module pthres pmin=1                                                  
module skip nhead=4 ntail=4                                        
module variance delta=30                                       
module dejitter delta=10                                                 
module linear        

it seems increasing skip head & tail gives the best improvement, with the
side effect you need to push a bit harder on the screen.

What i'd like to know is which kernel version you're using so we can
compare our result more objectively.

I hope we'll get some results soon !

Laurent

fatbrain
Hi Laurent,
 I'm using  ptxdist 2.6.39 kernel. I will try these setting out and let you
know. 
I have the N43 and the T35 displays and currently working on N43. 

thanks 
--fatbrain

Juergen Beisert
Laurent,

the touchscreen driver you find in my ptxdist kernel is mostly the one from
mainline plus a race fix I found when the processor is under high load.
It is never a good idea to do filtering in the kernel driver. A driver
should be as simple as possible. So, the tslib is the correct location to
process the touchscreen coordinates to make it more smooth.

Laurent
Dear Juergen,

>It is never a good idea to do filtering in the kernel driver.
Indeed, i totally agree with you. I saw people complaining that filtering
in tslib is not really effective. My guess is that they work with a kernel
already doing filtering, so tslib tries to filter already filtered data
which is indeed not really effective ...

This is one more reason for me to start using ptxdist more intensively.
Btw, thank you for your great work with the bsp and the great support you
provide !


Still looking for the best method to filter finger clicks ...


Laurent

Juergen Beisert
With a touchscreen driver extension it would be also possible to measure
the pressure. Would that help? Maybe its not worth the work.

Laurent
Hi Juergen,

Could you explain what you mean by a touchscreen driver extension ? I think
that if we could receive accurate pressure information from the touchscreen
we could easily sort the bad touches. But I have no idea how this is
possible nor if the hardware allows this.

From what i understand, the touchscreen returns totally unacurate positions
when the pressure is too low. This happens 99% when you use your finger
because the surface in contact with the screen is much more larger than
with a stylus (P=F/S). 
The sequence of evenements when you touch with a finger is as follow :

finger down :
low pressure random positions
finger press harder
high pressure grouped positions
finger up :
low pressure random events while finger is releasing pressure
no pressure 

As you can see you get random position both when the finger reach the
screen (mousePress) and when it leaves the screen (mouseRelease). This is
why ignoring the heading & trailing events (with the skip module) improve
things. However, there are still some random events passing through the
skip module (slow finger approach and/or release, fingers not pressing hard
enough on the screen, ...) 

The problem is that you cannot tell the differences between a stylus moving
randomly on the screen which should be considered valid and a finger
pressing not hard enough giving random position which should be considered
invalid.

The only solutions i could think of are :
- have some pressure information available and dismiss all 'low pressure'
touches
- write a new tslib plugin that would implement a sort of 'group' filter.
The idea beeing to calculate the center of a circle and to return this
position. That circle would have a diameter equals to the finger surface.
The filter would have to calculate the center of that circle given the
position returned by the touchscreen. The goal beeing to put as most as
possible points inside the circle while dismissing the ones beeing out of
the circle. I hope this is clear. Basically it's a kind of 'maximum points
inside a moving circle' filter.

One thing to remember is that we don't need 'mouse move' kind of events.
All we need is 'click' events. The application is a kind of pos terminals
with a lot of buttons on the screen.

I may just drop this on the side and come back to it with a fresh mind in a
couple of weeks as i'm loosing time without real improvements now.

Laurent

Juergen Beisert
An extension of this driver would mean to add a third measurement cycle.
The X and Y position is detected by an internal statemachine in the
silicon. The pressure measure must be triggered in software.

Take a look here:
http://www.adafruit.com/datasheets/AVR341.pdf, section 2.2

This would be possible to do also with the S3c6410/S3C2440 controller. Only
the switches for VCC and GND must be handled in software, as it is not
supported by the internal statemachine.

Laurent
Thanks a lot for this great information !

Laurent

fatbrain
Hi Laurent,
  Today I booted the stock linux which comes with T35 and W35 and the touch
experience was much better then ptxdist kernel. Touch was registered with
minimal pressure and using all the fingers. So what ever the stock kernel
does for touch works extremely well. I test this for 
mini6410, and mini2440 with T35 & W35 displays.

thanks
--fatbrain

laurent
Attachment: group.c (5.31 KB)
Hi,

Can't try the stock linux right now, but i will certainly do.

I have spend some time writing a custom plugin for tslib. You can find it
attached, please feel free to give it a try.

What it does is keeping an history of the n last points (n is param
nbpoints in ts.conf). Then, for each of those points, it finds the one
that, have the most other points around it at a max distance (param radius
in ts.conf). If the maximum number of points around a given point is > to a
maximum (param threshold in ts.conf), then it consider this given point as
valid and send it to the upper layer.

You can picture this as a dart game. given n darts, the plugin return the
position of the dart that have the most dart close to it (close beeing
closer than a maximum distance). If no darts is found with at least m darts
close to it then the best dart from the previous game is returned. 

I haven't made a patch, just put group.c in the plugins folder and modify
plugins/Makefile.am & configure.ac as you did for the skip filter.

sample ts.conf :

module_raw input
module pthres pmin=1
module group radius=10 nbpoints=16 threshold=12
#module variance delta=30
module dejitter delta=10
module linear

I'll try it tomorrow on a 7" display but it seems to give good result on a
3.5"

Laurent