aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2014-12-05 16:37:32 -0500
committerJiri Kosina <jkosina@suse.cz>2014-12-10 04:50:48 -0500
commitb58ba1ba1af9cfbad6f3af4c4fc3575d9aeae542 (patch)
treee81f891a3b28e7dfb29675c58bf2e0de844137b2 /drivers/hid
parentecd618dc25582923add5d7abfbb3b9aeaf51e2ac (diff)
HID: wacom: Initialize MT slots for generic devices at post_parse_hid
If a HID descriptor places HID_DG_CONTACTID before HID_DG_X and HID_DG_Y then the ABS_X and ABS_Y will not be automatically initialized by the call to input_mt_init_slots. To ensure that this is not a problem, we relocate that call to occur after HID parsing has been completed and we've initalized all the multitouch axes. Signed-off-by: Jason Gerecke <killertofu@gmail.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/wacom_sys.c18
-rw-r--r--drivers/hid/wacom_wac.c3
2 files changed, 18 insertions, 3 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index eb5531657e41..872aa0be2e70 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -13,6 +13,7 @@
13 13
14#include "wacom_wac.h" 14#include "wacom_wac.h"
15#include "wacom.h" 15#include "wacom.h"
16#include <linux/input/mt.h>
16 17
17#define WAC_MSG_RETRIES 5 18#define WAC_MSG_RETRIES 5
18 19
@@ -236,6 +237,21 @@ static void wacom_usage_mapping(struct hid_device *hdev,
236 wacom_wac_usage_mapping(hdev, field, usage); 237 wacom_wac_usage_mapping(hdev, field, usage);
237} 238}
238 239
240static void wacom_post_parse_hid(struct hid_device *hdev,
241 struct wacom_features *features)
242{
243 struct wacom *wacom = hid_get_drvdata(hdev);
244 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
245
246 if (features->type == HID_GENERIC) {
247 /* Any last-minute generic device setup */
248 if (features->touch_max > 1) {
249 input_mt_init_slots(wacom_wac->input, wacom_wac->features.touch_max,
250 INPUT_MT_DIRECT);
251 }
252 }
253}
254
239static void wacom_parse_hid(struct hid_device *hdev, 255static void wacom_parse_hid(struct hid_device *hdev,
240 struct wacom_features *features) 256 struct wacom_features *features)
241{ 257{
@@ -270,6 +286,8 @@ static void wacom_parse_hid(struct hid_device *hdev,
270 wacom_usage_mapping(hdev, hreport->field[i], 286 wacom_usage_mapping(hdev, hreport->field[i],
271 hreport->field[i]->usage + j); 287 hreport->field[i]->usage + j);
272 } 288 }
289
290 wacom_post_parse_hid(hdev, features);
273} 291}
274 292
275static int wacom_hid_set_device_mode(struct hid_device *hdev) 293static int wacom_hid_set_device_mode(struct hid_device *hdev)
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 7b7a61a9194d..064fd6cf36c6 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1381,7 +1381,6 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
1381{ 1381{
1382 struct wacom *wacom = hid_get_drvdata(hdev); 1382 struct wacom *wacom = hid_get_drvdata(hdev);
1383 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1383 struct wacom_wac *wacom_wac = &wacom->wacom_wac;
1384 struct input_dev *input = wacom_wac->input;
1385 unsigned touch_max = wacom_wac->features.touch_max; 1384 unsigned touch_max = wacom_wac->features.touch_max;
1386 1385
1387 switch (usage->hid) { 1386 switch (usage->hid) {
@@ -1400,8 +1399,6 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
1400 ABS_MT_POSITION_Y, 4); 1399 ABS_MT_POSITION_Y, 4);
1401 break; 1400 break;
1402 case HID_DG_CONTACTID: 1401 case HID_DG_CONTACTID:
1403 input_mt_init_slots(input, wacom_wac->features.touch_max,
1404 INPUT_MT_DIRECT);
1405 break; 1402 break;
1406 case HID_DG_INRANGE: 1403 case HID_DG_INRANGE:
1407 break; 1404 break;