[Bug 218] New: Distinguish stylus from finger via tslib
bugzilla-daemon at bugzilla.openmoko.org
bugzilla-daemon at bugzilla.openmoko.org
Tue Feb 27 21:35:55 CET 2007
http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=218
Summary: Distinguish stylus from finger via tslib
Product: OpenMoko
Version: unspecified
Platform: Neo1973
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: kernel
AssignedTo: laforge at openmoko.org
ReportedBy: mickey at vanille-media.de
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 {
TsRunQueue(pi);
}
}
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
More information about the buglog
mailing list