diff options
author | James Morris <jmorris@namei.org> | 2009-09-29 17:47:33 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-09-29 17:47:33 -0400 |
commit | 1669b049db50fc7f1d4e694fb115a0f408c63fce (patch) | |
tree | 9b3b90b5cbff9b8f30ecf0b2a44896ce8bef0c20 /drivers/hid/hid-ntrig.c | |
parent | 7f366784f5c2b8fc0658b5b374f4c63ee42c789f (diff) | |
parent | 17d857be649a21ca90008c6dc425d849fa83db5c (diff) |
Merge branch 'master' into next
Diffstat (limited to 'drivers/hid/hid-ntrig.c')
-rw-r--r-- | drivers/hid/hid-ntrig.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index 75ed9d2c1a36..49ce69d7bba7 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 | ||
@@ -265,12 +290,12 @@ static struct hid_driver ntrig_driver = { | |||
265 | .event = ntrig_event, | 290 | .event = ntrig_event, |
266 | }; | 291 | }; |
267 | 292 | ||
268 | static int ntrig_init(void) | 293 | static int __init ntrig_init(void) |
269 | { | 294 | { |
270 | return hid_register_driver(&ntrig_driver); | 295 | return hid_register_driver(&ntrig_driver); |
271 | } | 296 | } |
272 | 297 | ||
273 | static void ntrig_exit(void) | 298 | static void __exit ntrig_exit(void) |
274 | { | 299 | { |
275 | hid_unregister_driver(&ntrig_driver); | 300 | hid_unregister_driver(&ntrig_driver); |
276 | } | 301 | } |