Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 190749
b: refs/heads/master
c: 250d377
h: refs/heads/master
i:
  190747: 27a1299
v: v3
  • Loading branch information
Rafi Rubin authored and Jiri Kosina committed May 3, 2010
1 parent ea10bbd commit 024e96b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5a38f2c7c4dd53d5be097930902c108e362584a3
refs/heads/master: 250d377522fd81459a4ea2350a794b453f37ce7d
29 changes: 21 additions & 8 deletions trunk/drivers/hid/hid-ntrig.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ struct ntrig_data {
/* Incoming raw values for a single contact */
__u16 x, y, w, h;
__u16 id;
__u8 confidence;

bool tipswitch;
bool confidence;
bool first_contact_touch;

bool reading_mt;
__u8 first_contact_confidence;

__u8 mt_footer[4];
__u8 mt_foot_count;
Expand Down Expand Up @@ -141,9 +143,10 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
case 0xff000001:
/* Tag indicating the start of a multitouch group */
nd->reading_mt = 1;
nd->first_contact_confidence = 0;
nd->first_contact_touch = 0;
break;
case HID_DG_TIPSWITCH:
nd->tipswitch = value;
/* Prevent emission of touch until validated */
return 1;
case HID_DG_CONFIDENCE:
Expand Down Expand Up @@ -171,10 +174,14 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
* to emit a normal (X, Y) position
*/
if (!nd->reading_mt) {
input_report_key(input, BTN_TOOL_DOUBLETAP,
(nd->confidence != 0));
/*
* TipSwitch indicates the presence of a
* finger in single touch mode.
*/
input_report_key(input, BTN_TOUCH,
(nd->confidence != 0));
nd->tipswitch);
input_report_key(input, BTN_TOOL_DOUBLETAP,
nd->tipswitch);
input_event(input, EV_ABS, ABS_X, nd->x);
input_event(input, EV_ABS, ABS_Y, nd->y);
}
Expand Down Expand Up @@ -213,7 +220,13 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,

/* emit a normal (X, Y) for the first point only */
if (nd->id == 0) {
nd->first_contact_confidence = nd->confidence;
/*
* TipSwitch is superfluous in multitouch
* mode. The footer events tell us
* if there is a finger on the screen or
* not.
*/
nd->first_contact_touch = nd->confidence;
input_event(input, EV_ABS, ABS_X, nd->x);
input_event(input, EV_ABS, ABS_Y, nd->y);
}
Expand Down Expand Up @@ -243,7 +256,7 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,

nd->reading_mt = 0;

if (nd->first_contact_confidence) {
if (nd->first_contact_touch) {
switch (value) {
case 0: /* for single touch devices */
case 1:
Expand Down

0 comments on commit 024e96b

Please sign in to comment.