diff options
author | Rafi Rubin <rafi@seas.upenn.edu> | 2009-06-23 14:09:26 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2009-07-22 19:28:01 -0400 |
commit | 837b47533a6476ab3fb96b1f52edd3ce9f3162b8 (patch) | |
tree | 73bcac56f0e4fd0d347fe91a9a28c6bdfad6bc72 /drivers/hid/hid-ntrig.c | |
parent | 8b424887b603e953af7238fef96629424dc915cb (diff) |
HID: ntrig tool separation and pen usages
When both touch and pen are active send a tool announcement before
sending any status changes so that event users may differentiate
which tool is changing.
Restored three usage codes used by the pen.
Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
Acked-by: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-ntrig.c')
-rw-r--r-- | drivers/hid/hid-ntrig.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index 75ed9d2c1a3..d7b3e61fbf8 100644 --- a/drivers/hid/hid-ntrig.c +++ b/drivers/hid/hid-ntrig.c | |||
@@ -27,6 +27,9 @@ | |||
27 | struct ntrig_data { | 27 | struct ntrig_data { |
28 | __s32 x, y, id, w, h; | 28 | __s32 x, y, id, w, h; |
29 | char reading_a_point, found_contact_id; | 29 | char reading_a_point, found_contact_id; |
30 | char pen_active; | ||
31 | char finger_active; | ||
32 | char inverted; | ||
30 | }; | 33 | }; |
31 | 34 | ||
32 | /* | 35 | /* |
@@ -63,10 +66,7 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
63 | case HID_UP_DIGITIZER: | 66 | case HID_UP_DIGITIZER: |
64 | switch (usage->hid) { | 67 | switch (usage->hid) { |
65 | /* we do not want to map these for now */ | 68 | /* we do not want to map these for now */ |
66 | case HID_DG_INVERT: /* value is always 0 */ | ||
67 | case HID_DG_ERASER: /* value is always 0 */ | ||
68 | case HID_DG_CONTACTID: /* value is useless */ | 69 | case HID_DG_CONTACTID: /* value is useless */ |
69 | case HID_DG_BARRELSWITCH: /* doubtful */ | ||
70 | case HID_DG_INPUTMODE: | 70 | case HID_DG_INPUTMODE: |
71 | case HID_DG_DEVICEINDEX: | 71 | case HID_DG_DEVICEINDEX: |
72 | case HID_DG_CONTACTCOUNT: | 72 | case HID_DG_CONTACTCOUNT: |
@@ -125,6 +125,18 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, | |||
125 | 125 | ||
126 | if (hid->claimed & HID_CLAIMED_INPUT) { | 126 | if (hid->claimed & HID_CLAIMED_INPUT) { |
127 | switch (usage->hid) { | 127 | switch (usage->hid) { |
128 | |||
129 | case HID_DG_INRANGE: | ||
130 | if (field->application & 0x3) | ||
131 | nd->pen_active = (value != 0); | ||
132 | else | ||
133 | nd->finger_active = (value != 0); | ||
134 | return 0; | ||
135 | |||
136 | case HID_DG_INVERT: | ||
137 | nd->inverted = value; | ||
138 | return 0; | ||
139 | |||
128 | case HID_GD_X: | 140 | case HID_GD_X: |
129 | nd->x = value; | 141 | nd->x = value; |
130 | nd->reading_a_point = 1; | 142 | nd->reading_a_point = 1; |
@@ -147,7 +159,11 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, | |||
147 | * report received in a finger event. We want | 159 | * report received in a finger event. We want |
148 | * to emit a normal (X, Y) position | 160 | * to emit a normal (X, Y) position |
149 | */ | 161 | */ |
150 | if (! nd->found_contact_id) { | 162 | if (!nd->found_contact_id) { |
163 | if (nd->pen_active && nd->finger_active) { | ||
164 | input_report_key(input, BTN_TOOL_DOUBLETAP, 0); | ||
165 | input_report_key(input, BTN_TOOL_DOUBLETAP, 1); | ||
166 | } | ||
151 | input_event(input, EV_ABS, ABS_X, nd->x); | 167 | input_event(input, EV_ABS, ABS_X, nd->x); |
152 | input_event(input, EV_ABS, ABS_Y, nd->y); | 168 | input_event(input, EV_ABS, ABS_Y, nd->y); |
153 | } | 169 | } |
@@ -159,6 +175,14 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, | |||
159 | * to emit a normal (X, Y) position | 175 | * to emit a normal (X, Y) position |
160 | */ | 176 | */ |
161 | if (! nd->found_contact_id) { | 177 | if (! nd->found_contact_id) { |
178 | if (nd->pen_active && nd->finger_active) { | ||
179 | input_report_key(input, | ||
180 | nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN | ||
181 | , 0); | ||
182 | input_report_key(input, | ||
183 | nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN | ||
184 | , 1); | ||
185 | } | ||
162 | input_event(input, EV_ABS, ABS_X, nd->x); | 186 | input_event(input, EV_ABS, ABS_X, nd->x); |
163 | input_event(input, EV_ABS, ABS_Y, nd->y); | 187 | input_event(input, EV_ABS, ABS_Y, nd->y); |
164 | input_event(input, EV_ABS, ABS_PRESSURE, value); | 188 | input_event(input, EV_ABS, ABS_PRESSURE, value); |
@@ -233,6 +257,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
233 | 257 | ||
234 | if (ret) | 258 | if (ret) |
235 | kfree (nd); | 259 | kfree (nd); |
260 | |||
236 | return ret; | 261 | return ret; |
237 | } | 262 | } |
238 | 263 | ||