aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-ntrig.c
diff options
context:
space:
mode:
authorRafi Rubin <rafi@seas.upenn.edu>2010-05-03 05:08:29 -0400
committerJiri Kosina <jkosina@suse.cz>2010-05-03 09:23:11 -0400
commit250d377522fd81459a4ea2350a794b453f37ce7d (patch)
tree094c9117466d345725f76e0064a3a4aede456fd6 /drivers/hid/hid-ntrig.c
parent5a38f2c7c4dd53d5be097930902c108e362584a3 (diff)
HID: ntrig: TipSwitch for single touch mode touch.
Include TipSwitch in the touch detection decision for some single touch firmwares. Confidence and InRange are high for all finger events including those used to indicate the finger is no longer in contact with the sensor. Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-ntrig.c')
-rw-r--r--drivers/hid/hid-ntrig.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 58ba0d3d8aa5..10b08d6ab37c 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -31,10 +31,12 @@ struct ntrig_data {
31 /* Incoming raw values for a single contact */ 31 /* Incoming raw values for a single contact */
32 __u16 x, y, w, h; 32 __u16 x, y, w, h;
33 __u16 id; 33 __u16 id;
34 __u8 confidence; 34
35 bool tipswitch;
36 bool confidence;
37 bool first_contact_touch;
35 38
36 bool reading_mt; 39 bool reading_mt;
37 __u8 first_contact_confidence;
38 40
39 __u8 mt_footer[4]; 41 __u8 mt_footer[4];
40 __u8 mt_foot_count; 42 __u8 mt_foot_count;
@@ -141,9 +143,10 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
141 case 0xff000001: 143 case 0xff000001:
142 /* Tag indicating the start of a multitouch group */ 144 /* Tag indicating the start of a multitouch group */
143 nd->reading_mt = 1; 145 nd->reading_mt = 1;
144 nd->first_contact_confidence = 0; 146 nd->first_contact_touch = 0;
145 break; 147 break;
146 case HID_DG_TIPSWITCH: 148 case HID_DG_TIPSWITCH:
149 nd->tipswitch = value;
147 /* Prevent emission of touch until validated */ 150 /* Prevent emission of touch until validated */
148 return 1; 151 return 1;
149 case HID_DG_CONFIDENCE: 152 case HID_DG_CONFIDENCE:
@@ -171,10 +174,14 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
171 * to emit a normal (X, Y) position 174 * to emit a normal (X, Y) position
172 */ 175 */
173 if (!nd->reading_mt) { 176 if (!nd->reading_mt) {
174 input_report_key(input, BTN_TOOL_DOUBLETAP, 177 /*
175 (nd->confidence != 0)); 178 * TipSwitch indicates the presence of a
179 * finger in single touch mode.
180 */
176 input_report_key(input, BTN_TOUCH, 181 input_report_key(input, BTN_TOUCH,
177 (nd->confidence != 0)); 182 nd->tipswitch);
183 input_report_key(input, BTN_TOOL_DOUBLETAP,
184 nd->tipswitch);
178 input_event(input, EV_ABS, ABS_X, nd->x); 185 input_event(input, EV_ABS, ABS_X, nd->x);
179 input_event(input, EV_ABS, ABS_Y, nd->y); 186 input_event(input, EV_ABS, ABS_Y, nd->y);
180 } 187 }
@@ -213,7 +220,13 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
213 220
214 /* emit a normal (X, Y) for the first point only */ 221 /* emit a normal (X, Y) for the first point only */
215 if (nd->id == 0) { 222 if (nd->id == 0) {
216 nd->first_contact_confidence = nd->confidence; 223 /*
224 * TipSwitch is superfluous in multitouch
225 * mode. The footer events tell us
226 * if there is a finger on the screen or
227 * not.
228 */
229 nd->first_contact_touch = nd->confidence;
217 input_event(input, EV_ABS, ABS_X, nd->x); 230 input_event(input, EV_ABS, ABS_X, nd->x);
218 input_event(input, EV_ABS, ABS_Y, nd->y); 231 input_event(input, EV_ABS, ABS_Y, nd->y);
219 } 232 }
@@ -243,7 +256,7 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
243 256
244 nd->reading_mt = 0; 257 nd->reading_mt = 0;
245 258
246 if (nd->first_contact_confidence) { 259 if (nd->first_contact_touch) {
247 switch (value) { 260 switch (value) {
248 case 0: /* for single touch devices */ 261 case 0: /* for single touch devices */
249 case 1: 262 case 1: