Bug 8435 - (int-155420) Strange readings from pressure sensitive applications using gtk.gdk.AXIS_PRESSURE
(int-155420)
: Strange readings from pressure sensitive applications using gtk.gdk.AXIS_PRES...
Status: NEW
Product: Desktop platform
gtk
: 5.0/(3.2010.02-8)
: N900 Maemo
: Unspecified normal with 40 votes (vote)
: ---
Assigned To: unassigned
: gtk-bugs
:
:
:
:
  Show dependency tree
 
Reported: 2010-01-23 12:06 UTC by anders_gud
Modified: 2012-04-05 00:40 UTC (History)
8 users (show)

See Also:


Attachments
pressure.py test script (1.19 KB, text/x-python)
2010-01-23 12:12 UTC, anders_gud
Details
Test case in C (1.34 KB, text/plain)
2010-04-20 15:16 UTC, Alberto Garcia Gonzalez
Details
Graphical test case in python (3.10 KB, application/octet-stream)
2010-05-16 23:22 UTC, Doug Woodrow
Details


Note

You need to log in before you can comment on or make changes to this bug.


Description anders_gud (reporter) 2010-01-23 12:06:45 UTC
SOFTWARE VERSION:
n900 2.2009.51-1

EXACT STEPS LEADING TO PROBLEM: 
applications using gtk.gdk.AXIS_PRESSURE 

EXPECTED OUTCOME:
pressure readings ranging from 0 to appr. 0.700 (should be 1)

ACTUAL OUTCOME:
inverted pressure readings ranging from appr. 0.250 to 0

REPRODUCIBILITY:
always

EXTRA SOFTWARE INSTALLED:

OTHER COMMENTS:
discovered when working on mypaint 0.7.1 port to Fremantle
http://talk.maemo.org/showthread.php?t=41807

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; sv-SE; rv:1.9.1.7)
Gecko/20100106 Ubuntu/9.10 (karmic) Firefox/3.5.7
Comment 1 anders_gud (reporter) 2010-01-23 12:12:11 UTC
Created an attachment (id=2105) [details]
pressure.py test script

Run this on a n900 device and read the output.
Comment 2 Andre Klapper maemo.org 2010-02-02 22:26:37 UTC
Thanks for reporting this (and especially the testcase!).
Comment 3 xman 2010-02-08 18:12:54 UTC
*** This bug has been confirmed by popular vote. ***
Comment 4 Thomas Perl 2010-02-08 18:17:52 UTC
I can confirm this bug. I had to disable pressure sensitivity on MaePad for
Fremantle because of this. Are the invalid pressure readings reliable, i.e. can
I calculate .7-(range/.25*.7) to get the "old" pressure value?

I'd like to work around this bug in my application until it's fixed, so
pressure sensitivity is possible on Fremantle, too.
Comment 5 anders_gud (reporter) 2010-02-08 19:02:32 UTC
I dont even know if it GTK, X or driver related bug. Liqbase uses the pressure
values right (?)- maybe one should ask lcuk's opinion on this...
All I know is that mypaint on diablo worked great with dynamic brushes and that
those readings varied from 0 to appr. 0.700.
Comment 6 Thomas Perl 2010-03-20 19:55:36 UTC
I don't even get any useful values out of the pressure.py script (or using
gdk_event_get_axis() with GDK_AXIS_PRESSURE) right now.

Is there a workaround available? I'd really *love* to get pressure sensitivity
back into MaePad :) The method of scaling the value does not work, as the
values I get here seem to be random and not dependent on pressure at all :/

Is there any useful data I can provide to help bring the internal bug forward?
Comment 7 Alberto Garcia Gonzalez 2010-04-20 15:16:49 UTC
Created an attachment (id=2640) [details]
Test case in C

I'm looking into this, but I don't think this is a bug in GTK. Here's a test
case in C for what it's worth.
Comment 8 Doug Woodrow 2010-05-16 23:22:30 UTC
Created an attachment (id=2718) [details]
Graphical test case in python

Presents graphical display of current pressure reading.  Adapts dynamically to
minimum and maximum pressures read so far.
Comment 9 Thomas Perl 2010-05-18 01:22:39 UTC
(In reply to comment #8)
> Presents graphical display of current pressure reading.  Adapts dynamically to
> minimum and maximum pressures read so far.

Thanks, I've tried it. Values here for comparison:

MIN: 0.22509765625
MAX: 0.01611328125

Apart from that, the value changes does not really correspond to the pressure
applied to the screen. Another thing to note is that the value declines when
reaching the left and right edge of the screen. The pressure readings also
increase when placing a second finger on the screen when one finger already
touches the screen.

This behaviour is both in 2.2009.51-1 and the leaked PR1.2 (10.2010.12-9), so
it's very likely in 3.2010.02-8 as well (updating the version field
accordingly).
Comment 10 Doug Woodrow 2010-05-18 02:02:39 UTC
(In reply to comment #9)
> the value changes does not really correspond to the pressure
> applied to the screen.

Hi Thomas.  It certainly seems a bit erratic for me, but it sort of works - for
instance if I press hard then reduce pressure gradually then increase again the
bar moves down and up accordingly.  


> Another thing to note is that the value declines when
> reaching the left and right edge of the screen.

Not quite sure what you mean by that.  I think you're describing what I meant
when I said the program "adapts dynamically".  This is so that the leftmost
position corresponds to the minimum pressure obtained so far, and the rightmost
position corresponds to the maximum pressure.

The pressure p is converted to a value between 0 and 1 using the formula:
value = (p-min) / (max-min)


> The pressure readings also
> increase when placing a second finger on the screen when one finger already
> touches the screen.

Yes, well I guess that's fair enough.  I actually managed to get a maximum
pressure of 0.0 by pressing very hard with 2 fingers.

For what it's worth, my minimum reading so far has been 0.3515625, and the
maximum reading (apart from 0.0) was 0.00048828125
Comment 11 Thomas Perl 2010-05-18 13:59:53 UTC
(In reply to comment #10)
> Hi Thomas.  It certainly seems a bit erratic for me, but it sort of works - for
> instance if I press hard then reduce pressure gradually then increase again the
> bar moves down and up accordingly.

Yes, but it's not something that can be used as input data for
pressure-sensitive drawing apps (or at least I don't see how..).

> > Another thing to note is that the value declines when
> > reaching the left and right edge of the screen.
> 
> Not quite sure what you mean by that.  I think you're describing what I meant
> when I said the program "adapts dynamically".

I'm talking about the physical position of the press on the screen. You should
see the effect when you swipe your finger from the left edge of the screen all
the way to the right edge of the screen.
Comment 12 whyoh 2010-06-15 22:06:55 UTC
re comment #9, based on homebrew Nintendo DS experience, you do get a drop in
pressure readings at the edges.  also you get much bigger pressure readings by
using a finger instead of a stylus or by touching two points.

+1 for getting this sorted :-)  (the actual reported problem, not the edges and
multi-touch things)
Comment 13 whyoh 2010-06-15 22:10:17 UTC
also, presumably this means we can close bug 4256?

just thought i'd mention it as that bug might have examples which let us
examine values at a level below gtk - could be helpful for diagnosis?
Comment 14 Aniello Del Sorbo 2010-07-19 06:22:43 UTC
In Xournal I read the pressure this way:


  if (!gdk_event_get_axis (event, GDK_AXIS_PRESSURE, &rawpressure)) {
      rawpressure = (((GdkEventMotion *)event)->state & GDK_BUTTON1_MASK) ?
1:0;
  }

  rawpressure = 1.00-10*rawpressure;

I figured out I should *amplify* the raw pressure and then invert the values.
Comment 15 gerhard.eichhorn 2012-04-05 00:40:07 UTC
I've found a similar behaviour with:
cat /dev/input/ts | od -x | grep 0018
(as root)

Pressure is inversed.
So the problem is the driver.