diff options
author | Rafi Rubin <rafi@seas.upenn.edu> | 2010-02-11 22:14:06 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2010-02-16 07:53:52 -0500 |
commit | b0549cf1a35a92edf053d94066e60fb0ed02bb71 (patch) | |
tree | ad00413e39d7def8109ca0388574cdf9a7aca733 /drivers/hid | |
parent | 943ed464f3722de0569cf41ba6ec094768ac046d (diff) |
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>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-ntrig.c | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index 38b2364c8867..1bda3a4bd71f 100644 --- a/drivers/hid/hid-ntrig.c +++ b/drivers/hid/hid-ntrig.c | |||
@@ -27,9 +27,6 @@ | |||
27 | struct ntrig_data { | 27 | struct ntrig_data { |
28 | __s32 x, y, id, w, h; | 28 | __s32 x, y, id, w, h; |
29 | bool reading_a_point, found_contact_id; | 29 | bool reading_a_point, found_contact_id; |
30 | bool pen_active; | ||
31 | bool finger_active; | ||
32 | bool inverted; | ||
33 | }; | 30 | }; |
34 | 31 | ||
35 | /* | 32 | /* |
@@ -47,7 +44,6 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
47 | return 0; | 44 | return 0; |
48 | 45 | ||
49 | switch (usage->hid & HID_USAGE_PAGE) { | 46 | switch (usage->hid & HID_USAGE_PAGE) { |
50 | |||
51 | case HID_UP_GENDESK: | 47 | case HID_UP_GENDESK: |
52 | switch (usage->hid) { | 48 | switch (usage->hid) { |
53 | case HID_GD_X: | 49 | case HID_GD_X: |
@@ -111,6 +107,7 @@ static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi, | |||
111 | /* No special mappings needed for the pen */ | 107 | /* No special mappings needed for the pen */ |
112 | if (field->application == HID_DG_PEN) | 108 | if (field->application == HID_DG_PEN) |
113 | return 0; | 109 | return 0; |
110 | |||
114 | if (usage->type == EV_KEY || usage->type == EV_REL | 111 | if (usage->type == EV_KEY || usage->type == EV_REL |
115 | || usage->type == EV_ABS) | 112 | || usage->type == EV_ABS) |
116 | clear_bit(usage->code, *bit); | 113 | clear_bit(usage->code, *bit); |
@@ -136,18 +133,6 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, | |||
136 | 133 | ||
137 | if (hid->claimed & HID_CLAIMED_INPUT) { | 134 | if (hid->claimed & HID_CLAIMED_INPUT) { |
138 | switch (usage->hid) { | 135 | 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 | |||
151 | case HID_GD_X: | 136 | case HID_GD_X: |
152 | nd->x = value; | 137 | nd->x = value; |
153 | nd->reading_a_point = 1; | 138 | nd->reading_a_point = 1; |
@@ -171,32 +156,8 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, | |||
171 | * to emit a normal (X, Y) position | 156 | * to emit a normal (X, Y) position |
172 | */ | 157 | */ |
173 | if (!nd->found_contact_id) { | 158 | 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 | } | ||
197 | input_event(input, EV_ABS, ABS_X, nd->x); | 159 | input_event(input, EV_ABS, ABS_X, nd->x); |
198 | input_event(input, EV_ABS, ABS_Y, nd->y); | 160 | input_event(input, EV_ABS, ABS_Y, nd->y); |
199 | input_event(input, EV_ABS, ABS_PRESSURE, value); | ||
200 | } | 161 | } |
201 | break; | 162 | break; |
202 | case 0xff000002: | 163 | case 0xff000002: |