Discussion:
[Linuxwacom-devel] [PATCH input-wacom] Add support for Lenovo Yoga 260
Jason Gerecke
2017-06-07 17:45:35 UTC
Permalink
At least three separate PIDs have been used with the Lenovo Yoga 260.
The HID descriptors for each of these PIDs are identical, but slightly
different to the already-supported MTTPC and MTTPC_B types. Create a
new MTTPC_C type for parsing this descriptor, as well as the tablet
definitions.

https://sourceforge.net/p/linuxwacom/support-requests/52/

Signed-off-by: Jason Gerecke <***@wacom.com>
---
2.6.30/wacom_sys.c | 17 ++++++++++++++++-
2.6.30/wacom_wac.c | 15 ++++++++++++++-
2.6.30/wacom_wac.h | 1 +
2.6.38/wacom_sys.c | 11 +++++++++++
2.6.38/wacom_wac.c | 20 ++++++++++++++++++--
2.6.38/wacom_wac.h | 1 +
3.7/wacom_sys.c | 11 +++++++++++
3.7/wacom_wac.c | 18 +++++++++++++++++-
3.7/wacom_wac.h | 1 +
9 files changed, 90 insertions(+), 5 deletions(-)

diff --git a/2.6.30/wacom_sys.c b/2.6.30/wacom_sys.c
index 2e8d070..cd17576 100644
--- a/2.6.30/wacom_sys.c
+++ b/2.6.30/wacom_sys.c
@@ -261,10 +261,13 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
if (features->type == TABLETPC2FG ||
features->type == MTTPC ||
features->type == MTTPC_B ||
+ features->type == MTTPC_C ||
features->type == WACOM_MSPROT) {
/* need to reset back */
features->pktlen = WACOM_PKGLEN_TPC2FG;
- if (features->type == MTTPC || features->type == MTTPC_B)
+ if (features->type == MTTPC ||
+ features->type == MTTPC_B ||
+ features->type == MTTPC_C)
features->pktlen = WACOM_PKGLEN_MTTPC;
else if (features->type == WACOM_MSPROT)
features->pktlen = WACOM_PKGLEN_MSPROT;
@@ -286,6 +289,13 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
get_unaligned_le16(&report[i + 6]);
features->unit = report[i - 5];
features->unitExpo = report[i - 3];
+ } else if (features->type == MTTPC_C) {
+ features->x_max =
+ get_unaligned_le16(&report[i + 3]);
+ features->x_phy =
+ get_unaligned_le16(&report[i + 8]);
+ features->unit = report[i - 1];
+ features->unitExpo = report[i - 3];
} else {
features->x_max =
get_unaligned_le16(&report[i + 3]);
@@ -321,6 +331,11 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
get_unaligned_le16(&report[i + 3]);
features->y_phy =
get_unaligned_le16(&report[i + 6]);
+ } else if (features->type == MTTPC_C) {
+ features->y_max =
+ get_unaligned_le16(&report[i + 3]);
+ features->y_phy =
+ get_unaligned_le16(&report[i - 2]);
} else if (features->type == BAMBOO_PT) {
features->y_phy =
get_unaligned_le16(&report[i + 3]);
diff --git a/2.6.30/wacom_wac.c b/2.6.30/wacom_wac.c
index 6eb5fef..f9a19dc 100644
--- a/2.6.30/wacom_wac.c
+++ b/2.6.30/wacom_wac.c
@@ -1307,7 +1307,9 @@ static void wacom_tpc_mt(struct wacom_wac *wacom)
wacom->tool[2] = BTN_TOOL_TRIPLETAP;

/* MTTPC does not support Height and Width */
- if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B)
+ if (wacom->features.type == MTTPC ||
+ wacom->features.type == MTTPC_B ||
+ wacom->features.type == MTTPC_C)
x_offset = -4;

/*
@@ -1758,6 +1760,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
case TABLETPC2FG:
case MTTPC:
case MTTPC_B:
+ case MTTPC_C:
sync = wacom_tpc_irq(wacom_wac, len);
break;

@@ -2150,6 +2153,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,

case MTTPC:
case MTTPC_B:
+ case MTTPC_C:
case WACOM_MSPROT:
if (features->device_type == BTN_TOOL_TRIPLETAP) {
for (i = 0; i < 10; i++)
@@ -2471,6 +2475,12 @@ static const struct wacom_features wacom_features_0x5010 =
{ "Wacom ISDv4 5010", WACOM_PKGLEN_MTTPC, 13756, 7736, 1023, 0, MTTPC_B };
static const struct wacom_features wacom_features_0x5013 =
{ "Wacom ISDv4 5013", WACOM_PKGLEN_MTTPC, 11752, 6612, 1023, 0, MTTPC_B };
+static const struct wacom_features wacom_features_0x5044 =
+ { "Wacom ISDv4 5044", WACOM_PKGLEN_MTTPC, 27648, 15552, 2047, 0, MTTPC_C };
+static const struct wacom_features wacom_features_0x5048 =
+ { "Wacom ISDv4 5048", WACOM_PKGLEN_MTTPC, 27648, 15552, 2047, 0, MTTPC_C };
+static const struct wacom_features wacom_features_0x5090 =
+ { "Wacom ISDv4 5090", WACOM_PKGLEN_MTTPC, 27648, 15552, 2047, 0, MTTPC_C };
static const struct wacom_features wacom_features_0x47 =
{ "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
static const struct wacom_features wacom_features_0x6004 =
@@ -2632,6 +2642,9 @@ const struct usb_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0x5002) },
{ USB_DEVICE_WACOM(0x5010) },
{ USB_DEVICE_WACOM(0x5013) },
+ { USB_DEVICE_WACOM(0x5044) },
+ { USB_DEVICE_WACOM(0x5048) },
+ { USB_DEVICE_WACOM(0x5090) },
{ USB_DEVICE_WACOM(0x300) },
{ USB_DEVICE_WACOM(0x301) },
{ USB_DEVICE_DETAILED(0x302, USB_CLASS_HID, 0, 0) },
diff --git a/2.6.30/wacom_wac.h b/2.6.30/wacom_wac.h
index 69bc0da..732aabb 100755
--- a/2.6.30/wacom_wac.h
+++ b/2.6.30/wacom_wac.h
@@ -113,6 +113,7 @@ enum {
TABLETPC2FG,
MTTPC,
MTTPC_B,
+ MTTPC_C,
MAX_TYPE
};

diff --git a/2.6.38/wacom_sys.c b/2.6.38/wacom_sys.c
index d8ea686..d4aa9cc 100644
--- a/2.6.38/wacom_sys.c
+++ b/2.6.38/wacom_sys.c
@@ -405,6 +405,7 @@ static int wacom_parse_hid(struct usb_interface *intf,

case MTTPC:
case MTTPC_B:
+ case MTTPC_C:
features->pktlen = WACOM_PKGLEN_MTTPC;
break;

@@ -459,6 +460,15 @@ static int wacom_parse_hid(struct usb_interface *intf,
features->unitExpo = report[i - 3];
break;

+ case MTTPC_C:
+ features->x_max =
+ get_unaligned_le16(&report[i + 3]);
+ features->x_phy =
+ get_unaligned_le16(&report[i + 8]);
+ features->unit = report[i - 1];
+ features->unitExpo = report[i - 3];
+ break;
+
default:
features->x_max =
get_unaligned_le16(&report[i + 3]);
@@ -491,6 +501,7 @@ static int wacom_parse_hid(struct usb_interface *intf,
break;

case WACOM_24HDT:
+ case MTTPC_C:
features->y_max =
get_unaligned_le16(&report[i + 3]);
features->y_phy =
diff --git a/2.6.38/wacom_wac.c b/2.6.38/wacom_wac.c
index 991459e..eec09bd 100644
--- a/2.6.38/wacom_wac.c
+++ b/2.6.38/wacom_wac.c
@@ -1286,7 +1286,9 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
int x_offset = 0;

/* MTTPC does not support Height and Width */
- if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B)
+ if (wacom->features.type == MTTPC ||
+ wacom->features.type == MTTPC_B ||
+ wacom->features.type == MTTPC_C)
x_offset = -4;

/*
@@ -2068,6 +2070,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
case MTSCREEN:
case MTTPC:
case MTTPC_B:
+ case MTTPC_C:
sync = wacom_tpc_irq(wacom_wac, len);
break;

@@ -2494,6 +2497,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
case MTSCREEN:
case MTTPC:
case MTTPC_B:
+ case MTTPC_C:
err = wacom_create_slots(wacom_wac);
if (err)
return err;
@@ -3015,7 +3019,16 @@ static const struct wacom_features wacom_features_0x5010 =
0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
static const struct wacom_features wacom_features_0x5013 =
{ "Wacom ISDv4 5013", WACOM_PKGLEN_MTTPC, 11752, 6612, 1023,
- 0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+ 0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x5044 =
+ { "Wacom ISDv4 5044", WACOM_PKGLEN_MTTPC, 27648, 15552, 2047,
+ 0, MTTPC_C, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x5048 =
+ { "Wacom ISDv4 5048", WACOM_PKGLEN_MTTPC, 27648, 15552, 2047,
+ 0, MTTPC_C, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x5090 =
+ { "Wacom ISDv4 5090", WACOM_PKGLEN_MTTPC, 27648, 15552, 2047,
+ 0, MTTPC_C, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
static const struct wacom_features wacom_features_0x47 =
{ "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -3329,6 +3342,9 @@ const struct usb_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0x5002) },
{ USB_DEVICE_WACOM(0x5010) },
{ USB_DEVICE_WACOM(0x5013) },
+ { USB_DEVICE_WACOM(0x5044) },
+ { USB_DEVICE_WACOM(0x5048) },
+ { USB_DEVICE_WACOM(0x5090) },
{ USB_DEVICE_WACOM(0x47) },
{ USB_DEVICE_WACOM(0xF4) },
{ USB_DEVICE_WACOM(0xF8) },
diff --git a/2.6.38/wacom_wac.h b/2.6.38/wacom_wac.h
index 44001f1..09157e6 100644
--- a/2.6.38/wacom_wac.h
+++ b/2.6.38/wacom_wac.h
@@ -140,6 +140,7 @@ enum {
MTSCREEN,
MTTPC,
MTTPC_B,
+ MTTPC_C,
MAX_TYPE
};

diff --git a/3.7/wacom_sys.c b/3.7/wacom_sys.c
index dec456c..a4613c8 100644
--- a/3.7/wacom_sys.c
+++ b/3.7/wacom_sys.c
@@ -406,6 +406,7 @@ static int wacom_parse_hid(struct usb_interface *intf,

case MTTPC:
case MTTPC_B:
+ case MTTPC_C:
features->pktlen = WACOM_PKGLEN_MTTPC;
break;

@@ -460,6 +461,15 @@ static int wacom_parse_hid(struct usb_interface *intf,
features->unitExpo = report[i - 3];
break;

+ case MTTPC_C:
+ features->x_max =
+ get_unaligned_le16(&report[i + 3]);
+ features->x_phy =
+ get_unaligned_le16(&report[i + 8]);
+ features->unit = report[i - 1];
+ features->unitExpo = report[i - 3];
+ break;
+
default:
features->x_max =
get_unaligned_le16(&report[i + 3]);
@@ -492,6 +502,7 @@ static int wacom_parse_hid(struct usb_interface *intf,
break;

case WACOM_24HDT:
+ case MTTPC_C:
features->y_max =
get_unaligned_le16(&report[i + 3]);
features->y_phy =
diff --git a/3.7/wacom_wac.c b/3.7/wacom_wac.c
index 1fdb1f3..1d76a12 100644
--- a/3.7/wacom_wac.c
+++ b/3.7/wacom_wac.c
@@ -1263,7 +1263,9 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
int x_offset = 0;

/* MTTPC does not support Height and Width */
- if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B)
+ if (wacom->features.type == MTTPC ||
+ wacom->features.type == MTTPC_B ||
+ wacom->features.type == MTTPC_C)
x_offset = -4;

/*
@@ -2048,6 +2050,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
case MTSCREEN:
case MTTPC:
case MTTPC_B:
+ case MTTPC_C:
sync = wacom_tpc_irq(wacom_wac, len);
break;

@@ -2458,6 +2461,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
case MTSCREEN:
case MTTPC:
case MTTPC_B:
+ case MTTPC_C:
case TABLETPC2FG:
if ((features->device_type == BTN_TOOL_FINGER) && features->touch_max > 1)
input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT);
@@ -2955,6 +2959,15 @@ static const struct wacom_features wacom_features_0x5010 =
static const struct wacom_features wacom_features_0x5013 =
{ "Wacom ISDv4 5013", WACOM_PKGLEN_MTTPC, 11752, 6612, 1023,
0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x5044 =
+ { "Wacom ISDv4 5044", WACOM_PKGLEN_MTTPC, 27648, 15552, 2047,
+ 0, MTTPC_C, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x5048 =
+ { "Wacom ISDv4 5048", WACOM_PKGLEN_MTTPC, 27648, 15552, 2047,
+ 0, MTTPC_C, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x5090 =
+ { "Wacom ISDv4 5090", WACOM_PKGLEN_MTTPC, 27648, 15552, 2047,
+ 0, MTTPC_C, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
static const struct wacom_features wacom_features_0x47 =
{ "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -3268,6 +3281,9 @@ const struct usb_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0x5002) },
{ USB_DEVICE_WACOM(0x5010) },
{ USB_DEVICE_WACOM(0x5013) },
+ { USB_DEVICE_WACOM(0x5044) },
+ { USB_DEVICE_WACOM(0x5048) },
+ { USB_DEVICE_WACOM(0x5090) },
{ USB_DEVICE_WACOM(0x47) },
{ USB_DEVICE_WACOM(0xF4) },
{ USB_DEVICE_WACOM(0xF8) },
diff --git a/3.7/wacom_wac.h b/3.7/wacom_wac.h
index 06bd4ba..81cfe2d 100644
--- a/3.7/wacom_wac.h
+++ b/3.7/wacom_wac.h
@@ -140,6 +140,7 @@ enum {
MTSCREEN,
MTTPC,
MTTPC_B,
+ MTTPC_C,
MAX_TYPE
};
--
2.13.0
Loading...