Commit b58ba1ba authored by Jason Gerecke's avatar Jason Gerecke Committed by Jiri Kosina

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: default avatarJason Gerecke <killertofu@gmail.com>
Reviewed-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent ecd618dc
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "wacom_wac.h" #include "wacom_wac.h"
#include "wacom.h" #include "wacom.h"
#include <linux/input/mt.h>
#define WAC_MSG_RETRIES 5 #define WAC_MSG_RETRIES 5
...@@ -236,6 +237,21 @@ static void wacom_usage_mapping(struct hid_device *hdev, ...@@ -236,6 +237,21 @@ static void wacom_usage_mapping(struct hid_device *hdev,
wacom_wac_usage_mapping(hdev, field, usage); wacom_wac_usage_mapping(hdev, field, usage);
} }
static void wacom_post_parse_hid(struct hid_device *hdev,
struct wacom_features *features)
{
struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
if (features->type == HID_GENERIC) {
/* Any last-minute generic device setup */
if (features->touch_max > 1) {
input_mt_init_slots(wacom_wac->input, wacom_wac->features.touch_max,
INPUT_MT_DIRECT);
}
}
}
static void wacom_parse_hid(struct hid_device *hdev, static void wacom_parse_hid(struct hid_device *hdev,
struct wacom_features *features) struct wacom_features *features)
{ {
...@@ -270,6 +286,8 @@ static void wacom_parse_hid(struct hid_device *hdev, ...@@ -270,6 +286,8 @@ static void wacom_parse_hid(struct hid_device *hdev,
wacom_usage_mapping(hdev, hreport->field[i], wacom_usage_mapping(hdev, hreport->field[i],
hreport->field[i]->usage + j); hreport->field[i]->usage + j);
} }
wacom_post_parse_hid(hdev, features);
} }
static int wacom_hid_set_device_mode(struct hid_device *hdev) static int wacom_hid_set_device_mode(struct hid_device *hdev)
......
...@@ -1381,7 +1381,6 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, ...@@ -1381,7 +1381,6 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
{ {
struct wacom *wacom = hid_get_drvdata(hdev); struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_wac *wacom_wac = &wacom->wacom_wac; struct wacom_wac *wacom_wac = &wacom->wacom_wac;
struct input_dev *input = wacom_wac->input;
unsigned touch_max = wacom_wac->features.touch_max; unsigned touch_max = wacom_wac->features.touch_max;
switch (usage->hid) { switch (usage->hid) {
...@@ -1400,8 +1399,6 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, ...@@ -1400,8 +1399,6 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
ABS_MT_POSITION_Y, 4); ABS_MT_POSITION_Y, 4);
break; break;
case HID_DG_CONTACTID: case HID_DG_CONTACTID:
input_mt_init_slots(input, wacom_wac->features.touch_max,
INPUT_MT_DIRECT);
break; break;
case HID_DG_INRANGE: case HID_DG_INRANGE:
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment