Ticket #218 (closed enhancement: fixed)

Opened 11 years ago

Last modified 9 years ago

Distinguish stylus from finger via tslib

Reported by: mickey@… Owned by: openmoko-devel
Priority: low Milestone:
Component: kernel Version: unspecified
Severity: minor Keywords:
Cc: buglog@…, jserv@… Blocked By:
Blocking: Estimated Completion (week):
HasPatchForReview: no PatchReviewResult:


Nokia apparantly does it by measuring pressure. See the following snippet from
Maemo's tslib:

/* this ... is ugly.

  • basically, we need two things to support thumb cleanly:
  • - pressure filtering. because it's pressure-based, often we get
  • the following sequence: pen down, thumb down, thumb up, pen down,
  • thumb up. so we need to filter the first n events to see whether
  • we have a thumb event coming, and discard the first pen events if
  • so. we also need to check if we're trying to post a pen down
  • after a thumb down (without an intervening thumb up, and discard
  • it if so).
  • - accuracy filtering. the first n events just aren't going to be
  • accurate. so we need to discard them, which negates the call for
  • keeping the initial thumb events above. *
  • in addition to this, we need general stability filtering, so we take
  • a three-sample filtering, and discard the result if the total movement
  • is less than 4px in either direction. *
  • i'm really, really sorry. -daniels */

if (flags && private->holdEvents) {

/* Drop pen events after a thumb stream. */
if ((flags & KD_BUTTON_1) && (private->lastFlags & KD_BUTTON_8))

discard = 1;

/* Drop all our queued events if we have a thumb event in a

  • pen stream. */

if ((flags & KD_BUTTON_8) && (private->lastFlags & KD_BUTTON_1))

private->numHeldEvents = 0;

/* Run the queue if we're full; drop it on the floor if the total

  • four-sample difference is less than 4px in both directions. */

if (private->numHeldEvents >= TSLIB_QUEUE_SIZE) {

if (abs(private->lastx - LAST_EVENT.x) < 4 &&

abs(private->lasty - LAST_EVENT.y) < 4 &&
private->lastFlags) {
discard = 1;
private->numHeldEvents = 0;

else {




Change History

comment:1 Changed 11 years ago by koen@…

maemo has code in the xserver and in tslib to detect thumb presses. I suspect we
need to diff the stock pressure module and the one nokia wrote.

comment:2 Changed 10 years ago by jserv@…

  • Cc jserv@… added

comment:3 Changed 10 years ago by willie_chen@…

  • Owner changed from laforge@… to willie_chen@…

comment:4 Changed 10 years ago by willie_chen@…

  • Owner changed from willie_chen@… to michael@…

comment:5 Changed 10 years ago by roh

  • Owner changed from michael@… to michael

comment:6 Changed 9 years ago by john_lee

  • Owner changed from michael to tick
  • Status changed from new to assigned
  • HasPatchForReview unset

tick, you might be interested in this

comment:7 Changed 9 years ago by tick

  • Owner changed from tick to openmoko-devel

Theoretically speaking, this can be done by filtering the jitter of moving events.
The jitter effect with finger press is larger than that with stylus press.

Do we really need this?

comment:8 Changed 9 years ago by tick

  • Priority changed from high to low

comment:9 Changed 9 years ago by arhuaco

  • Status changed from assigned to closed
  • Resolution set to fixed

We fixed this with in-kernel filters.

comment:10 Changed 9 years ago by arhuaco

Sorry, we did not fix it... reopen it if you think it is still needed. Can we really do this in tslib?

comment:11 Changed 9 years ago by andy

I don't think the original poster cares about tslib they just assume it is where it would be done.

There exists the half-working area patches I sent on the list a couple of times, but nobody is working on getting them working across the whole display in a normalized way. On GTA03, we have capacitive touchscreen so we can't use the same tricks. So as it stands this is really WONTFIX.

Note: See TracTickets for help on using tickets.