xref: /linux/Documentation/input/devices/ntrig.rst (revision e7d759f31ca295d589f7420719c311870bb3166f)
1.. include:: <isonum.txt>
2
3=========================
4N-Trig touchscreen Driver
5=========================
6
7:Copyright: |copy| 2008-2010 Rafi Rubin <rafi@seas.upenn.edu>
8:Copyright: |copy| 2009-2010 Stephane Chatty
9
10This driver provides support for N-Trig pen and multi-touch sensors.  Single
11and multi-touch events are translated to the appropriate protocols for
12the hid and input systems.  Pen events are sufficiently hid compliant and
13are left to the hid core.  The driver also provides additional filtering
14and utility functions accessible with sysfs and module parameters.
15
16This driver has been reported to work properly with multiple N-Trig devices
17attached.
18
19
20Parameters
21----------
22
23Note: values set at load time are global and will apply to all applicable
24devices.  Adjusting parameters with sysfs will override the load time values,
25but only for that one device.
26
27The following parameters are used to configure filters to reduce noise:
28
29+-----------------------+-----------------------------------------------------+
30|activate_slack		|number of fingers to ignore before processing events |
31+-----------------------+-----------------------------------------------------+
32|activation_height,	|size threshold to activate immediately		      |
33|activation_width	|						      |
34+-----------------------+-----------------------------------------------------+
35|min_height,		|size threshold below which fingers are ignored       |
36|min_width		|both to decide activation and during activity	      |
37+-----------------------+-----------------------------------------------------+
38|deactivate_slack	|the number of "no contact" frames to ignore before   |
39|			|propagating the end of activity events		      |
40+-----------------------+-----------------------------------------------------+
41
42When the last finger is removed from the device, it sends a number of empty
43frames.  By holding off on deactivation for a few frames we can tolerate false
44erroneous disconnects, where the sensor may mistakenly not detect a finger that
45is still present.  Thus deactivate_slack addresses problems where a users might
46see breaks in lines during drawing, or drop an object during a long drag.
47
48
49Additional sysfs items
50----------------------
51
52These nodes just provide easy access to the ranges reported by the device.
53
54+-----------------------+-----------------------------------------------------+
55|sensor_logical_height, | the range for positions reported during activity    |
56|sensor_logical_width   |                                                     |
57+-----------------------+-----------------------------------------------------+
58|sensor_physical_height,| internal ranges not used for normal events but      |
59|sensor_physical_width  | useful for tuning                                   |
60+-----------------------+-----------------------------------------------------+
61
62All N-Trig devices with product id of 1 report events in the ranges of
63
64* X: 0-9600
65* Y: 0-7200
66
67However not all of these devices have the same physical dimensions.  Most
68seem to be 12" sensors (Dell Latitude XT and XT2 and the HP TX2), and
69at least one model (Dell Studio 17) has a 17" sensor.  The ratio of physical
70to logical sizes is used to adjust the size based filter parameters.
71
72
73Filtering
74---------
75
76With the release of the early multi-touch firmwares it became increasingly
77obvious that these sensors were prone to erroneous events.  Users reported
78seeing both inappropriately dropped contact and ghosts, contacts reported
79where no finger was actually touching the screen.
80
81Deactivation slack helps prevent dropped contact for single touch use, but does
82not address the problem of dropping one of more contacts while other contacts
83are still active.  Drops in the multi-touch context require additional
84processing and should be handled in tandem with tacking.
85
86As observed ghost contacts are similar to actual use of the sensor, but they
87seem to have different profiles.  Ghost activity typically shows up as small
88short lived touches.  As such, I assume that the longer the continuous stream
89of events the more likely those events are from a real contact, and that the
90larger the size of each contact the more likely it is real.  Balancing the
91goals of preventing ghosts and accepting real events quickly (to minimize
92user observable latency), the filter accumulates confidence for incoming
93events until it hits thresholds and begins propagating.  In the interest in
94minimizing stored state as well as the cost of operations to make a decision,
95I've kept that decision simple.
96
97Time is measured in terms of the number of fingers reported, not frames since
98the probability of multiple simultaneous ghosts is expected to drop off
99dramatically with increasing numbers.  Rather than accumulate weight as a
100function of size, I just use it as a binary threshold.  A sufficiently large
101contact immediately overrides the waiting period and leads to activation.
102
103Setting the activation size thresholds to large values will result in deciding
104primarily on activation slack.  If you see longer lived ghosts, turning up the
105activation slack while reducing the size thresholds may suffice to eliminate
106the ghosts while keeping the screen quite responsive to firm taps.
107
108Contacts continue to be filtered with min_height and min_width even after
109the initial activation filter is satisfied.  The intent is to provide
110a mechanism for filtering out ghosts in the form of an extra finger while
111you actually are using the screen.  In practice this sort of ghost has
112been far less problematic or relatively rare and I've left the defaults
113set to 0 for both parameters, effectively turning off that filter.
114
115I don't know what the optimal values are for these filters.  If the defaults
116don't work for you, please play with the parameters.  If you do find other
117values more comfortable, I would appreciate feedback.
118
119The calibration of these devices does drift over time.  If ghosts or contact
120dropping worsen and interfere with the normal usage of your device, try
121recalibrating it.
122
123
124Calibration
125-----------
126
127The N-Trig windows tools provide calibration and testing routines.  Also an
128unofficial unsupported set of user space tools including a calibrator is
129available at:
130http://code.launchpad.net/~rafi-seas/+junk/ntrig_calib
131
132
133Tracking
134--------
135
136As of yet, all tested N-Trig firmwares do not track fingers.  When multiple
137contacts are active they seem to be sorted primarily by Y position.
138