Skip to content

Commit b0549cf

Browse files
rafiyrJiri Kosina
authored andcommitted
HID: n-trig: remove unnecessary tool switching
With the pen and touch split apart, we no longer need to inject additional tool switching events. Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 943ed46 commit b0549cf

1 file changed

Lines changed: 1 addition & 40 deletions

File tree

‎drivers/hid/hid-ntrig.c‎

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
struct ntrig_data {
2828
__s32 x, y, id, w, h;
2929
bool reading_a_point, found_contact_id;
30-
bool pen_active;
31-
bool finger_active;
32-
bool inverted;
3330
};
3431

3532
/*
@@ -47,7 +44,6 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
4744
return 0;
4845

4946
switch (usage->hid & HID_USAGE_PAGE) {
50-
5147
case HID_UP_GENDESK:
5248
switch (usage->hid) {
5349
case HID_GD_X:
@@ -111,6 +107,7 @@ static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
111107
/* No special mappings needed for the pen */
112108
if (field->application == HID_DG_PEN)
113109
return 0;
110+
114111
if (usage->type == EV_KEY || usage->type == EV_REL
115112
|| usage->type == EV_ABS)
116113
clear_bit(usage->code, *bit);
@@ -136,18 +133,6 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
136133

137134
if (hid->claimed & HID_CLAIMED_INPUT) {
138135
switch (usage->hid) {
139-
140-
case HID_DG_INRANGE:
141-
if (field->application & 0x3)
142-
nd->pen_active = (value != 0);
143-
else
144-
nd->finger_active = (value != 0);
145-
return 0;
146-
147-
case HID_DG_INVERT:
148-
nd->inverted = value;
149-
return 0;
150-
151136
case HID_GD_X:
152137
nd->x = value;
153138
nd->reading_a_point = 1;
@@ -171,32 +156,8 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
171156
* to emit a normal (X, Y) position
172157
*/
173158
if (!nd->found_contact_id) {
174-
if (nd->pen_active && nd->finger_active) {
175-
input_report_key(input, BTN_TOOL_DOUBLETAP, 0);
176-
input_report_key(input, BTN_TOOL_DOUBLETAP, 1);
177-
}
178-
input_event(input, EV_ABS, ABS_X, nd->x);
179-
input_event(input, EV_ABS, ABS_Y, nd->y);
180-
}
181-
break;
182-
case HID_DG_TIPPRESSURE:
183-
/*
184-
* when in single touch mode, this is the last
185-
* report received in a pen event. We want
186-
* to emit a normal (X, Y) position
187-
*/
188-
if (! nd->found_contact_id) {
189-
if (nd->pen_active && nd->finger_active) {
190-
input_report_key(input,
191-
nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN
192-
, 0);
193-
input_report_key(input,
194-
nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN
195-
, 1);
196-
}
197159
input_event(input, EV_ABS, ABS_X, nd->x);
198160
input_event(input, EV_ABS, ABS_Y, nd->y);
199-
input_event(input, EV_ABS, ABS_PRESSURE, value);
200161
}
201162
break;
202163
case 0xff000002:

0 commit comments

Comments
 (0)