Discussion:
[Linuxwacom-devel] [PATCH input-wacom 2/2] backport: use ABS_MT_TOUCH_* instead of ABS_MT_WIDTH_*
Aaron Armstrong Skomra
2017-04-13 19:22:31 UTC
Permalink
Kernels 3.16 and before have a "generic" touch path which is used
by newer devices. Here generic means devices added to the driver
after the switch the generic code path upstream.

For devices which use this "generic" path in older kernels, use
ABS_MT_TOUCH_* instead of ABS_MT_WIDTH_*.

Signed-off-by: Aaron Armstrong Skomra <***@wacom.com>
---
2.6.38/wacom_wac.c | 15 +++++++++++----
3.7/wacom_wac.c | 15 +++++++++++----
2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/2.6.38/wacom_wac.c b/2.6.38/wacom_wac.c
index 8cfcb6c..6a5fb77 100644
--- a/2.6.38/wacom_wac.c
+++ b/2.6.38/wacom_wac.c
@@ -1124,8 +1124,8 @@ static void wacom_multitouch_generic_finger(struct wacom_wac *wacom,
input_report_abs(input, ABS_MT_POSITION_Y, y);

if (w >= 0 && h >= 0) {
- input_report_abs(input, ABS_MT_WIDTH_MAJOR, max(w, h));
- input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h));
+ input_report_abs(input, ABS_MT_TOUCH_MAJOR, max(w, h));
+ input_report_abs(input, ABS_MT_TOUCH_MINOR, min(w, h));
input_report_abs(input, ABS_MT_ORIENTATION, w > h);
}
}
@@ -2468,12 +2468,19 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
}
break;

- case WACOM_MSPROT:
case WACOM_24HDT:
if (features->device_type == BTN_TOOL_FINGER) {
- input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0);
input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0);
input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0);
+ }
+ /* fall through */
+
+ case WACOM_MSPROT:
+ if (features->device_type == BTN_TOOL_FINGER) {
+ input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0);
+ if (features->type != WACOM_24HDT)
+ input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR,
+ 0, features->y_max, 0, 0);
input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0);
}
/* fall through */
diff --git a/3.7/wacom_wac.c b/3.7/wacom_wac.c
index 3fb1c33..667b40e 100644
--- a/3.7/wacom_wac.c
+++ b/3.7/wacom_wac.c
@@ -1105,8 +1105,8 @@ static void wacom_multitouch_generic_finger(struct wacom_wac *wacom,
input_report_abs(input, ABS_MT_POSITION_Y, y);

if (w >= 0 && h >= 0) {
- input_report_abs(input, ABS_MT_WIDTH_MAJOR, max(w, h));
- input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h));
+ input_report_abs(input, ABS_MT_TOUCH_MAJOR, max(w, h));
+ input_report_abs(input, ABS_MT_TOUCH_MINOR, min(w, h));
input_report_abs(input, ABS_MT_ORIENTATION, w > h);
}
}
@@ -2432,12 +2432,19 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
break;

- case WACOM_MSPROT:
case WACOM_24HDT:
if (features->device_type == BTN_TOOL_FINGER) {
- input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0);
input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0);
input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0);
+ }
+ /* fall through */
+
+ case WACOM_MSPROT:
+ if (features->device_type == BTN_TOOL_FINGER) {
+ input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0);
+ if (features->type != WACOM_24HDT)
+ input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR,
+ 0, features->y_max, 0, 0);
input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0);
}
/* fall through */
--
1.7.9.5
Ping Cheng
2017-04-14 18:39:32 UTC
Permalink
On Thu, Apr 13, 2017 at 12:22 PM, Aaron Armstrong Skomra
Also remove extra spaces.
Reviewed-by: Ping Cheng <***@wacom.com> for the set.

Thank you, Aaron, for the cleanup.

Ping
---
2.6.30/wacom_wac.c | 8 ++++----
2.6.36/wacom_wac.c | 4 ++--
2.6.38/wacom_wac.c | 6 ++++--
3.7/wacom_wac.c | 6 ++++--
4 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/2.6.30/wacom_wac.c b/2.6.30/wacom_wac.c
index 78cd7b7..4184644 100644
--- a/2.6.30/wacom_wac.c
+++ b/2.6.30/wacom_wac.c
@@ -1134,16 +1134,16 @@ static int wacom_multitouch_generic(struct wacom_wac *wacom)
offset = WACOM_BYTES_PER_MSPROT_PACKET * i + 3;
prox = data[offset] & 0x01;
contact_id = get_unaligned_le16(&data[offset + 1]);
- x = get_unaligned_le16(&data[offset + 3]);
- y = get_unaligned_le16(&data[offset + 5]);
+ x = get_unaligned_le16(&data[offset + 3]);
+ y = get_unaligned_le16(&data[offset + 5]);
break;
offset = WACOM_BYTES_PER_INTUOSP2_PACKET * i + 2;
contact_id = data[offset];
prox = data[offset + 1] & 0x01;
- x = get_unaligned_le16(&data[offset + 2]);
- y = get_unaligned_le16(&data[offset + 4]);
+ x = get_unaligned_le16(&data[offset + 2]);
+ y = get_unaligned_le16(&data[offset + 4]);
break;
diff --git a/2.6.36/wacom_wac.c b/2.6.36/wacom_wac.c
index f3b9a4d..f9ceb58 100644
--- a/2.6.36/wacom_wac.c
+++ b/2.6.36/wacom_wac.c
@@ -1298,8 +1298,8 @@ static int wacom_multitouch_generic(struct wacom_wac *wacom)
offset = WACOM_BYTES_PER_INTUOSP2_PACKET * i + 2;
contact_id = data[offset];
prox = data[offset + 1] & 0x01;
- x = get_unaligned_le16(&data[offset + 2]);
- y = get_unaligned_le16(&data[offset + 4]);
+ x = get_unaligned_le16(&data[offset + 2]);
+ y = get_unaligned_le16(&data[offset + 4]);
break;
diff --git a/2.6.38/wacom_wac.c b/2.6.38/wacom_wac.c
index f66f283..8cfcb6c 100644
--- a/2.6.38/wacom_wac.c
+++ b/2.6.38/wacom_wac.c
@@ -1179,8 +1179,10 @@ static int wacom_multitouch_generic(struct wacom_wac *wacom)
offset = WACOM_BYTES_PER_INTUOSP2_PACKET * i + 2;
contact_id = data[offset];
prox = data[offset + 1] & 0x01;
- x = get_unaligned_le16(&data[offset + 2]);
- y = get_unaligned_le16(&data[offset + 4]);
+ x = get_unaligned_le16(&data[offset + 2]);
+ y = get_unaligned_le16(&data[offset + 4]);
+ w = data[offset + 6];
+ h = data[offset + 7];
break;
diff --git a/3.7/wacom_wac.c b/3.7/wacom_wac.c
index 096864e..3fb1c33 100644
--- a/3.7/wacom_wac.c
+++ b/3.7/wacom_wac.c
@@ -1159,8 +1159,10 @@ static int wacom_multitouch_generic(struct wacom_wac *wacom)
offset = WACOM_BYTES_PER_INTUOSP2_PACKET * i + 2;
contact_id = data[offset];
prox = data[offset + 1] & 0x01;
- x = get_unaligned_le16(&data[offset + 2]);
- y = get_unaligned_le16(&data[offset + 4]);
+ x = get_unaligned_le16(&data[offset + 2]);
+ y = get_unaligned_le16(&data[offset + 4]);
+ w = data[offset + 6];
+ h = data[offset + 7];
break;
--
1.7.9.5
Loading...