From aa61126013bd3f9bb41e5256e4246bc0c5bf348d Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Tue, 6 May 2014 17:14:59 -0700 Subject: [PATCH] Add support for 056a:5002 (Fujitsu T904) The 5002 appears to use a standard multitouch packet type, but the pen packet has a new report ID. Signed-off-by: Jason Gerecke --- drivers/input/tablet/wacom_sys.c | 19 +++++++++++++++++++ drivers/input/tablet/wacom_wac.c | 12 +++++++++++- drivers/input/tablet/wacom_wac.h | 3 +++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index b16ebef..0056a6d 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -364,6 +364,7 @@ static int wacom_parse_hid(struct usb_interface *intf, break; case MTTPC: + case MTTPC_B: features->pktlen = WACOM_PKGLEN_MTTPC; break; @@ -395,6 +396,16 @@ static int wacom_parse_hid(struct usb_interface *intf, i += 12; break; + case MTTPC_B: + features->x_max = + get_unaligned_le16(&report[i + 3]); + features->x_phy = + get_unaligned_le16(&report[i + 6]); + features->unit = report[i - 5]; + features->unitExpo = report[i - 3]; + i += 9; + break; + default: features->x_max = get_unaligned_le16(&report[i + 3]); @@ -447,6 +458,14 @@ static int wacom_parse_hid(struct usb_interface *intf, i += 12; break; + case MTTPC_B: + features->y_max = + get_unaligned_le16(&report[i + 3]); + features->y_phy = + get_unaligned_le16(&report[i + 6]); + i += 9; + break; + default: features->y_max = features->x_max; diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 05f371d..9330e17 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -966,7 +966,7 @@ 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) + if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B) x_offset = -4; /* @@ -1119,6 +1119,9 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) case WACOM_PKGLEN_TPC2FG: return wacom_tpc_mt_touch(wacom); + case WACOM_PKGLEN_PENABLED: + return wacom_tpc_pen(wacom); + default: switch (data[0]) { case WACOM_REPORT_TPC1FG: @@ -1128,6 +1131,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) return wacom_tpc_single_touch(wacom, len); case WACOM_REPORT_TPCMT: + case WACOM_REPORT_TPCMT2: return wacom_mt_touch(wacom); case WACOM_REPORT_PENABLED: @@ -1470,6 +1474,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) case TABLETPC2FG: case MTSCREEN: case MTTPC: + case MTTPC_B: sync = wacom_tpc_irq(wacom_wac, len); break; @@ -1811,6 +1816,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, case MTSCREEN: case MTTPC: + case MTTPC_B: case TABLETPC2FG: if (features->device_type == BTN_TOOL_FINGER) { unsigned int flags = INPUT_MT_DIRECT; @@ -2245,6 +2251,9 @@ static const struct wacom_features wacom_features_0x10F = static const struct wacom_features wacom_features_0x4001 = { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; +static const struct wacom_features wacom_features_0x5002 = + { "Wacom ISDv4 5002", WACOM_PKGLEN_MTTPC, 29576, 16724, 1023, + 0, MTTPC_B, 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 }; @@ -2466,6 +2475,7 @@ const struct usb_device_id wacom_ids[] = { { USB_DEVICE_DETAILED(0x315, USB_CLASS_HID, 0, 0) }, { USB_DEVICE_DETAILED(0x317, USB_CLASS_HID, 0, 0) }, { USB_DEVICE_WACOM(0x4001) }, + { USB_DEVICE_WACOM(0x5002) }, { USB_DEVICE_WACOM(0x47) }, { USB_DEVICE_WACOM(0xF4) }, { USB_DEVICE_WACOM(0xF8) }, diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index f69c0eb..620dae8 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h @@ -30,6 +30,7 @@ #define WACOM_PKGLEN_MTOUCH 62 #define WACOM_PKGLEN_MTTPC 40 #define WACOM_PKGLEN_DTUS 68 +#define WACOM_PKGLEN_PENABLED 8 /* wacom data size per MT contact */ #define WACOM_BYTES_PER_MT_PACKET 11 @@ -52,6 +53,7 @@ #define WACOM_REPORT_TPC1FG 6 #define WACOM_REPORT_TPC2FG 13 #define WACOM_REPORT_TPCMT 13 +#define WACOM_REPORT_TPCMT2 3 #define WACOM_REPORT_TPCHID 15 #define WACOM_REPORT_TPCST 16 #define WACOM_REPORT_DTUS 17 @@ -105,6 +107,7 @@ enum { TABLETPC2FG, MTSCREEN, MTTPC, + MTTPC_B, MAX_TYPE }; --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -246,7 +248,7 @@ int result = 0; unsigned char *rep_data; - rep_data = kmalloc(2, GFP_KERNEL); + rep_data = kmalloc(2, GFP_NOIO); if (rep_data) { rep_data[0] = 12; @@ -308,7 +310,7 @@ int i = 0, usage = WCM_UNDEFINED, finger = 0, pen = 0; unsigned char *report; - report = kzalloc(hid_desc->wDescriptorLength, GFP_KERNEL); + report = kzalloc(hid_desc->wDescriptorLength, GFP_NOIO); if (!report) return -ENOMEM; @@ -517,7 +538,7 @@ unsigned char *rep_data; int error = -ENOMEM, limit = 0; - rep_data = kzalloc(length, GFP_KERNEL); + rep_data = kzalloc(length, GFP_NOIO); if (!rep_data) return error;