From 56681910b7ce728dd542b88d20a4123e327478d6 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 16 May 2012 02:01:40 +0000 Subject: [PATCH] wacom: Add support for various tablet models (Closes: #671801) Mostly cherry-picked by Jonathan Nieder from input-next. I've added one extra fix on the end. svn path=/dists/sid/linux-2.6/; revision=19001 --- debian/changelog | 7 + ...m-cleanup-feature-report-for-bamboos.patch | 49 ++ ...com-remove-unused-bamboo-HID-parsing.patch | 43 ++ ...add-some-comments-to-wacom_parse_hid.patch | 72 +++ ...t-wacom-relax-Bamboo-stylus-ID-check.patch | 41 ++ ...m-read-3rd-gen-Bamboo-Touch-HID-data.patch | 121 +++++ ...rd-gen-Bamboo-P-Touch-packet-support.patch | 188 ++++++++ ...wacom-ignore-unwanted-bamboo-packets.patch | 63 +++ ...ut-wacom-add-support-for-Cintiq-24HD.patch | 160 +++++++ ...acom-add-LED-support-for-Cintiq-24HD.patch | 93 ++++ ...BTN_TOOL_FINGER-to-indicate-touch-de.patch | 83 ++++ ...e-switch-statement-for-wacom_tpc_irq.patch | 69 +++ ...om-add-missing-LEDS_CLASS-to-Kconfig.patch | 29 ++ ...3rd-gen-Bamboo-MT-when-4-fingers-are.patch | 32 ++ ...physical-size-calculation-for-3rd-ge.patch | 42 ++ ...put-wacom-isolate-input-registration.patch | 127 ++++++ ...heck-for-allocation-failure-in-probe.patch | 33 ++ ...put-wacom-wireless-monitor-framework.patch | 219 +++++++++ ...-create-inputs-when-wireless-connect.patch | 234 ++++++++++ ...-Input-wacom-wireless-battery-status.patch | 184 ++++++++ ...nput-wacom-add-basic-Intuos5-support.patch | 139 ++++++ ...Intuos5-Touch-Ring-ExpressKey-suppor.patch | 93 ++++ ...m-add-Intuos5-Touch-Ring-LED-support.patch | 163 +++++++ ...dd-Intuos5-multitouch-sensor-support.patch | 183 ++++++++ ...rieve-maximum-number-of-touch-points.patch | 249 ++++++++++ ...put-wacom-add-0xE5-MT-device-support.patch | 430 ++++++++++++++++++ ...rn-proper-error-if-usb_get_extra_des.patch | 41 ++ debian/patches/series/base | 28 ++ 28 files changed, 3215 insertions(+) create mode 100644 debian/patches/features/all/wacom/0001-Input-wacom-cleanup-feature-report-for-bamboos.patch create mode 100644 debian/patches/features/all/wacom/0002-Input-wacom-remove-unused-bamboo-HID-parsing.patch create mode 100644 debian/patches/features/all/wacom/0003-Input-wacom-add-some-comments-to-wacom_parse_hid.patch create mode 100644 debian/patches/features/all/wacom/0004-Input-wacom-relax-Bamboo-stylus-ID-check.patch create mode 100644 debian/patches/features/all/wacom/0005-Input-wacom-read-3rd-gen-Bamboo-Touch-HID-data.patch create mode 100644 debian/patches/features/all/wacom/0006-Input-wacom-3rd-gen-Bamboo-P-Touch-packet-support.patch create mode 100644 debian/patches/features/all/wacom/0007-Input-wacom-ignore-unwanted-bamboo-packets.patch create mode 100644 debian/patches/features/all/wacom/0008-Input-wacom-add-support-for-Cintiq-24HD.patch create mode 100644 debian/patches/features/all/wacom/0009-Input-wacom-add-LED-support-for-Cintiq-24HD.patch create mode 100644 debian/patches/features/all/wacom/0010-Input-wacom-use-BTN_TOOL_FINGER-to-indicate-touch-de.patch create mode 100644 debian/patches/features/all/wacom/0011-Input-wacom-use-switch-statement-for-wacom_tpc_irq.patch create mode 100644 debian/patches/features/all/wacom/0012-Input-wacom-add-missing-LEDS_CLASS-to-Kconfig.patch create mode 100644 debian/patches/features/all/wacom/0013-Input-wacom-fix-3rd-gen-Bamboo-MT-when-4-fingers-are.patch create mode 100644 debian/patches/features/all/wacom/0014-Input-wacom-fix-physical-size-calculation-for-3rd-ge.patch create mode 100644 debian/patches/features/all/wacom/0015-Input-wacom-isolate-input-registration.patch create mode 100644 debian/patches/features/all/wacom/0016-Input-wacom-check-for-allocation-failure-in-probe.patch create mode 100644 debian/patches/features/all/wacom/0017-Input-wacom-wireless-monitor-framework.patch create mode 100644 debian/patches/features/all/wacom/0018-Input-wacom-create-inputs-when-wireless-connect.patch create mode 100644 debian/patches/features/all/wacom/0019-Input-wacom-wireless-battery-status.patch create mode 100644 debian/patches/features/all/wacom/0020-Input-wacom-add-basic-Intuos5-support.patch create mode 100644 debian/patches/features/all/wacom/0021-Input-wacom-add-Intuos5-Touch-Ring-ExpressKey-suppor.patch create mode 100644 debian/patches/features/all/wacom/0022-Input-wacom-add-Intuos5-Touch-Ring-LED-support.patch create mode 100644 debian/patches/features/all/wacom/0023-Input-wacom-add-Intuos5-multitouch-sensor-support.patch create mode 100644 debian/patches/features/all/wacom/0024-Input-wacom-retrieve-maximum-number-of-touch-points.patch create mode 100644 debian/patches/features/all/wacom/0025-Input-wacom-add-0xE5-MT-device-support.patch create mode 100644 debian/patches/features/all/wacom/0026-Input-wacom-return-proper-error-if-usb_get_extra_des.patch diff --git a/debian/changelog b/debian/changelog index a8eeca3e2..801a289bb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +linux-2.6 (3.2.17-2) UNRELEASED; urgency=low + + [ Jonathan Nieder ] + * wacom: Add support for various tablet models (Closes: #671801) + + -- Ben Hutchings Wed, 16 May 2012 02:19:30 +0100 + linux-2.6 (3.2.17-1) unstable; urgency=low * New upstream stable update: diff --git a/debian/patches/features/all/wacom/0001-Input-wacom-cleanup-feature-report-for-bamboos.patch b/debian/patches/features/all/wacom/0001-Input-wacom-cleanup-feature-report-for-bamboos.patch new file mode 100644 index 000000000..44fc8f99f --- /dev/null +++ b/debian/patches/features/all/wacom/0001-Input-wacom-cleanup-feature-report-for-bamboos.patch @@ -0,0 +1,49 @@ +From: Chris Bagwell +Date: Wed, 26 Oct 2011 22:24:22 -0700 +Subject: Input: wacom - cleanup feature report for bamboos + +commit 6e8ec5379c7ab9a57190e23af173aee74f88e54a upstream. + +Only the stylus interface on Bamboo's has a feature report that can +be used to set to wacom mode. The touch interface only has 1 report mode +and will return errors for those get/sets requests. + +The get request was always erroring out because it was not marked as +an input request. Only down side of error was needlessly resending the +set request 5 times. + +Signed-off-by: Chris Bagwell +Acked-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_sys.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index 1c1b7b43cf92..8669096a8ea1 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -66,7 +66,8 @@ static int wacom_get_report(struct usb_interface *intf, u8 type, u8 id, + do { + retval = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + USB_REQ_GET_REPORT, +- USB_TYPE_CLASS | USB_RECIP_INTERFACE, ++ USB_DIR_IN | USB_TYPE_CLASS | ++ USB_RECIP_INTERFACE, + (type << 8) + id, + intf->altsetting[0].desc.bInterfaceNumber, + buf, size, 100); +@@ -348,7 +349,8 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat + WAC_HID_FEATURE_REPORT, + report_id, rep_data, 4, 1); + } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); +- } else if (features->type != TABLETPC) { ++ } else if (features->type != TABLETPC && ++ features->device_type == BTN_TOOL_PEN) { + do { + rep_data[0] = 2; + rep_data[1] = 2; +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0002-Input-wacom-remove-unused-bamboo-HID-parsing.patch b/debian/patches/features/all/wacom/0002-Input-wacom-remove-unused-bamboo-HID-parsing.patch new file mode 100644 index 000000000..5db714165 --- /dev/null +++ b/debian/patches/features/all/wacom/0002-Input-wacom-remove-unused-bamboo-HID-parsing.patch @@ -0,0 +1,43 @@ +From: Chris Bagwell +Date: Wed, 26 Oct 2011 22:26:16 -0700 +Subject: Input: wacom - remove unused bamboo HID parsing + +commit fc72bf758f943fbc5c0d9dd14575b91996513c77 upstream. + +Bamboo's do not declared a Digitizer-Stylus so the if() was +never executed. wacom_features already contains correct stylus +packet length. + +Signed-off-by: Chris Bagwell +Acked-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_sys.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index 8669096a8ea1..f3dfb827437a 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -245,8 +245,6 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi + /* penabled only accepts exact bytes of data */ + if (features->type == TABLETPC2FG) + features->pktlen = WACOM_PKGLEN_GRAPHIRE; +- if (features->type == BAMBOO_PT) +- features->pktlen = WACOM_PKGLEN_BBFUN; + features->device_type = BTN_TOOL_PEN; + features->x_max = + get_unaligned_le16(&report[i + 3]); +@@ -288,8 +286,6 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi + /* penabled only accepts exact bytes of data */ + if (features->type == TABLETPC2FG) + features->pktlen = WACOM_PKGLEN_GRAPHIRE; +- if (features->type == BAMBOO_PT) +- features->pktlen = WACOM_PKGLEN_BBFUN; + features->device_type = BTN_TOOL_PEN; + features->y_max = + get_unaligned_le16(&report[i + 3]); +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0003-Input-wacom-add-some-comments-to-wacom_parse_hid.patch b/debian/patches/features/all/wacom/0003-Input-wacom-add-some-comments-to-wacom_parse_hid.patch new file mode 100644 index 000000000..0ef066dfc --- /dev/null +++ b/debian/patches/features/all/wacom/0003-Input-wacom-add-some-comments-to-wacom_parse_hid.patch @@ -0,0 +1,72 @@ +From: Chris Bagwell +Date: Wed, 26 Oct 2011 22:26:59 -0700 +Subject: Input: wacom - add some comments to wacom_parse_hid + +commit 428f85884bb4a88737e5fa76535ede06a33fe162 upstream. + +Signed-off-by: Chris Bagwell +Acked-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_sys.c | 37 ++++++++++++++++++++++++++++++++++++- + 1 file changed, 36 insertions(+), 1 deletion(-) + +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index f3dfb827437a..e648f9ac4d82 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -165,7 +165,37 @@ static void wacom_close(struct input_dev *dev) + usb_autopm_put_interface(wacom->intf); + } + +-static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, ++/* ++ * Interface Descriptor of wacom devices can be incomplete and ++ * inconsistent so wacom_features table is used to store stylus ++ * device's packet lengths, various maximum values, and tablet ++ * resolution based on product ID's. ++ * ++ * For devices that contain 2 interfaces, wacom_features table is ++ * inaccurate for the touch interface. Since the Interface Descriptor ++ * for touch interfaces has pretty complete data, this function exists ++ * to query tablet for this missing information instead of hard coding in ++ * an additional table. ++ * ++ * A typical Interface Descriptor for a stylus will contain a ++ * boot mouse application collection that is not of interest and this ++ * function will ignore it. ++ * ++ * It also contains a digitizer application collection that also is not ++ * of interest since any information it contains would be duplicate ++ * of what is in wacom_features. Usually it defines a report of an array ++ * of bytes that could be used as max length of the stylus packet returned. ++ * If it happens to define a Digitizer-Stylus Physical Collection then ++ * the X and Y logical values contain valid data but it is ignored. ++ * ++ * A typical Interface Descriptor for a touch interface will contain a ++ * Digitizer-Finger Physical Collection which will define both logical ++ * X/Y maximum as well as the physical size of tablet. Since touch ++ * interfaces haven't supported pressure or distance, this is enough ++ * information to override invalid values in the wacom_features table. ++ */ ++static int wacom_parse_hid(struct usb_interface *intf, ++ struct hid_descriptor *hid_desc, + struct wacom_features *features) + { + struct usb_device *dev = interface_to_usbdev(intf); +@@ -299,6 +329,11 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi + i++; + break; + ++ /* ++ * Requiring Stylus Usage will ignore boot mouse ++ * X/Y values and some cases of invalid Digitizer X/Y ++ * values commonly reported. ++ */ + case HID_USAGE_STYLUS: + pen = 1; + i++; +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0004-Input-wacom-relax-Bamboo-stylus-ID-check.patch b/debian/patches/features/all/wacom/0004-Input-wacom-relax-Bamboo-stylus-ID-check.patch new file mode 100644 index 000000000..b2f78555c --- /dev/null +++ b/debian/patches/features/all/wacom/0004-Input-wacom-relax-Bamboo-stylus-ID-check.patch @@ -0,0 +1,41 @@ +From: Chris Bagwell +Date: Wed, 26 Oct 2011 22:28:34 -0700 +Subject: Input: wacom - relax Bamboo stylus ID check + +commit c5981411f60c31f0dff6f0f98d2d3711384badaf upstream. + +Bit 0x02 always means tip versus eraser. Bit 0x01 is something related +to version of stylus and different values are starting to be used. + +Relaxing proximity check is required to be used with 3rd generation +Bamboo Pen and Touch tablets. + +Signed-off-by: Chris Bagwell +Acked-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_wac.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index 2ee47d01a3b4..f00c70e1adb0 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -843,12 +843,7 @@ static int wacom_bpt_pen(struct wacom_wac *wacom) + unsigned char *data = wacom->data; + int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0; + +- /* +- * Similar to Graphire protocol, data[1] & 0x20 is proximity and +- * data[1] & 0x18 is tool ID. 0x30 is safety check to ignore +- * 2 unused tool ID's. +- */ +- prox = (data[1] & 0x30) == 0x30; ++ prox = (data[1] & 0x20) == 0x20; + + /* + * All reports shared between PEN and RUBBER tool must be +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0005-Input-wacom-read-3rd-gen-Bamboo-Touch-HID-data.patch b/debian/patches/features/all/wacom/0005-Input-wacom-read-3rd-gen-Bamboo-Touch-HID-data.patch new file mode 100644 index 000000000..06280b469 --- /dev/null +++ b/debian/patches/features/all/wacom/0005-Input-wacom-read-3rd-gen-Bamboo-Touch-HID-data.patch @@ -0,0 +1,121 @@ +From: Chris Bagwell +Date: Wed, 26 Oct 2011 22:32:52 -0700 +Subject: Input: wacom - read 3rd gen Bamboo Touch HID data + +commit 4134361af6e099e5f477663fed1d49f0cf29eb4f upstream. + +Override invalid pen based pktlen and x/y_max with touch +values from HID report. + +Since active area of pen and touch are same on these +devices, set physical x/y size while pen x/y_max and +resolution are still valid. + +Signed-off-by: Chris Bagwell +Acked-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_sys.c | 49 ++++++++++++++++++++++++++++++++++++-- + drivers/input/tablet/wacom_wac.h | 1 + + 2 files changed, 48 insertions(+), 2 deletions(-) + +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index e648f9ac4d82..2fe21d1a18b7 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -28,7 +28,9 @@ + #define HID_USAGE_Y_TILT 0x3e + #define HID_USAGE_FINGER 0x22 + #define HID_USAGE_STYLUS 0x20 +-#define HID_COLLECTION 0xc0 ++#define HID_COLLECTION 0xa1 ++#define HID_COLLECTION_LOGICAL 0x02 ++#define HID_COLLECTION_END 0xc0 + + enum { + WCM_UNDEFINED = 0, +@@ -165,6 +167,35 @@ static void wacom_close(struct input_dev *dev) + usb_autopm_put_interface(wacom->intf); + } + ++static int wacom_parse_logical_collection(unsigned char *report, ++ struct wacom_features *features) ++{ ++ int length = 0; ++ ++ if (features->type == BAMBOO_PT) { ++ ++ /* Logical collection is only used by 3rd gen Bamboo Touch */ ++ features->pktlen = WACOM_PKGLEN_BBTOUCH3; ++ features->device_type = BTN_TOOL_DOUBLETAP; ++ ++ /* ++ * Stylus and Touch have same active area ++ * so compute physical size based on stylus ++ * data before its overwritten. ++ */ ++ features->x_phy = ++ (features->x_max * features->x_resolution) / 100; ++ features->y_phy = ++ (features->y_max * features->y_resolution) / 100; ++ ++ features->x_max = features->y_max = ++ get_unaligned_le16(&report[10]); ++ ++ length = 11; ++ } ++ return length; ++} ++ + /* + * Interface Descriptor of wacom devices can be incomplete and + * inconsistent so wacom_features table is used to store stylus +@@ -193,6 +224,10 @@ static void wacom_close(struct input_dev *dev) + * X/Y maximum as well as the physical size of tablet. Since touch + * interfaces haven't supported pressure or distance, this is enough + * information to override invalid values in the wacom_features table. ++ * ++ * 3rd gen Bamboo Touch no longer define a Digitizer-Finger Pysical ++ * Collection. Instead they define a Logical Collection with a single ++ * Logical Maximum for both X and Y. + */ + static int wacom_parse_hid(struct usb_interface *intf, + struct hid_descriptor *hid_desc, +@@ -341,10 +376,20 @@ static int wacom_parse_hid(struct usb_interface *intf, + } + break; + +- case HID_COLLECTION: ++ case HID_COLLECTION_END: + /* reset UsagePage and Finger */ + finger = usage = 0; + break; ++ ++ case HID_COLLECTION: ++ i++; ++ switch (report[i]) { ++ case HID_COLLECTION_LOGICAL: ++ i += wacom_parse_logical_collection(&report[i], ++ features); ++ break; ++ } ++ break; + } + } + +diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h +index 53eb71b68330..af94e6d9d6a9 100644 +--- a/drivers/input/tablet/wacom_wac.h ++++ b/drivers/input/tablet/wacom_wac.h +@@ -22,6 +22,7 @@ + #define WACOM_PKGLEN_TPC1FG 5 + #define WACOM_PKGLEN_TPC2FG 14 + #define WACOM_PKGLEN_BBTOUCH 20 ++#define WACOM_PKGLEN_BBTOUCH3 64 + + /* device IDs */ + #define STYLUS_DEVICE_ID 0x02 +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0006-Input-wacom-3rd-gen-Bamboo-P-Touch-packet-support.patch b/debian/patches/features/all/wacom/0006-Input-wacom-3rd-gen-Bamboo-P-Touch-packet-support.patch new file mode 100644 index 000000000..758a90892 --- /dev/null +++ b/debian/patches/features/all/wacom/0006-Input-wacom-3rd-gen-Bamboo-P-Touch-packet-support.patch @@ -0,0 +1,188 @@ +From: Chris Bagwell +Date: Wed, 26 Oct 2011 22:34:21 -0700 +Subject: Input: wacom - 3rd gen Bamboo P&Touch packet support + +commit 73149ab8433c0ade5a4f79b137af2a081e8a5d13 upstream. + +3rd generation Bamboo Pen and Touch tablets reuse the older +stylus packet but add an extra fixed zero pad byte to end. + +The touch packets are quite different since it supports tracking +of up to 16 touches. The packet is 64-byte fixed size but contains +up to 15 smaller messages indicating data for a single touch or +for tablet button presses. + +Signed-off-by: Chris Bagwell +Acked-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_wac.c | 94 ++++++++++++++++++++++++++++++++++++-- + drivers/input/tablet/wacom_wac.h | 3 +- + 2 files changed, 92 insertions(+), 5 deletions(-) + +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index f00c70e1adb0..c456ab04efcf 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -837,6 +837,64 @@ static int wacom_bpt_touch(struct wacom_wac *wacom) + return 0; + } + ++static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) ++{ ++ struct input_dev *input = wacom->input; ++ int slot_id = data[0] - 2; /* data[0] is between 2 and 17 */ ++ bool touch = data[1] & 0x80; ++ ++ touch = touch && !wacom->shared->stylus_in_proximity; ++ ++ input_mt_slot(input, slot_id); ++ input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); ++ ++ if (touch) { ++ int x = (data[2] << 4) | (data[4] >> 4); ++ int y = (data[3] << 4) | (data[4] & 0x0f); ++ int w = data[6]; ++ ++ input_report_abs(input, ABS_MT_POSITION_X, x); ++ input_report_abs(input, ABS_MT_POSITION_Y, y); ++ input_report_abs(input, ABS_MT_TOUCH_MAJOR, w); ++ } ++} ++ ++static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) ++{ ++ struct input_dev *input = wacom->input; ++ ++ input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); ++ input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); ++ input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); ++ input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); ++} ++ ++static int wacom_bpt3_touch(struct wacom_wac *wacom) ++{ ++ struct input_dev *input = wacom->input; ++ unsigned char *data = wacom->data; ++ int count = data[1] & 0x03; ++ int i; ++ ++ /* data has up to 7 fixed sized 8-byte messages starting at data[2] */ ++ for (i = 0; i < count; i++) { ++ int offset = (8 * i) + 2; ++ int msg_id = data[offset]; ++ ++ if (msg_id >= 2 && msg_id <= 17) ++ wacom_bpt3_touch_msg(wacom, data + offset); ++ else if (msg_id == 128) ++ wacom_bpt3_button_msg(wacom, data + offset); ++ ++ } ++ ++ input_mt_report_pointer_emulation(input, true); ++ ++ input_sync(input); ++ ++ return 0; ++} ++ + static int wacom_bpt_pen(struct wacom_wac *wacom) + { + struct input_dev *input = wacom->input; +@@ -907,7 +965,9 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) + { + if (len == WACOM_PKGLEN_BBTOUCH) + return wacom_bpt_touch(wacom); +- else if (len == WACOM_PKGLEN_BBFUN) ++ else if (len == WACOM_PKGLEN_BBTOUCH3) ++ return wacom_bpt3_touch(wacom); ++ else if (len == WACOM_PKGLEN_BBFUN || len == WACOM_PKGLEN_BBPEN) + return wacom_bpt_pen(wacom); + + return 0; +@@ -1026,9 +1086,9 @@ void wacom_setup_device_quirks(struct wacom_features *features) + features->type == BAMBOO_PT) + features->quirks |= WACOM_QUIRK_MULTI_INPUT; + +- /* quirks for bamboo touch */ ++ /* quirk for bamboo touch with 2 low res touches */ + if (features->type == BAMBOO_PT && +- features->device_type == BTN_TOOL_DOUBLETAP) { ++ features->pktlen == WACOM_PKGLEN_BBTOUCH) { + features->x_max <<= 5; + features->y_max <<= 5; + features->x_fuzz <<= 5; +@@ -1235,7 +1295,21 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, + __set_bit(BTN_TOOL_FINGER, input_dev->keybit); + __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); + +- input_mt_init_slots(input_dev, 2); ++ if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { ++ __set_bit(BTN_TOOL_TRIPLETAP, ++ input_dev->keybit); ++ __set_bit(BTN_TOOL_QUADTAP, ++ input_dev->keybit); ++ ++ input_mt_init_slots(input_dev, 16); ++ ++ input_set_abs_params(input_dev, ++ ABS_MT_TOUCH_MAJOR, ++ 0, 255, 0, 0); ++ } else { ++ input_mt_init_slots(input_dev, 2); ++ } ++ + input_set_abs_params(input_dev, ABS_MT_POSITION_X, + 0, features->x_max, + features->x_fuzz, 0); +@@ -1504,6 +1578,15 @@ static const struct wacom_features wacom_features_0xDA = + static struct wacom_features wacom_features_0xDB = + { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++static const struct wacom_features wacom_features_0xDD = ++ { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++static const struct wacom_features wacom_features_0xDE = ++ { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++static const struct wacom_features wacom_features_0xDF = ++ { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023, ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + static const struct wacom_features wacom_features_0x6004 = + { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, + 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; +@@ -1599,6 +1682,9 @@ const struct usb_device_id wacom_ids[] = { + { USB_DEVICE_WACOM(0xD8) }, + { USB_DEVICE_WACOM(0xDA) }, + { USB_DEVICE_WACOM(0xDB) }, ++ { USB_DEVICE_WACOM(0xDD) }, ++ { USB_DEVICE_WACOM(0xDE) }, ++ { USB_DEVICE_WACOM(0xDF) }, + { USB_DEVICE_WACOM(0xF0) }, + { USB_DEVICE_WACOM(0xCC) }, + { USB_DEVICE_WACOM(0x90) }, +diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h +index af94e6d9d6a9..27f1d1c203a1 100644 +--- a/drivers/input/tablet/wacom_wac.h ++++ b/drivers/input/tablet/wacom_wac.h +@@ -12,7 +12,7 @@ + #include + + /* maximum packet length for USB devices */ +-#define WACOM_PKGLEN_MAX 32 ++#define WACOM_PKGLEN_MAX 64 + + /* packet length for individual models */ + #define WACOM_PKGLEN_PENPRTN 7 +@@ -23,6 +23,7 @@ + #define WACOM_PKGLEN_TPC2FG 14 + #define WACOM_PKGLEN_BBTOUCH 20 + #define WACOM_PKGLEN_BBTOUCH3 64 ++#define WACOM_PKGLEN_BBPEN 10 + + /* device IDs */ + #define STYLUS_DEVICE_ID 0x02 +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0007-Input-wacom-ignore-unwanted-bamboo-packets.patch b/debian/patches/features/all/wacom/0007-Input-wacom-ignore-unwanted-bamboo-packets.patch new file mode 100644 index 000000000..deb175346 --- /dev/null +++ b/debian/patches/features/all/wacom/0007-Input-wacom-ignore-unwanted-bamboo-packets.patch @@ -0,0 +1,63 @@ +From: Chris Bagwell +Date: Mon, 7 Nov 2011 19:52:42 -0800 +Subject: Input: wacom - ignore unwanted bamboo packets + +commit 5a6c865d9861efdd066db1b5da491ebc2ff5926d upstream. + +Bamboo's Pen and Touch packets always start with a value +of 0x02 in first byte. In 3rd gen Bamboo's, the hw is now +periodically sending some additional packets with unrelated data +and uses a value other than 0x02 to inform driver this. + +Ignore those packets now. + +This was reported by users as bad behavior in Gimp. The +invalid packets being processed made the stylus report +out of proximity for the 1 packet and this triggered some +secondary bug which caused Gimp to stop drawing until +user really took pen out of proximity of tablet. + +Signed-off-by: Chris Bagwell +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_wac.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index c456ab04efcf..551f3a3156dc 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -799,6 +799,9 @@ static int wacom_bpt_touch(struct wacom_wac *wacom) + unsigned char *data = wacom->data; + int i; + ++ if (data[0] != 0x02) ++ return 0; ++ + for (i = 0; i < 2; i++) { + int offset = (data[1] & 0x80) ? (8 * i) : (9 * i); + bool touch = data[offset + 3] & 0x80; +@@ -876,6 +879,9 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom) + int count = data[1] & 0x03; + int i; + ++ if (data[0] != 0x02) ++ return 0; ++ + /* data has up to 7 fixed sized 8-byte messages starting at data[2] */ + for (i = 0; i < count; i++) { + int offset = (8 * i) + 2; +@@ -901,6 +907,9 @@ static int wacom_bpt_pen(struct wacom_wac *wacom) + unsigned char *data = wacom->data; + int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0; + ++ if (data[0] != 0x02) ++ return 0; ++ + prox = (data[1] & 0x20) == 0x20; + + /* +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0008-Input-wacom-add-support-for-Cintiq-24HD.patch b/debian/patches/features/all/wacom/0008-Input-wacom-add-support-for-Cintiq-24HD.patch new file mode 100644 index 000000000..d7657d5f0 --- /dev/null +++ b/debian/patches/features/all/wacom/0008-Input-wacom-add-support-for-Cintiq-24HD.patch @@ -0,0 +1,160 @@ +From: Jason Gerecke +Date: Mon, 12 Dec 2011 00:11:45 -0800 +Subject: Input: wacom - add support for Cintiq 24HD + +commit 803296b678a43005e3bc0aaa1951d211bd76a054 upstream. + +Adds support for the Cintiq 24HD. There are two quirks about this +model that haven't been seen in prior tablets. First, a second +touch ring is present on this display; it is being exposed via the +ABS_THROTTLE axis. Second, three capacitive buttons at the top of +the unit are available; though physically a touch strip, we report +the use of these buttons with generic KEY_ events. + +Signed-off-by: Jason Gerecke +Reviewed-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_wac.c | 77 +++++++++++++++++++++++++++++++++++++- + drivers/input/tablet/wacom_wac.h | 1 + + 2 files changed, 77 insertions(+), 1 deletion(-) + +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index 551f3a3156dc..88672ec296c1 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -452,7 +452,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom) + if ((data[1] & 0xb8) == 0xa0) { + t = (data[6] << 2) | ((data[7] >> 6) & 3); + if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || +- features->type == WACOM_21UX2) { ++ features->type == WACOM_21UX2 || features->type == WACOM_24HD) { + t = (t << 1) | (data[1] & 1); + } + input_report_abs(input, ABS_PRESSURE, t); +@@ -519,6 +519,56 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) + input_report_key(input, wacom->tool[1], 0); + input_report_abs(input, ABS_MISC, 0); + } ++ } else if (features->type == WACOM_24HD) { ++ input_report_key(input, BTN_0, (data[6] & 0x01)); ++ input_report_key(input, BTN_1, (data[6] & 0x02)); ++ input_report_key(input, BTN_2, (data[6] & 0x04)); ++ input_report_key(input, BTN_3, (data[6] & 0x08)); ++ input_report_key(input, BTN_4, (data[6] & 0x10)); ++ input_report_key(input, BTN_5, (data[6] & 0x20)); ++ input_report_key(input, BTN_6, (data[6] & 0x40)); ++ input_report_key(input, BTN_7, (data[6] & 0x80)); ++ input_report_key(input, BTN_8, (data[8] & 0x01)); ++ input_report_key(input, BTN_9, (data[8] & 0x02)); ++ input_report_key(input, BTN_A, (data[8] & 0x04)); ++ input_report_key(input, BTN_B, (data[8] & 0x08)); ++ input_report_key(input, BTN_C, (data[8] & 0x10)); ++ input_report_key(input, BTN_X, (data[8] & 0x20)); ++ input_report_key(input, BTN_Y, (data[8] & 0x40)); ++ input_report_key(input, BTN_Z, (data[8] & 0x80)); ++ ++ /* ++ * Three "buttons" are available on the 24HD which are ++ * physically implemented as a touchstrip. Each button ++ * is approximately 3 bits wide with a 2 bit spacing. ++ * The raw touchstrip bits are stored at: ++ * ((data[3] & 0x1f) << 8) | data[4]) ++ */ ++ input_report_key(input, KEY_PROG1, data[4] & 0x07); ++ input_report_key(input, KEY_PROG2, data[4] & 0xE0); ++ input_report_key(input, KEY_PROG3, data[3] & 0x1C); ++ ++ if (data[1] & 0x80) { ++ input_report_abs(input, ABS_WHEEL, (data[1] & 0x7f)); ++ } else { ++ /* Out of proximity, clear wheel value. */ ++ input_report_abs(input, ABS_WHEEL, 0); ++ } ++ ++ if (data[2] & 0x80) { ++ input_report_abs(input, ABS_THROTTLE, (data[2] & 0x7f)); ++ } else { ++ /* Out of proximity, clear second wheel value. */ ++ input_report_abs(input, ABS_THROTTLE, 0); ++ } ++ ++ if (data[1] | data[2] | (data[3] & 0x1f) | data[4] | data[6] | data[8]) { ++ input_report_key(input, wacom->tool[1], 1); ++ input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); ++ } else { ++ input_report_key(input, wacom->tool[1], 0); ++ input_report_abs(input, ABS_MISC, 0); ++ } + } else { + if (features->type == WACOM_21UX2) { + input_report_key(input, BTN_0, (data[5] & 0x01)); +@@ -1019,6 +1069,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) + case CINTIQ: + case WACOM_BEE: + case WACOM_21UX2: ++ case WACOM_24HD: + sync = wacom_intuos_irq(wacom_wac); + break; + +@@ -1174,6 +1225,26 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, + __set_bit(INPUT_PROP_POINTER, input_dev->propbit); + break; + ++ case WACOM_24HD: ++ __set_bit(BTN_A, input_dev->keybit); ++ __set_bit(BTN_B, input_dev->keybit); ++ __set_bit(BTN_C, input_dev->keybit); ++ __set_bit(BTN_X, input_dev->keybit); ++ __set_bit(BTN_Y, input_dev->keybit); ++ __set_bit(BTN_Z, input_dev->keybit); ++ ++ for (i = 0; i < 10; i++) ++ __set_bit(BTN_0 + i, input_dev->keybit); ++ ++ __set_bit(KEY_PROG1, input_dev->keybit); ++ __set_bit(KEY_PROG2, input_dev->keybit); ++ __set_bit(KEY_PROG3, input_dev->keybit); ++ ++ input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); ++ input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); ++ wacom_setup_cintiq(wacom_wac); ++ break; ++ + case WACOM_21UX2: + __set_bit(BTN_A, input_dev->keybit); + __set_bit(BTN_B, input_dev->keybit); +@@ -1503,6 +1574,9 @@ static const struct wacom_features wacom_features_0xBB = + static const struct wacom_features wacom_features_0xBC = + { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, + 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; ++static const struct wacom_features wacom_features_0xF4 = ++ { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, ++ 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; + static const struct wacom_features wacom_features_0x3F = + { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, + 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; +@@ -1706,6 +1780,7 @@ const struct usb_device_id wacom_ids[] = { + { USB_DEVICE_WACOM(0xE6) }, + { USB_DEVICE_WACOM(0xEC) }, + { USB_DEVICE_WACOM(0x47) }, ++ { USB_DEVICE_WACOM(0xF4) }, + { USB_DEVICE_LENOVO(0x6004) }, + { } + }; +diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h +index 27f1d1c203a1..050acaefee7d 100644 +--- a/drivers/input/tablet/wacom_wac.h ++++ b/drivers/input/tablet/wacom_wac.h +@@ -59,6 +59,7 @@ enum { + INTUOS4S, + INTUOS4, + INTUOS4L, ++ WACOM_24HD, + WACOM_21UX2, + CINTIQ, + WACOM_BEE, +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0009-Input-wacom-add-LED-support-for-Cintiq-24HD.patch b/debian/patches/features/all/wacom/0009-Input-wacom-add-LED-support-for-Cintiq-24HD.patch new file mode 100644 index 000000000..5e13941c7 --- /dev/null +++ b/debian/patches/features/all/wacom/0009-Input-wacom-add-LED-support-for-Cintiq-24HD.patch @@ -0,0 +1,93 @@ +From: Jason Gerecke +Date: Mon, 12 Dec 2011 00:12:04 -0800 +Subject: Input: wacom - add LED support for Cintiq 24HD + +commit 246835fccdc0dadeda20cd51f7ec868031fa8142 upstream. + +The Cintiq 24HD has three LEDs on the left side of the tablet and +three LEDs on the right side of the tablet. Switching to LED 0, +1, or 2 will enable the top, middle, or bottom LED for the respective +side. Switching to LED 3 turns off the LEDs on the respective side. + +Signed-off-by: Jason Gerecke +Reviewed-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + Documentation/ABI/testing/sysfs-driver-wacom | 17 +++++++++-------- + drivers/input/tablet/wacom_sys.c | 5 ++++- + 2 files changed, 13 insertions(+), 9 deletions(-) + +diff --git a/Documentation/ABI/testing/sysfs-driver-wacom b/Documentation/ABI/testing/sysfs-driver-wacom +index 82d4df136444..0130d6683c14 100644 +--- a/Documentation/ABI/testing/sysfs-driver-wacom ++++ b/Documentation/ABI/testing/sysfs-driver-wacom +@@ -15,9 +15,9 @@ Contact: linux-input@vger.kernel.org + Description: + Attribute group for control of the status LEDs and the OLEDs. + This attribute group is only available for Intuos 4 M, L, +- and XL (with LEDs and OLEDs) and Cintiq 21UX2 (LEDs only). +- Therefore its presence implicitly signifies the presence of +- said LEDs and OLEDs on the tablet device. ++ and XL (with LEDs and OLEDs) and Cintiq 21UX2 and Cintiq 24HD ++ (LEDs only). Therefore its presence implicitly signifies the ++ presence of said LEDs and OLEDs on the tablet device. + + What: /sys/bus/usb/devices/-:./wacom_led/status0_luminance + Date: August 2011 +@@ -41,16 +41,17 @@ Date: August 2011 + Contact: linux-input@vger.kernel.org + Description: + Writing to this file sets which one of the four (for Intuos 4) +- or of the right four (for Cintiq 21UX2) status LEDs is active (0..3). +- The other three LEDs on the same side are always inactive. ++ or of the right four (for Cintiq 21UX2 and Cintiq 24HD) status ++ LEDs is active (0..3). The other three LEDs on the same side are ++ always inactive. + + What: /sys/bus/usb/devices/-:./wacom_led/status_led1_select + Date: September 2011 + Contact: linux-input@vger.kernel.org + Description: +- Writing to this file sets which one of the left four (for Cintiq 21UX2) +- status LEDs is active (0..3). The other three LEDs on the left are always +- inactive. ++ Writing to this file sets which one of the left four (for Cintiq 21UX2 ++ and Cintiq 24HD) status LEDs is active (0..3). The other three LEDs on ++ the left are always inactive. + + What: /sys/bus/usb/devices/-:./wacom_led/buttons_luminance + Date: August 2011 +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index 2fe21d1a18b7..7e63183a6c68 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -563,7 +563,8 @@ static int wacom_led_control(struct wacom *wacom) + if (!buf) + return -ENOMEM; + +- if (wacom->wacom_wac.features.type == WACOM_21UX2) ++ if (wacom->wacom_wac.features.type == WACOM_21UX2 || ++ wacom->wacom_wac.features.type == WACOM_24HD) + led = (wacom->led.select[1] << 4) | 0x40; + + led |= wacom->led.select[0] | 0x4; +@@ -782,6 +783,7 @@ static int wacom_initialize_leds(struct wacom *wacom) + &intuos4_led_attr_group); + break; + ++ case WACOM_24HD: + case WACOM_21UX2: + wacom->led.select[0] = 0; + wacom->led.select[1] = 0; +@@ -816,6 +818,7 @@ static void wacom_destroy_leds(struct wacom *wacom) + &intuos4_led_attr_group); + break; + ++ case WACOM_24HD: + case WACOM_21UX2: + sysfs_remove_group(&wacom->intf->dev.kobj, + &cintiq_led_attr_group); +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0010-Input-wacom-use-BTN_TOOL_FINGER-to-indicate-touch-de.patch b/debian/patches/features/all/wacom/0010-Input-wacom-use-BTN_TOOL_FINGER-to-indicate-touch-de.patch new file mode 100644 index 000000000..7ccdbde55 --- /dev/null +++ b/debian/patches/features/all/wacom/0010-Input-wacom-use-BTN_TOOL_FINGER-to-indicate-touch-de.patch @@ -0,0 +1,83 @@ +From: Ping Cheng +Date: Tue, 31 Jan 2012 00:07:33 -0800 +Subject: Input: wacom - use BTN_TOOL_FINGER to indicate touch device type + +commit 8b4a0c1fe3b03c0cfe829413481d69c2e6fd844c upstream. + +Tested-by: Chris Bagwell +Reviewed-by: Chris Bagwell +Signed-off-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_sys.c | 6 +----- + drivers/input/tablet/wacom_wac.c | 4 ++-- + 2 files changed, 3 insertions(+), 7 deletions(-) + +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index 7e63183a6c68..c9588eececfb 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -176,7 +176,7 @@ static int wacom_parse_logical_collection(unsigned char *report, + + /* Logical collection is only used by 3rd gen Bamboo Touch */ + features->pktlen = WACOM_PKGLEN_BBTOUCH3; +- features->device_type = BTN_TOOL_DOUBLETAP; ++ features->device_type = BTN_TOOL_FINGER; + + /* + * Stylus and Touch have same active area +@@ -286,12 +286,10 @@ static int wacom_parse_hid(struct usb_interface *intf, + if (features->type == TABLETPC2FG) { + /* need to reset back */ + features->pktlen = WACOM_PKGLEN_TPC2FG; +- features->device_type = BTN_TOOL_DOUBLETAP; + } + if (features->type == BAMBOO_PT) { + /* need to reset back */ + features->pktlen = WACOM_PKGLEN_BBTOUCH; +- features->device_type = BTN_TOOL_DOUBLETAP; + features->x_phy = + get_unaligned_le16(&report[i + 5]); + features->x_max = +@@ -325,7 +323,6 @@ static int wacom_parse_hid(struct usb_interface *intf, + if (features->type == TABLETPC2FG) { + /* need to reset back */ + features->pktlen = WACOM_PKGLEN_TPC2FG; +- features->device_type = BTN_TOOL_DOUBLETAP; + features->y_max = + get_unaligned_le16(&report[i + 3]); + features->y_phy = +@@ -334,7 +331,6 @@ static int wacom_parse_hid(struct usb_interface *intf, + } else if (features->type == BAMBOO_PT) { + /* need to reset back */ + features->pktlen = WACOM_PKGLEN_BBTOUCH; +- features->device_type = BTN_TOOL_DOUBLETAP; + features->y_phy = + get_unaligned_le16(&report[i + 3]); + features->y_max = +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index 88672ec296c1..3c9f4b8cfe8f 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -1317,7 +1317,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, + break; + + case TABLETPC2FG: +- if (features->device_type == BTN_TOOL_DOUBLETAP) { ++ if (features->device_type == BTN_TOOL_FINGER) { + + input_mt_init_slots(input_dev, 2); + input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, +@@ -1366,7 +1366,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, + + __set_bit(INPUT_PROP_POINTER, input_dev->propbit); + +- if (features->device_type == BTN_TOOL_DOUBLETAP) { ++ if (features->device_type == BTN_TOOL_FINGER) { + __set_bit(BTN_LEFT, input_dev->keybit); + __set_bit(BTN_FORWARD, input_dev->keybit); + __set_bit(BTN_BACK, input_dev->keybit); +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0011-Input-wacom-use-switch-statement-for-wacom_tpc_irq.patch b/debian/patches/features/all/wacom/0011-Input-wacom-use-switch-statement-for-wacom_tpc_irq.patch new file mode 100644 index 000000000..1f0417271 --- /dev/null +++ b/debian/patches/features/all/wacom/0011-Input-wacom-use-switch-statement-for-wacom_tpc_irq.patch @@ -0,0 +1,69 @@ +From: Ping Cheng +Date: Tue, 31 Jan 2012 00:07:33 -0800 +Subject: Input: wacom - use switch statement for wacom_tpc_irq() + +commit 31175a8348af76aea2f557857c90467d13632dc3 upstream. + +And add two new data formats. + +Tested-by: Chris Bagwell +Reviewed-by: Chris Bagwell +Signed-off-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_wac.c | 24 ++++++++++++++++++------ + drivers/input/tablet/wacom_wac.h | 2 ++ + 2 files changed, 20 insertions(+), 6 deletions(-) + +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index 3c9f4b8cfe8f..07a1f218b5c1 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -832,12 +832,24 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) + + dbg("wacom_tpc_irq: received report #%d", data[0]); + +- if (len == WACOM_PKGLEN_TPC1FG || data[0] == WACOM_REPORT_TPC1FG) +- return wacom_tpc_single_touch(wacom, len); +- else if (data[0] == WACOM_REPORT_TPC2FG) +- return wacom_tpc_mt_touch(wacom); +- else if (data[0] == WACOM_REPORT_PENABLED) +- return wacom_tpc_pen(wacom); ++ switch (len) { ++ case WACOM_PKGLEN_TPC1FG: ++ return wacom_tpc_single_touch(wacom, len); ++ ++ case WACOM_PKGLEN_TPC2FG: ++ return wacom_tpc_mt_touch(wacom); ++ ++ default: ++ switch (data[0]) { ++ case WACOM_REPORT_TPC1FG: ++ case WACOM_REPORT_TPCHID: ++ case WACOM_REPORT_TPCST: ++ return wacom_tpc_single_touch(wacom, len); ++ ++ case WACOM_REPORT_PENABLED: ++ return wacom_tpc_pen(wacom); ++ } ++ } + + return 0; + } +diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h +index 050acaefee7d..4f0ba21b0196 100644 +--- a/drivers/input/tablet/wacom_wac.h ++++ b/drivers/input/tablet/wacom_wac.h +@@ -39,6 +39,8 @@ + #define WACOM_REPORT_INTUOSPAD 12 + #define WACOM_REPORT_TPC1FG 6 + #define WACOM_REPORT_TPC2FG 13 ++#define WACOM_REPORT_TPCHID 15 ++#define WACOM_REPORT_TPCST 16 + + /* device quirks */ + #define WACOM_QUIRK_MULTI_INPUT 0x0001 +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0012-Input-wacom-add-missing-LEDS_CLASS-to-Kconfig.patch b/debian/patches/features/all/wacom/0012-Input-wacom-add-missing-LEDS_CLASS-to-Kconfig.patch new file mode 100644 index 000000000..cf0f75447 --- /dev/null +++ b/debian/patches/features/all/wacom/0012-Input-wacom-add-missing-LEDS_CLASS-to-Kconfig.patch @@ -0,0 +1,29 @@ +From: Chris Bagwell +Date: Wed, 8 Feb 2012 23:08:48 -0800 +Subject: Input: wacom - add missing LEDS_CLASS to Kconfig + +commit 68513a4c5fe68938350cf2c56d97946e49f014e1 upstream. + +Signed-off-by: Chris Bagwell +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/Kconfig | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/input/tablet/Kconfig b/drivers/input/tablet/Kconfig +index 58a87755b936..e53f4081a586 100644 +--- a/drivers/input/tablet/Kconfig ++++ b/drivers/input/tablet/Kconfig +@@ -77,6 +77,8 @@ config TABLET_USB_WACOM + tristate "Wacom Intuos/Graphire tablet support (USB)" + depends on USB_ARCH_HAS_HCD + select USB ++ select NEW_LEDS ++ select LEDS_CLASS + help + Say Y here if you want to use the USB version of the Wacom Intuos + or Graphire tablet. Make sure to say Y to "Mouse support" +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0013-Input-wacom-fix-3rd-gen-Bamboo-MT-when-4-fingers-are.patch b/debian/patches/features/all/wacom/0013-Input-wacom-fix-3rd-gen-Bamboo-MT-when-4-fingers-are.patch new file mode 100644 index 000000000..9a6d6e9b6 --- /dev/null +++ b/debian/patches/features/all/wacom/0013-Input-wacom-fix-3rd-gen-Bamboo-MT-when-4-fingers-are.patch @@ -0,0 +1,32 @@ +From: Jason Gerecke +Date: Tue, 6 Mar 2012 10:19:19 -0800 +Subject: Input: wacom - fix 3rd-gen Bamboo MT when 4+ fingers are in use + +commit 19d57d3a145e94349abf805eed2316ef720d86c2 upstream. + +The message count field uses three bits of storage, not two. + +Signed-off-by: Jason Gerecke +Acked-by: Chris Bagwell +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_wac.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index 07a1f218b5c1..89a96427faa0 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -938,7 +938,7 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom) + { + struct input_dev *input = wacom->input; + unsigned char *data = wacom->data; +- int count = data[1] & 0x03; ++ int count = data[1] & 0x07; + int i; + + if (data[0] != 0x02) +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0014-Input-wacom-fix-physical-size-calculation-for-3rd-ge.patch b/debian/patches/features/all/wacom/0014-Input-wacom-fix-physical-size-calculation-for-3rd-ge.patch new file mode 100644 index 000000000..c94efbe1b --- /dev/null +++ b/debian/patches/features/all/wacom/0014-Input-wacom-fix-physical-size-calculation-for-3rd-ge.patch @@ -0,0 +1,42 @@ +From: Jason Gerecke +Date: Mon, 12 Mar 2012 22:15:43 -0700 +Subject: Input: wacom - fix physical size calculation for 3rd-gen Bamboo + +commit 24e3e5ae1e4c2a3a32f5b1f96b4e3fd721806acd upstream. + +This calculation determines the physical dimensions of the tablet, +used later on in calculate_touch_res to obtain the touch sensor +resolution. + +Instead of dividing the logical size by the resolution, the current +code performs a multiplication. This doesn't pose a problem for the +3rd-gen Bamboo since the resolution and scale factor happen to be +identical, but will produce an incorrect result for other cases. + +Signed-off-by: Jason Gerecke +Reviewed-by: Chris Bagwell +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_sys.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index c9588eececfb..dc07821fdae3 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -184,9 +184,9 @@ static int wacom_parse_logical_collection(unsigned char *report, + * data before its overwritten. + */ + features->x_phy = +- (features->x_max * features->x_resolution) / 100; ++ (features->x_max * 100) / features->x_resolution; + features->y_phy = +- (features->y_max * features->y_resolution) / 100; ++ (features->y_max * 100) / features->y_resolution; + + features->x_max = features->y_max = + get_unaligned_le16(&report[10]); +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0015-Input-wacom-isolate-input-registration.patch b/debian/patches/features/all/wacom/0015-Input-wacom-isolate-input-registration.patch new file mode 100644 index 000000000..0b64cf21a --- /dev/null +++ b/debian/patches/features/all/wacom/0015-Input-wacom-isolate-input-registration.patch @@ -0,0 +1,127 @@ +From: Chris Bagwell +Date: Sun, 25 Mar 2012 23:25:45 -0700 +Subject: Input: wacom - isolate input registration + +commit 3aac0ef10bf5c76ba4262cfd9b044a6c067d5aae upstream. + +Although this better co-locates input registration logic, +the main goal is to make it easier to optionally create +input devices or delay creation to later time periods. + +Signed-off-by: Chris Bagwell +Tested-by: Jason Gerecke +Acked-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_sys.c | 53 ++++++++++++++++++++++++-------------- + 1 file changed, 33 insertions(+), 20 deletions(-) + +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index dc07821fdae3..59a42e23ddfa 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -822,6 +822,37 @@ static void wacom_destroy_leds(struct wacom *wacom) + } + } + ++static int wacom_register_input(struct wacom *wacom) ++{ ++ struct input_dev *input_dev; ++ struct usb_interface *intf = wacom->intf; ++ struct usb_device *dev = interface_to_usbdev(intf); ++ struct wacom_wac *wacom_wac = &(wacom->wacom_wac); ++ int error; ++ ++ input_dev = input_allocate_device(); ++ if (!input_dev) ++ return -ENOMEM; ++ ++ input_dev->name = wacom_wac->name; ++ input_dev->dev.parent = &intf->dev; ++ input_dev->open = wacom_open; ++ input_dev->close = wacom_close; ++ usb_to_input_id(dev, &input_dev->id); ++ input_set_drvdata(input_dev, wacom); ++ ++ wacom_wac->input = input_dev; ++ wacom_setup_input_capabilities(input_dev, wacom_wac); ++ ++ error = input_register_device(input_dev); ++ if (error) { ++ input_free_device(input_dev); ++ wacom_wac->input = NULL; ++ } ++ ++ return error; ++} ++ + static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) + { + struct usb_device *dev = interface_to_usbdev(intf); +@@ -829,18 +860,12 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i + struct wacom *wacom; + struct wacom_wac *wacom_wac; + struct wacom_features *features; +- struct input_dev *input_dev; + int error; + + if (!id->driver_info) + return -EINVAL; + + wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); +- input_dev = input_allocate_device(); +- if (!wacom || !input_dev) { +- error = -ENOMEM; +- goto fail1; +- } + + wacom_wac = &wacom->wacom_wac; + wacom_wac->features = *((struct wacom_features *)id->driver_info); +@@ -869,8 +894,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i + usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); + strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); + +- wacom_wac->input = input_dev; +- + endpoint = &intf->cur_altsetting->endpoint[0].desc; + + /* Retrieve the physical and logical size for OEM devices */ +@@ -894,15 +917,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i + goto fail3; + } + +- input_dev->name = wacom_wac->name; +- input_dev->dev.parent = &intf->dev; +- input_dev->open = wacom_open; +- input_dev->close = wacom_close; +- usb_to_input_id(dev, &input_dev->id); +- input_set_drvdata(input_dev, wacom); +- +- wacom_setup_input_capabilities(input_dev, wacom_wac); +- + usb_fill_int_urb(wacom->irq, dev, + usb_rcvintpipe(dev, endpoint->bEndpointAddress), + wacom_wac->data, features->pktlen, +@@ -914,7 +928,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i + if (error) + goto fail4; + +- error = input_register_device(input_dev); ++ error = wacom_register_input(wacom); + if (error) + goto fail5; + +@@ -928,8 +942,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i + fail4: wacom_remove_shared_data(wacom_wac); + fail3: usb_free_urb(wacom->irq); + fail2: usb_free_coherent(dev, WACOM_PKGLEN_MAX, wacom_wac->data, wacom->data_dma); +- fail1: input_free_device(input_dev); +- kfree(wacom); ++ fail1: kfree(wacom); + return error; + } + +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0016-Input-wacom-check-for-allocation-failure-in-probe.patch b/debian/patches/features/all/wacom/0016-Input-wacom-check-for-allocation-failure-in-probe.patch new file mode 100644 index 000000000..10247db45 --- /dev/null +++ b/debian/patches/features/all/wacom/0016-Input-wacom-check-for-allocation-failure-in-probe.patch @@ -0,0 +1,33 @@ +From: Dan Carpenter +Date: Thu, 29 Mar 2012 22:38:11 -0700 +Subject: Input: wacom - check for allocation failure in probe() + +commit f182394033d639679264d61e6dca62761e659ff7 upstream. + +We accidentally removed the check for NULL in 3aac0ef10b "Input: wacom - +isolate input registration". + +Signed-off-by: Dan Carpenter +Reviewed-by: Chris Bagwell +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_sys.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index 59a42e23ddfa..bf2462132c5c 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -866,6 +866,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i + return -EINVAL; + + wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); ++ if (!wacom) ++ return -ENOMEM; + + wacom_wac = &wacom->wacom_wac; + wacom_wac->features = *((struct wacom_features *)id->driver_info); +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0017-Input-wacom-wireless-monitor-framework.patch b/debian/patches/features/all/wacom/0017-Input-wacom-wireless-monitor-framework.patch new file mode 100644 index 000000000..ee27989be --- /dev/null +++ b/debian/patches/features/all/wacom/0017-Input-wacom-wireless-monitor-framework.patch @@ -0,0 +1,219 @@ +From: Chris Bagwell +Date: Sun, 25 Mar 2012 23:26:11 -0700 +Subject: Input: wacom - wireless monitor framework + +commit d3825d51c3eddb8a3c7d1281f27181aff6db19b8 upstream. + +The 3rd gen Bamboo Pen & Touch and Intuos5 tablets support an +optional wireless module. When its receiver is plugged into USB, +it presents 3 interfaces: 0) Monitor 1) Pen and 2) Touch. + +The exact capabilities of the Pen and Touch interfaces can +not be determined until a tablet connection is established +and reported over the Monitor interface. + +This patch detects this wireless receiver and enables interrupt +packets to be processed for the Monitor interface. Processing +the data in packets will be left to another patch. + +Since it doesn't make sense to create an input device for the +Monitor interface, it is not created. Creation of Pen and Touch +input device is also delayed until monitor packets can be processed. + +Signed-off-by: Chris Bagwell +Tested-by: Jason Gerecke +Acked-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_sys.c | 36 +++++++++++++++++++++++++++++++----- + drivers/input/tablet/wacom_wac.c | 28 +++++++++++++++++++++++++++- + drivers/input/tablet/wacom_wac.h | 4 ++++ + 3 files changed, 62 insertions(+), 6 deletions(-) + +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index bf2462132c5c..223246575860 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -422,6 +422,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat + report_id, rep_data, 4, 1); + } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); + } else if (features->type != TABLETPC && ++ features->type != WIRELESS && + features->device_type == BTN_TOOL_PEN) { + do { + rep_data[0] = 2; +@@ -454,6 +455,21 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, + features->pressure_fuzz = 0; + features->distance_fuzz = 0; + ++ /* ++ * The wireless device HID is basic and layout conflicts with ++ * other tablets (monitor and touch interface can look like pen). ++ * Skip the query for this type and modify defaults based on ++ * interface number. ++ */ ++ if (features->type == WIRELESS) { ++ if (intf->cur_altsetting->desc.bInterfaceNumber == 0) { ++ features->device_type = 0; ++ } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) { ++ features->device_type = BTN_TOOL_DOUBLETAP; ++ features->pktlen = WACOM_PKGLEN_BBTOUCH3; ++ } ++ } ++ + /* only Tablet PCs and Bamboo P&T need to retrieve the info */ + if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) && + (features->type != BAMBOO_PT)) +@@ -930,14 +946,22 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i + if (error) + goto fail4; + +- error = wacom_register_input(wacom); +- if (error) +- goto fail5; ++ if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { ++ error = wacom_register_input(wacom); ++ if (error) ++ goto fail5; ++ } + + /* Note that if query fails it is not a hard failure */ + wacom_query_tablet_data(intf, features); + + usb_set_intfdata(intf, wacom); ++ ++ if (features->quirks & WACOM_QUIRK_MONITOR) { ++ if (usb_submit_urb(wacom->irq, GFP_KERNEL)) ++ goto fail5; ++ } ++ + return 0; + + fail5: wacom_destroy_leds(wacom); +@@ -955,7 +979,8 @@ static void wacom_disconnect(struct usb_interface *intf) + usb_set_intfdata(intf, NULL); + + usb_kill_urb(wacom->irq); +- input_unregister_device(wacom->wacom_wac.input); ++ if (wacom->wacom_wac.input) ++ input_unregister_device(wacom->wacom_wac.input); + wacom_destroy_leds(wacom); + usb_free_urb(wacom->irq); + usb_free_coherent(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, +@@ -987,7 +1012,8 @@ static int wacom_resume(struct usb_interface *intf) + wacom_query_tablet_data(intf, features); + wacom_led_control(wacom); + +- if (wacom->open && usb_submit_urb(wacom->irq, GFP_NOIO) < 0) ++ if ((wacom->open || features->quirks & WACOM_QUIRK_MONITOR) ++ && usb_submit_urb(wacom->irq, GFP_NOIO) < 0) + rv = -EIO; + + mutex_unlock(&wacom->lock); +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index 89a96427faa0..8b73b05f5aef 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -1044,6 +1044,14 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) + return 0; + } + ++static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) ++{ ++ if (len != WACOM_PKGLEN_WIRELESS) ++ return 0; ++ ++ return 0; ++} ++ + void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) + { + bool sync; +@@ -1094,6 +1102,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) + sync = wacom_bpt_irq(wacom_wac, len); + break; + ++ case WIRELESS: ++ sync = wacom_wireless_irq(wacom_wac, len); ++ break; ++ + default: + sync = false; + break; +@@ -1155,7 +1167,7 @@ void wacom_setup_device_quirks(struct wacom_features *features) + + /* these device have multiple inputs */ + if (features->type == TABLETPC || features->type == TABLETPC2FG || +- features->type == BAMBOO_PT) ++ features->type == BAMBOO_PT || features->type == WIRELESS) + features->quirks |= WACOM_QUIRK_MULTI_INPUT; + + /* quirk for bamboo touch with 2 low res touches */ +@@ -1167,6 +1179,16 @@ void wacom_setup_device_quirks(struct wacom_features *features) + features->y_fuzz <<= 5; + features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES; + } ++ ++ if (features->type == WIRELESS) { ++ ++ /* monitor never has input and pen/touch have delayed create */ ++ features->quirks |= WACOM_QUIRK_NO_INPUT; ++ ++ /* must be monitor interface if no device_type set */ ++ if (!features->device_type) ++ features->quirks |= WACOM_QUIRK_MONITOR; ++ } + } + + static unsigned int wacom_calculate_touch_res(unsigned int logical_max, +@@ -1640,6 +1662,9 @@ static const struct wacom_features wacom_features_0xEC = + 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 }; ++static const struct wacom_features wacom_features_0x84 = ++ { "Wacom Wireless Receiver", WACOM_PKGLEN_WIRELESS, 0, 0, 0, ++ 0, WIRELESS, 0, 0 }; + static const struct wacom_features wacom_features_0xD0 = + { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; +@@ -1766,6 +1791,7 @@ const struct usb_device_id wacom_ids[] = { + { USB_DEVICE_DETAILED(0xCE, USB_CLASS_HID, + USB_INTERFACE_SUBCLASS_BOOT, + USB_INTERFACE_PROTOCOL_MOUSE) }, ++ { USB_DEVICE_WACOM(0x84) }, + { USB_DEVICE_WACOM(0xD0) }, + { USB_DEVICE_WACOM(0xD1) }, + { USB_DEVICE_WACOM(0xD2) }, +diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h +index 4f0ba21b0196..2c04b6248a56 100644 +--- a/drivers/input/tablet/wacom_wac.h ++++ b/drivers/input/tablet/wacom_wac.h +@@ -24,6 +24,7 @@ + #define WACOM_PKGLEN_BBTOUCH 20 + #define WACOM_PKGLEN_BBTOUCH3 64 + #define WACOM_PKGLEN_BBPEN 10 ++#define WACOM_PKGLEN_WIRELESS 32 + + /* device IDs */ + #define STYLUS_DEVICE_ID 0x02 +@@ -45,6 +46,8 @@ + /* device quirks */ + #define WACOM_QUIRK_MULTI_INPUT 0x0001 + #define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002 ++#define WACOM_QUIRK_NO_INPUT 0x0004 ++#define WACOM_QUIRK_MONITOR 0x0008 + + enum { + PENPARTNER = 0, +@@ -54,6 +57,7 @@ enum { + PL, + DTU, + BAMBOO_PT, ++ WIRELESS, + INTUOS, + INTUOS3S, + INTUOS3, +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0018-Input-wacom-create-inputs-when-wireless-connect.patch b/debian/patches/features/all/wacom/0018-Input-wacom-create-inputs-when-wireless-connect.patch new file mode 100644 index 000000000..d07aa9604 --- /dev/null +++ b/debian/patches/features/all/wacom/0018-Input-wacom-create-inputs-when-wireless-connect.patch @@ -0,0 +1,234 @@ +From: Chris Bagwell +Date: Sun, 25 Mar 2012 23:26:20 -0700 +Subject: Input: wacom - create inputs when wireless connect + +commit 16bf288c4be67b68c3fcb6561ff145702cb7bd22 upstream. + +When a tablet connect or disconnect is detected, schedule +work queue to register or unregister related input devices. + +When a wireless tablet connects, it reports same USB PID +used if tablet is connected with USB cable. Use this to +update features values, set input capabilities, and then +register device. From there, the Pen and Touch interfaces +will reuse the existing tablet's IRQ routines. + +Its possible that 1 receiver is shared with 2 tablets with +different PID (small and medium Bamboo for example) so the +input is unregister at disconnect to better support this case. + +Signed-off-by: Chris Bagwell +Tested-by: Jason Gerecke +Acked-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom.h | 7 +++ + drivers/input/tablet/wacom_sys.c | 91 ++++++++++++++++++++++++++++++++++---- + drivers/input/tablet/wacom_wac.c | 20 ++++++++- + drivers/input/tablet/wacom_wac.h | 1 + + 4 files changed, 109 insertions(+), 10 deletions(-) + +diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h +index 0783864a7dc2..febbfd9f3a84 100644 +--- a/drivers/input/tablet/wacom.h ++++ b/drivers/input/tablet/wacom.h +@@ -112,6 +112,7 @@ struct wacom { + struct urb *irq; + struct wacom_wac wacom_wac; + struct mutex lock; ++ struct work_struct work; + bool open; + char phys[32]; + struct wacom_led { +@@ -122,6 +123,12 @@ struct wacom { + } led; + }; + ++static inline void wacom_schedule_work(struct wacom_wac *wacom_wac) ++{ ++ struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); ++ schedule_work(&wacom->work); ++} ++ + extern const struct usb_device_id wacom_ids[]; + + void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len); +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index 223246575860..1bcf555ff340 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -167,6 +167,19 @@ static void wacom_close(struct input_dev *dev) + usb_autopm_put_interface(wacom->intf); + } + ++/* ++ * Static values for max X/Y and resolution of Pen interface is stored in ++ * features. This mean physical size of active area can be computed. ++ * This is useful to do when Pen and Touch have same active area of tablet. ++ * This means for Touch device, we only need to find max X/Y value and we ++ * have enough information to compute resolution of touch. ++ */ ++static void wacom_set_phy_from_res(struct wacom_features *features) ++{ ++ features->x_phy = (features->x_max * 100) / features->x_resolution; ++ features->y_phy = (features->y_max * 100) / features->y_resolution; ++} ++ + static int wacom_parse_logical_collection(unsigned char *report, + struct wacom_features *features) + { +@@ -178,15 +191,7 @@ static int wacom_parse_logical_collection(unsigned char *report, + features->pktlen = WACOM_PKGLEN_BBTOUCH3; + features->device_type = BTN_TOOL_FINGER; + +- /* +- * Stylus and Touch have same active area +- * so compute physical size based on stylus +- * data before its overwritten. +- */ +- features->x_phy = +- (features->x_max * 100) / features->x_resolution; +- features->y_phy = +- (features->y_max * 100) / features->y_resolution; ++ wacom_set_phy_from_res(features); + + features->x_max = features->y_max = + get_unaligned_le16(&report[10]); +@@ -869,6 +874,72 @@ static int wacom_register_input(struct wacom *wacom) + return error; + } + ++static void wacom_wireless_work(struct work_struct *work) ++{ ++ struct wacom *wacom = container_of(work, struct wacom, work); ++ struct usb_device *usbdev = wacom->usbdev; ++ struct wacom_wac *wacom_wac = &wacom->wacom_wac; ++ ++ /* ++ * Regardless if this is a disconnect or a new tablet, ++ * remove any existing input devices. ++ */ ++ ++ /* Stylus interface */ ++ wacom = usb_get_intfdata(usbdev->config->interface[1]); ++ if (wacom->wacom_wac.input) ++ input_unregister_device(wacom->wacom_wac.input); ++ wacom->wacom_wac.input = 0; ++ ++ /* Touch interface */ ++ wacom = usb_get_intfdata(usbdev->config->interface[2]); ++ if (wacom->wacom_wac.input) ++ input_unregister_device(wacom->wacom_wac.input); ++ wacom->wacom_wac.input = 0; ++ ++ if (wacom_wac->pid == 0) { ++ printk(KERN_INFO "wacom: wireless tablet disconnected\n"); ++ } else { ++ const struct usb_device_id *id = wacom_ids; ++ ++ printk(KERN_INFO ++ "wacom: wireless tablet connected with PID %x\n", ++ wacom_wac->pid); ++ ++ while (id->match_flags) { ++ if (id->idVendor == USB_VENDOR_ID_WACOM && ++ id->idProduct == wacom_wac->pid) ++ break; ++ id++; ++ } ++ ++ if (!id->match_flags) { ++ printk(KERN_INFO ++ "wacom: ignorning unknown PID.\n"); ++ return; ++ } ++ ++ /* Stylus interface */ ++ wacom = usb_get_intfdata(usbdev->config->interface[1]); ++ wacom_wac = &wacom->wacom_wac; ++ wacom_wac->features = ++ *((struct wacom_features *)id->driver_info); ++ wacom_wac->features.device_type = BTN_TOOL_PEN; ++ wacom_register_input(wacom); ++ ++ /* Touch interface */ ++ wacom = usb_get_intfdata(usbdev->config->interface[2]); ++ wacom_wac = &wacom->wacom_wac; ++ wacom_wac->features = ++ *((struct wacom_features *)id->driver_info); ++ wacom_wac->features.pktlen = WACOM_PKGLEN_BBTOUCH3; ++ wacom_wac->features.device_type = BTN_TOOL_FINGER; ++ wacom_set_phy_from_res(&wacom_wac->features); ++ wacom_wac->features.x_max = wacom_wac->features.y_max = 4096; ++ wacom_register_input(wacom); ++ } ++} ++ + static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) + { + struct usb_device *dev = interface_to_usbdev(intf); +@@ -909,6 +980,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i + wacom->usbdev = dev; + wacom->intf = intf; + mutex_init(&wacom->lock); ++ INIT_WORK(&wacom->work, wacom_wireless_work); + usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); + strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); + +@@ -979,6 +1051,7 @@ static void wacom_disconnect(struct usb_interface *intf) + usb_set_intfdata(intf, NULL); + + usb_kill_urb(wacom->irq); ++ cancel_work_sync(&wacom->work); + if (wacom->wacom_wac.input) + input_unregister_device(wacom->wacom_wac.input); + wacom_destroy_leds(wacom); +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index 8b73b05f5aef..1013ac345781 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -1046,9 +1046,27 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) + + static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) + { +- if (len != WACOM_PKGLEN_WIRELESS) ++ unsigned char *data = wacom->data; ++ int connected; ++ ++ if (len != WACOM_PKGLEN_WIRELESS || data[0] != 0x80) + return 0; + ++ connected = data[1] & 0x01; ++ if (connected) { ++ int pid; ++ ++ pid = get_unaligned_be16(&data[6]); ++ if (wacom->pid != pid) { ++ wacom->pid = pid; ++ wacom_schedule_work(wacom); ++ } ++ } else if (wacom->pid != 0) { ++ /* disconnected while previously connected */ ++ wacom->pid = 0; ++ wacom_schedule_work(wacom); ++ } ++ + return 0; + } + +diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h +index 2c04b6248a56..cffaf6b7e6e9 100644 +--- a/drivers/input/tablet/wacom_wac.h ++++ b/drivers/input/tablet/wacom_wac.h +@@ -111,6 +111,7 @@ struct wacom_wac { + struct wacom_features features; + struct wacom_shared *shared; + struct input_dev *input; ++ int pid; + }; + + #endif +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0019-Input-wacom-wireless-battery-status.patch b/debian/patches/features/all/wacom/0019-Input-wacom-wireless-battery-status.patch new file mode 100644 index 000000000..ce1aa25d6 --- /dev/null +++ b/debian/patches/features/all/wacom/0019-Input-wacom-wireless-battery-status.patch @@ -0,0 +1,184 @@ +From: Chris Bagwell +Date: Sun, 25 Mar 2012 23:26:30 -0700 +Subject: Input: wacom - wireless battery status + +commit a1d552cc15b0be9124ccba593f99f59c4ec1e153 upstream. + +Signed-off-by: Chris Bagwell +Tested-by: Jason Gerecke +Acked-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/Kconfig | 1 + + drivers/input/tablet/wacom.h | 2 ++ + drivers/input/tablet/wacom_sys.c | 57 +++++++++++++++++++++++++++++++++++++- + drivers/input/tablet/wacom_wac.c | 5 +++- + drivers/input/tablet/wacom_wac.h | 1 + + 5 files changed, 64 insertions(+), 2 deletions(-) + +diff --git a/drivers/input/tablet/Kconfig b/drivers/input/tablet/Kconfig +index e53f4081a586..bed7cbf84cfd 100644 +--- a/drivers/input/tablet/Kconfig ++++ b/drivers/input/tablet/Kconfig +@@ -76,6 +76,7 @@ config TABLET_USB_KBTAB + config TABLET_USB_WACOM + tristate "Wacom Intuos/Graphire tablet support (USB)" + depends on USB_ARCH_HAS_HCD ++ select POWER_SUPPLY + select USB + select NEW_LEDS + select LEDS_CLASS +diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h +index febbfd9f3a84..b4842d0e61dd 100644 +--- a/drivers/input/tablet/wacom.h ++++ b/drivers/input/tablet/wacom.h +@@ -88,6 +88,7 @@ + #include + #include + #include ++#include + #include + + /* +@@ -121,6 +122,7 @@ struct wacom { + u8 hlv; /* status led brightness button pressed (1..127) */ + u8 img_lum; /* OLED matrix display brightness */ + } led; ++ struct power_supply battery; + }; + + static inline void wacom_schedule_work(struct wacom_wac *wacom_wac) +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index 1bcf555ff340..8a5fad186140 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -843,6 +843,55 @@ static void wacom_destroy_leds(struct wacom *wacom) + } + } + ++static enum power_supply_property wacom_battery_props[] = { ++ POWER_SUPPLY_PROP_CAPACITY ++}; ++ ++static int wacom_battery_get_property(struct power_supply *psy, ++ enum power_supply_property psp, ++ union power_supply_propval *val) ++{ ++ struct wacom *wacom = container_of(psy, struct wacom, battery); ++ int ret = 0; ++ ++ switch (psp) { ++ case POWER_SUPPLY_PROP_CAPACITY: ++ val->intval = ++ wacom->wacom_wac.battery_capacity * 100 / 31; ++ break; ++ default: ++ ret = -EINVAL; ++ break; ++ } ++ ++ return ret; ++} ++ ++static int wacom_initialize_battery(struct wacom *wacom) ++{ ++ int error = 0; ++ ++ if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR) { ++ wacom->battery.properties = wacom_battery_props; ++ wacom->battery.num_properties = ARRAY_SIZE(wacom_battery_props); ++ wacom->battery.get_property = wacom_battery_get_property; ++ wacom->battery.name = "wacom_battery"; ++ wacom->battery.type = POWER_SUPPLY_TYPE_BATTERY; ++ wacom->battery.use_for_apm = 0; ++ ++ error = power_supply_register(&wacom->usbdev->dev, ++ &wacom->battery); ++ } ++ ++ return error; ++} ++ ++static void wacom_destroy_battery(struct wacom *wacom) ++{ ++ if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR) ++ power_supply_unregister(&wacom->battery); ++} ++ + static int wacom_register_input(struct wacom *wacom) + { + struct input_dev *input_dev; +@@ -1018,10 +1067,14 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i + if (error) + goto fail4; + ++ error = wacom_initialize_battery(wacom); ++ if (error) ++ goto fail5; ++ + if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { + error = wacom_register_input(wacom); + if (error) +- goto fail5; ++ goto fail6; + } + + /* Note that if query fails it is not a hard failure */ +@@ -1036,6 +1089,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i + + return 0; + ++ fail6: wacom_destroy_battery(wacom); + fail5: wacom_destroy_leds(wacom); + fail4: wacom_remove_shared_data(wacom_wac); + fail3: usb_free_urb(wacom->irq); +@@ -1054,6 +1108,7 @@ static void wacom_disconnect(struct usb_interface *intf) + cancel_work_sync(&wacom->work); + if (wacom->wacom_wac.input) + input_unregister_device(wacom->wacom_wac.input); ++ wacom_destroy_battery(wacom); + wacom_destroy_leds(wacom); + usb_free_urb(wacom->irq); + usb_free_coherent(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index 1013ac345781..cecd35c8f0b3 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -1054,17 +1054,20 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) + + connected = data[1] & 0x01; + if (connected) { +- int pid; ++ int pid, battery; + + pid = get_unaligned_be16(&data[6]); ++ battery = data[5] & 0x3f; + if (wacom->pid != pid) { + wacom->pid = pid; + wacom_schedule_work(wacom); + } ++ wacom->battery_capacity = battery; + } else if (wacom->pid != 0) { + /* disconnected while previously connected */ + wacom->pid = 0; + wacom_schedule_work(wacom); ++ wacom->battery_capacity = 0; + } + + return 0; +diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h +index cffaf6b7e6e9..ba5a334e54d6 100644 +--- a/drivers/input/tablet/wacom_wac.h ++++ b/drivers/input/tablet/wacom_wac.h +@@ -112,6 +112,7 @@ struct wacom_wac { + struct wacom_shared *shared; + struct input_dev *input; + int pid; ++ int battery_capacity; + }; + + #endif +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0020-Input-wacom-add-basic-Intuos5-support.patch b/debian/patches/features/all/wacom/0020-Input-wacom-add-basic-Intuos5-support.patch new file mode 100644 index 000000000..a3cf8d477 --- /dev/null +++ b/debian/patches/features/all/wacom/0020-Input-wacom-add-basic-Intuos5-support.patch @@ -0,0 +1,139 @@ +From: Jason Gerecke +Date: Tue, 3 Apr 2012 15:47:22 -0700 +Subject: Input: wacom - add basic Intuos5 support + +commit 9fee619505bdb202c9f54b58ec996884160cdbf2 upstream. + +This patch adds support for the basic pen functions of Intuos5 +tablets. + +Signed-off-by: Jason Gerecke +Reviewed-by: Chris Bagwell +Reviewed-by: Ping Cheng +Tested-by: Timo Aaltonen +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_wac.c | 36 +++++++++++++++++++++++++++++++++--- + drivers/input/tablet/wacom_wac.h | 3 +++ + 2 files changed, 36 insertions(+), 3 deletions(-) + +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index cecd35c8f0b3..f159e9d90d4a 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -452,6 +452,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom) + if ((data[1] & 0xb8) == 0xa0) { + t = (data[6] << 2) | ((data[7] >> 6) & 3); + if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || ++ (features->type >= INTUOS5S && features->type <= INTUOS5L) || + features->type == WACOM_21UX2 || features->type == WACOM_24HD) { + t = (t << 1) | (data[1] & 1); + } +@@ -632,7 +633,9 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) + (features->type == INTUOS3 || + features->type == INTUOS3S || + features->type == INTUOS4 || +- features->type == INTUOS4S)) { ++ features->type == INTUOS4S || ++ features->type == INTUOS5 || ++ features->type == INTUOS5S)) { + + return 0; + } +@@ -685,7 +688,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) + + } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) { + /* I4 mouse */ +- if (features->type >= INTUOS4S && features->type <= INTUOS4L) { ++ if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || ++ (features->type >= INTUOS5S && features->type <= INTUOS5L)) { + input_report_key(input, BTN_LEFT, data[6] & 0x01); + input_report_key(input, BTN_MIDDLE, data[6] & 0x02); + input_report_key(input, BTN_RIGHT, data[6] & 0x04); +@@ -712,7 +716,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) + } + } + } else if ((features->type < INTUOS3S || features->type == INTUOS3L || +- features->type == INTUOS4L) && ++ features->type == INTUOS4L || features->type == INTUOS5L) && + wacom->tool[idx] == BTN_TOOL_LENS) { + /* Lens cursor packets */ + input_report_key(input, BTN_LEFT, data[8] & 0x01); +@@ -1107,6 +1111,9 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) + case INTUOS4S: + case INTUOS4: + case INTUOS4L: ++ case INTUOS5S: ++ case INTUOS5: ++ case INTUOS5L: + case CINTIQ: + case WACOM_BEE: + case WACOM_21UX2: +@@ -1355,12 +1362,15 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, + wacom_setup_intuos(wacom_wac); + break; + ++ case INTUOS5: ++ case INTUOS5L: + case INTUOS4: + case INTUOS4L: + __set_bit(BTN_7, input_dev->keybit); + __set_bit(BTN_8, input_dev->keybit); + /* fall through */ + ++ case INTUOS5S: + case INTUOS4S: + for (i = 0; i < 7; i++) + __set_bit(BTN_0 + i, input_dev->keybit); +@@ -1629,6 +1639,21 @@ static const struct wacom_features wacom_features_0xBB = + static const struct wacom_features wacom_features_0xBC = + { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, + 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; ++static const struct wacom_features wacom_features_0x26 = ++ { "Wacom Intuos5 touch S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, ++ 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; ++static const struct wacom_features wacom_features_0x27 = ++ { "Wacom Intuos5 touch M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, ++ 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; ++static const struct wacom_features wacom_features_0x28 = ++ { "Wacom Intuos5 touch L", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, ++ 63, INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; ++static const struct wacom_features wacom_features_0x29 = ++ { "Wacom Intuos5 S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, ++ 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; ++static const struct wacom_features wacom_features_0x2A = ++ { "Wacom Intuos5 M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, ++ 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; + static const struct wacom_features wacom_features_0xF4 = + { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, + 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; +@@ -1801,6 +1826,11 @@ const struct usb_device_id wacom_ids[] = { + { USB_DEVICE_WACOM(0xBA) }, + { USB_DEVICE_WACOM(0xBB) }, + { USB_DEVICE_WACOM(0xBC) }, ++ { USB_DEVICE_WACOM(0x26) }, ++ { USB_DEVICE_WACOM(0x27) }, ++ { USB_DEVICE_WACOM(0x28) }, ++ { USB_DEVICE_WACOM(0x29) }, ++ { USB_DEVICE_WACOM(0x2A) }, + { USB_DEVICE_WACOM(0x3F) }, + { USB_DEVICE_WACOM(0xC5) }, + { USB_DEVICE_WACOM(0xC6) }, +diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h +index ba5a334e54d6..0aa00ce5fd7d 100644 +--- a/drivers/input/tablet/wacom_wac.h ++++ b/drivers/input/tablet/wacom_wac.h +@@ -65,6 +65,9 @@ enum { + INTUOS4S, + INTUOS4, + INTUOS4L, ++ INTUOS5S, ++ INTUOS5, ++ INTUOS5L, + WACOM_24HD, + WACOM_21UX2, + CINTIQ, +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0021-Input-wacom-add-Intuos5-Touch-Ring-ExpressKey-suppor.patch b/debian/patches/features/all/wacom/0021-Input-wacom-add-Intuos5-Touch-Ring-ExpressKey-suppor.patch new file mode 100644 index 000000000..3e99cfecb --- /dev/null +++ b/debian/patches/features/all/wacom/0021-Input-wacom-add-Intuos5-Touch-Ring-ExpressKey-suppor.patch @@ -0,0 +1,93 @@ +From: Jason Gerecke +Date: Tue, 3 Apr 2012 15:48:35 -0700 +Subject: Input: wacom - add Intuos5 Touch Ring/ExpressKey support + +commit f860e581fd473250c6dcbd3e13d576b6197e4694 upstream. + +Intuos5 uses a new report type for Touch Ring and ExpressKey data. +Note that data from the capacitive sensors present on the ExpressKeys +will be ignored until a proper way is found to expose it. + +Signed-off-by: Jason Gerecke +Reviewed-by: Chris Bagwell +Reviewed-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_wac.c | 33 +++++++++++++++++++++++++++++++-- + drivers/input/tablet/wacom_wac.h | 1 + + 2 files changed, 32 insertions(+), 2 deletions(-) + +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index f159e9d90d4a..b5176a073c83 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -484,7 +484,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) + int idx = 0, result; + + if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_INTUOSREAD +- && data[0] != WACOM_REPORT_INTUOSWRITE && data[0] != WACOM_REPORT_INTUOSPAD) { ++ && data[0] != WACOM_REPORT_INTUOSWRITE && data[0] != WACOM_REPORT_INTUOSPAD ++ && data[0] != WACOM_REPORT_INTUOS5PAD) { + dbg("wacom_intuos_irq: received unknown report #%d", data[0]); + return 0; + } +@@ -494,7 +495,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) + idx = data[1] & 0x01; + + /* pad packets. Works as a second tool and is always in prox */ +- if (data[0] == WACOM_REPORT_INTUOSPAD) { ++ if (data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD) { + if (features->type >= INTUOS4S && features->type <= INTUOS4L) { + input_report_key(input, BTN_0, (data[2] & 0x01)); + input_report_key(input, BTN_1, (data[3] & 0x01)); +@@ -570,6 +571,34 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) + input_report_key(input, wacom->tool[1], 0); + input_report_abs(input, ABS_MISC, 0); + } ++ } else if (features->type >= INTUOS5S && features->type <= INTUOS5L) { ++ int i; ++ ++ /* Touch ring mode switch has no capacitive sensor */ ++ input_report_key(input, BTN_0, (data[3] & 0x01)); ++ ++ /* ++ * ExpressKeys on Intuos5 have a capacitive sensor in ++ * addition to the mechanical switch. Switch data is ++ * stored in data[4], capacitive data in data[5]. ++ */ ++ for (i = 0; i < 8; i++) ++ input_report_key(input, BTN_1 + i, data[4] & (1 << i)); ++ ++ if (data[2] & 0x80) { ++ input_report_abs(input, ABS_WHEEL, (data[2] & 0x7f)); ++ } else { ++ /* Out of proximity, clear wheel value. */ ++ input_report_abs(input, ABS_WHEEL, 0); ++ } ++ ++ if (data[2] | (data[3] & 0x01) | data[4]) { ++ input_report_key(input, wacom->tool[1], 1); ++ input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); ++ } else { ++ input_report_key(input, wacom->tool[1], 0); ++ input_report_abs(input, ABS_MISC, 0); ++ } + } else { + if (features->type == WACOM_21UX2) { + input_report_key(input, BTN_0, (data[5] & 0x01)); +diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h +index 0aa00ce5fd7d..17ba1868f0cd 100644 +--- a/drivers/input/tablet/wacom_wac.h ++++ b/drivers/input/tablet/wacom_wac.h +@@ -38,6 +38,7 @@ + #define WACOM_REPORT_INTUOSREAD 5 + #define WACOM_REPORT_INTUOSWRITE 6 + #define WACOM_REPORT_INTUOSPAD 12 ++#define WACOM_REPORT_INTUOS5PAD 3 + #define WACOM_REPORT_TPC1FG 6 + #define WACOM_REPORT_TPC2FG 13 + #define WACOM_REPORT_TPCHID 15 +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0022-Input-wacom-add-Intuos5-Touch-Ring-LED-support.patch b/debian/patches/features/all/wacom/0022-Input-wacom-add-Intuos5-Touch-Ring-LED-support.patch new file mode 100644 index 000000000..f0b87f864 --- /dev/null +++ b/debian/patches/features/all/wacom/0022-Input-wacom-add-Intuos5-Touch-Ring-LED-support.patch @@ -0,0 +1,163 @@ +From: Jason Gerecke +Date: Tue, 3 Apr 2012 15:50:37 -0700 +Subject: Input: wacom - add Intuos5 Touch Ring LED support + +commit 9b5b95dd516a13d53ecf9217672d2116f05097bc upstream. + +The Touch Ring LEDs on Intuos5 tablets use a different report +format which supports only 4 levels of brightness. We remap +the 7-bit value obtained from sysfs to an appropriate value +for the tablet. Control of the crop mark LEDs (new to the I5) +is left for a later patch. + +Signed-off-by: Jason Gerecke +Reviewed-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + Documentation/ABI/testing/sysfs-driver-wacom | 15 +++--- + drivers/input/tablet/wacom_sys.c | 67 ++++++++++++++++++++++---- + 2 files changed, 65 insertions(+), 17 deletions(-) + +diff --git a/Documentation/ABI/testing/sysfs-driver-wacom b/Documentation/ABI/testing/sysfs-driver-wacom +index 0130d6683c14..5e9cbdc7486e 100644 +--- a/Documentation/ABI/testing/sysfs-driver-wacom ++++ b/Documentation/ABI/testing/sysfs-driver-wacom +@@ -15,9 +15,10 @@ Contact: linux-input@vger.kernel.org + Description: + Attribute group for control of the status LEDs and the OLEDs. + This attribute group is only available for Intuos 4 M, L, +- and XL (with LEDs and OLEDs) and Cintiq 21UX2 and Cintiq 24HD +- (LEDs only). Therefore its presence implicitly signifies the +- presence of said LEDs and OLEDs on the tablet device. ++ and XL (with LEDs and OLEDs), Intuos 5 (LEDs only), and Cintiq ++ 21UX2 and Cintiq 24HD (LEDs only). Therefore its presence ++ implicitly signifies the presence of said LEDs and OLEDs on the ++ tablet device. + + What: /sys/bus/usb/devices/-:./wacom_led/status0_luminance + Date: August 2011 +@@ -40,10 +41,10 @@ What: /sys/bus/usb/devices/-:./wacom_led/status_led0 + Date: August 2011 + Contact: linux-input@vger.kernel.org + Description: +- Writing to this file sets which one of the four (for Intuos 4) +- or of the right four (for Cintiq 21UX2 and Cintiq 24HD) status +- LEDs is active (0..3). The other three LEDs on the same side are +- always inactive. ++ Writing to this file sets which one of the four (for Intuos 4 ++ and Intuos 5) or of the right four (for Cintiq 21UX2 and Cintiq ++ 24HD) status LEDs is active (0..3). The other three LEDs on the ++ same side are always inactive. + + What: /sys/bus/usb/devices/-:./wacom_led/status_led1_select + Date: September 2011 +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index 8a5fad186140..f470e41d23e7 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -574,23 +574,39 @@ static void wacom_remove_shared_data(struct wacom_wac *wacom) + static int wacom_led_control(struct wacom *wacom) + { + unsigned char *buf; +- int retval, led = 0; ++ int retval; + + buf = kzalloc(9, GFP_KERNEL); + if (!buf) + return -ENOMEM; + +- if (wacom->wacom_wac.features.type == WACOM_21UX2 || +- wacom->wacom_wac.features.type == WACOM_24HD) +- led = (wacom->led.select[1] << 4) | 0x40; ++ if (wacom->wacom_wac.features.type >= INTUOS5S && ++ wacom->wacom_wac.features.type <= INTUOS5L) { ++ /* ++ * Touch Ring and crop mark LED luminance may take on ++ * one of four values: ++ * 0 = Low; 1 = Medium; 2 = High; 3 = Off ++ */ ++ int ring_led = wacom->led.select[0] & 0x03; ++ int ring_lum = (((wacom->led.llv & 0x60) >> 5) - 1) & 0x03; ++ int crop_lum = 0; + +- led |= wacom->led.select[0] | 0x4; ++ buf[0] = WAC_CMD_LED_CONTROL; ++ buf[1] = (crop_lum << 4) | (ring_lum << 2) | (ring_led); ++ } ++ else { ++ int led = wacom->led.select[0] | 0x4; + +- buf[0] = WAC_CMD_LED_CONTROL; +- buf[1] = led; +- buf[2] = wacom->led.llv; +- buf[3] = wacom->led.hlv; +- buf[4] = wacom->led.img_lum; ++ if (wacom->wacom_wac.features.type == WACOM_21UX2 || ++ wacom->wacom_wac.features.type == WACOM_24HD) ++ led |= (wacom->led.select[1] << 4) | 0x40; ++ ++ buf[0] = WAC_CMD_LED_CONTROL; ++ buf[1] = led; ++ buf[2] = wacom->led.llv; ++ buf[3] = wacom->led.hlv; ++ buf[4] = wacom->led.img_lum; ++ } + + retval = wacom_set_report(wacom->intf, 0x03, WAC_CMD_LED_CONTROL, + buf, 9, WAC_CMD_RETRIES); +@@ -783,6 +799,17 @@ static struct attribute_group intuos4_led_attr_group = { + .attrs = intuos4_led_attrs, + }; + ++static struct attribute *intuos5_led_attrs[] = { ++ &dev_attr_status0_luminance.attr, ++ &dev_attr_status_led0_select.attr, ++ NULL ++}; ++ ++static struct attribute_group intuos5_led_attr_group = { ++ .name = "wacom_led", ++ .attrs = intuos5_led_attrs, ++}; ++ + static int wacom_initialize_leds(struct wacom *wacom) + { + int error; +@@ -812,6 +839,19 @@ static int wacom_initialize_leds(struct wacom *wacom) + &cintiq_led_attr_group); + break; + ++ case INTUOS5S: ++ case INTUOS5: ++ case INTUOS5L: ++ wacom->led.select[0] = 0; ++ wacom->led.select[1] = 0; ++ wacom->led.llv = 32; ++ wacom->led.hlv = 0; ++ wacom->led.img_lum = 0; ++ ++ error = sysfs_create_group(&wacom->intf->dev.kobj, ++ &intuos5_led_attr_group); ++ break; ++ + default: + return 0; + } +@@ -840,6 +880,13 @@ static void wacom_destroy_leds(struct wacom *wacom) + sysfs_remove_group(&wacom->intf->dev.kobj, + &cintiq_led_attr_group); + break; ++ ++ case INTUOS5S: ++ case INTUOS5: ++ case INTUOS5L: ++ sysfs_remove_group(&wacom->intf->dev.kobj, ++ &intuos5_led_attr_group); ++ break; + } + } + +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0023-Input-wacom-add-Intuos5-multitouch-sensor-support.patch b/debian/patches/features/all/wacom/0023-Input-wacom-add-Intuos5-multitouch-sensor-support.patch new file mode 100644 index 000000000..aa9987e23 --- /dev/null +++ b/debian/patches/features/all/wacom/0023-Input-wacom-add-Intuos5-multitouch-sensor-support.patch @@ -0,0 +1,183 @@ +From: Jason Gerecke +Date: Tue, 3 Apr 2012 15:50:40 -0700 +Subject: Input: wacom - add Intuos5 multitouch sensor support + +commit ae584ca473289377dd7fd8c61439db4bfab5489a upstream. + +Intuos5 tablets with PTH-* model numbers include a multitouch sensor +which use the same touch reports as the 3rd-generation Bamboo. No +useful information is in the HID descriptor for the touch interface +so hardcoded values are used during setup. + +Signed-off-by: Jason Gerecke +Reviewed-by: Chris Bagwell +Reviewed-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_sys.c | 25 +++++++++++++++ + drivers/input/tablet/wacom_wac.c | 64 +++++++++++++++++++++++++++++++++++--- + 2 files changed, 84 insertions(+), 5 deletions(-) + +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index f470e41d23e7..4d52e5924801 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -233,6 +233,9 @@ static int wacom_parse_logical_collection(unsigned char *report, + * 3rd gen Bamboo Touch no longer define a Digitizer-Finger Pysical + * Collection. Instead they define a Logical Collection with a single + * Logical Maximum for both X and Y. ++ * ++ * Intuos5 touch interface does not contain useful data. We deal with ++ * this after returning from this function. + */ + static int wacom_parse_hid(struct usb_interface *intf, + struct hid_descriptor *hid_desc, +@@ -1087,6 +1090,28 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i + if (error) + goto fail3; + ++ /* ++ * Intuos5 has no useful data about its touch interface in its ++ * HID descriptor. If this is the touch interface (wMaxPacketSize ++ * of WACOM_PKGLEN_BBTOUCH3), override the table values. ++ */ ++ if (features->type >= INTUOS5S && features->type <= INTUOS5L) { ++ if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) { ++ features->device_type = BTN_TOOL_FINGER; ++ features->pktlen = WACOM_PKGLEN_BBTOUCH3; ++ ++ features->x_phy = ++ (features->x_max * 100) / features->x_resolution; ++ features->y_phy = ++ (features->y_max * 100) / features->y_resolution; ++ ++ features->x_max = 4096; ++ features->y_max = 4096; ++ } else { ++ features->device_type = BTN_TOOL_PEN; ++ } ++ } ++ + wacom_setup_device_quirks(features); + + strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index b5176a073c83..d96e186f71dc 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -321,6 +321,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) + + /* Enter report */ + if ((data[1] & 0xfc) == 0xc0) { ++ if (features->type >= INTUOS5S && features->type <= INTUOS5L) ++ wacom->shared->stylus_in_proximity = true; ++ + /* serial number of the tool */ + wacom->serial[idx] = ((data[3] & 0x0f) << 28) + + (data[4] << 20) + (data[5] << 12) + +@@ -406,6 +409,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) + + /* Exit report */ + if ((data[1] & 0xfe) == 0x80) { ++ if (features->type >= INTUOS5S && features->type <= INTUOS5L) ++ wacom->shared->stylus_in_proximity = false; ++ + /* + * Reset all states otherwise we lose the initial states + * when in-prox next time +@@ -1140,9 +1146,6 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) + case INTUOS4S: + case INTUOS4: + case INTUOS4L: +- case INTUOS5S: +- case INTUOS5: +- case INTUOS5L: + case CINTIQ: + case WACOM_BEE: + case WACOM_21UX2: +@@ -1150,6 +1153,15 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) + sync = wacom_intuos_irq(wacom_wac); + break; + ++ case INTUOS5S: ++ case INTUOS5: ++ case INTUOS5L: ++ if (len == WACOM_PKGLEN_BBTOUCH3) ++ sync = wacom_bpt3_touch(wacom_wac); ++ else ++ sync = wacom_intuos_irq(wacom_wac); ++ break; ++ + case TABLETPC: + case TABLETPC2FG: + sync = wacom_tpc_irq(wacom_wac, len); +@@ -1224,7 +1236,8 @@ void wacom_setup_device_quirks(struct wacom_features *features) + + /* these device have multiple inputs */ + if (features->type == TABLETPC || features->type == TABLETPC2FG || +- features->type == BAMBOO_PT || features->type == WIRELESS) ++ features->type == BAMBOO_PT || features->type == WIRELESS || ++ (features->type >= INTUOS5S && features->type <= INTUOS5L)) + features->quirks |= WACOM_QUIRK_MULTI_INPUT; + + /* quirk for bamboo touch with 2 low res touches */ +@@ -1393,13 +1406,54 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, + + case INTUOS5: + case INTUOS5L: ++ if (features->device_type == BTN_TOOL_PEN) { ++ __set_bit(BTN_7, input_dev->keybit); ++ __set_bit(BTN_8, input_dev->keybit); ++ } ++ /* fall through */ ++ ++ case INTUOS5S: ++ __set_bit(INPUT_PROP_POINTER, input_dev->propbit); ++ ++ if (features->device_type == BTN_TOOL_PEN) { ++ for (i = 0; i < 7; i++) ++ __set_bit(BTN_0 + i, input_dev->keybit); ++ ++ input_set_abs_params(input_dev, ABS_DISTANCE, 0, ++ features->distance_max, ++ 0, 0); ++ ++ input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); ++ ++ wacom_setup_intuos(wacom_wac); ++ } else if (features->device_type == BTN_TOOL_FINGER) { ++ __clear_bit(ABS_MISC, input_dev->absbit); ++ ++ __set_bit(BTN_TOOL_FINGER, input_dev->keybit); ++ __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); ++ __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); ++ __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit); ++ ++ input_mt_init_slots(input_dev, 16); ++ ++ input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, ++ 0, 255, 0, 0); ++ ++ input_set_abs_params(input_dev, ABS_MT_POSITION_X, ++ 0, features->x_max, ++ features->x_fuzz, 0); ++ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, ++ 0, features->y_max, ++ features->y_fuzz, 0); ++ } ++ break; ++ + case INTUOS4: + case INTUOS4L: + __set_bit(BTN_7, input_dev->keybit); + __set_bit(BTN_8, input_dev->keybit); + /* fall through */ + +- case INTUOS5S: + case INTUOS4S: + for (i = 0; i < 7; i++) + __set_bit(BTN_0 + i, input_dev->keybit); +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0024-Input-wacom-retrieve-maximum-number-of-touch-points.patch b/debian/patches/features/all/wacom/0024-Input-wacom-retrieve-maximum-number-of-touch-points.patch new file mode 100644 index 000000000..b2d34eba5 --- /dev/null +++ b/debian/patches/features/all/wacom/0024-Input-wacom-retrieve-maximum-number-of-touch-points.patch @@ -0,0 +1,249 @@ +From: Ping Cheng +Date: Sun, 29 Apr 2012 21:09:17 -0700 +Subject: Input: wacom - retrieve maximum number of touch points + +commit f393ee2b814e3291c12565000210b3cf10aa5c1d upstream. + +>From the HID usage table when it is supported. + +Tested-by: Jason Gerecke +Signed-off-by: Chris Bagwell +Signed-off-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom_sys.c | 29 ++++++++++++++++++- + drivers/input/tablet/wacom_wac.c | 59 +++++++++++++++++++++++--------------- + drivers/input/tablet/wacom_wac.h | 1 + + 3 files changed, 65 insertions(+), 24 deletions(-) + +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index 4d52e5924801..53598c2065cf 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -28,6 +28,7 @@ + #define HID_USAGE_Y_TILT 0x3e + #define HID_USAGE_FINGER 0x22 + #define HID_USAGE_STYLUS 0x20 ++#define HID_USAGE_CONTACTMAX 0x55 + #define HID_COLLECTION 0xa1 + #define HID_COLLECTION_LOGICAL 0x02 + #define HID_COLLECTION_END 0xc0 +@@ -201,6 +202,27 @@ static int wacom_parse_logical_collection(unsigned char *report, + return length; + } + ++static void wacom_retrieve_report_data(struct usb_interface *intf, ++ struct wacom_features *features) ++{ ++ int result = 0; ++ unsigned char *rep_data; ++ ++ rep_data = kmalloc(2, GFP_KERNEL); ++ if (rep_data) { ++ ++ rep_data[0] = 12; ++ result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT, ++ rep_data[0], &rep_data, 2, ++ WAC_MSG_RETRIES); ++ ++ if (result >= 0 && rep_data[1] > 2) ++ features->touch_max = rep_data[1]; ++ ++ kfree(rep_data); ++ } ++} ++ + /* + * Interface Descriptor of wacom devices can be incomplete and + * inconsistent so wacom_features table is used to store stylus +@@ -377,6 +399,11 @@ static int wacom_parse_hid(struct usb_interface *intf, + pen = 1; + i++; + break; ++ ++ case HID_USAGE_CONTACTMAX: ++ wacom_retrieve_report_data(intf, features); ++ i++; ++ break; + } + break; + +@@ -1085,7 +1112,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i + + endpoint = &intf->cur_altsetting->endpoint[0].desc; + +- /* Retrieve the physical and logical size for OEM devices */ ++ /* Retrieve the physical and logical size for touch devices */ + error = wacom_retrieve_hid_descriptor(intf, features); + if (error) + goto fail3; +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index d96e186f71dc..e5cd0e57d178 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -1434,7 +1434,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, + __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); + __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit); + +- input_mt_init_slots(input_dev, 16); ++ input_mt_init_slots(input_dev, features->touch_max); + + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, + 0, 255, 0, 0); +@@ -1467,7 +1467,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, + case TABLETPC2FG: + if (features->device_type == BTN_TOOL_FINGER) { + +- input_mt_init_slots(input_dev, 2); ++ input_mt_init_slots(input_dev, features->touch_max); + input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, + 0, MT_TOOL_MAX, 0, 0); + input_set_abs_params(input_dev, ABS_MT_POSITION_X, +@@ -1522,6 +1522,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, + + __set_bit(BTN_TOOL_FINGER, input_dev->keybit); + __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); ++ input_mt_init_slots(input_dev, features->touch_max); + + if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { + __set_bit(BTN_TOOL_TRIPLETAP, +@@ -1529,13 +1530,9 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, + __set_bit(BTN_TOOL_QUADTAP, + input_dev->keybit); + +- input_mt_init_slots(input_dev, 16); +- + input_set_abs_params(input_dev, + ABS_MT_TOUCH_MAJOR, + 0, 255, 0, 0); +- } else { +- input_mt_init_slots(input_dev, 2); + } + + input_set_abs_params(input_dev, ABS_MT_POSITION_X, +@@ -1724,13 +1721,16 @@ static const struct wacom_features wacom_features_0xBC = + 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; + static const struct wacom_features wacom_features_0x26 = + { "Wacom Intuos5 touch S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, +- 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; ++ 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, ++ .touch_max = 16 }; + static const struct wacom_features wacom_features_0x27 = + { "Wacom Intuos5 touch M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, +- 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; ++ 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, ++ .touch_max = 16 }; + static const struct wacom_features wacom_features_0x28 = + { "Wacom Intuos5 touch L", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, +- 63, INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; ++ 63, INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, ++ .touch_max = 16 }; + static const struct wacom_features wacom_features_0x29 = + { "Wacom Intuos5 S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, + 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; +@@ -1778,13 +1778,16 @@ static const struct wacom_features wacom_features_0x9F = + 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + static const struct wacom_features wacom_features_0xE2 = + { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, +- 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 2 }; + static const struct wacom_features wacom_features_0xE3 = + { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, +- 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 2 }; + static const struct wacom_features wacom_features_0xE6 = + { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255, +- 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 2 }; + static const struct wacom_features wacom_features_0xEC = + { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255, + 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; +@@ -1793,19 +1796,22 @@ static const struct wacom_features wacom_features_0x47 = + 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + static const struct wacom_features wacom_features_0x84 = + { "Wacom Wireless Receiver", WACOM_PKGLEN_WIRELESS, 0, 0, 0, +- 0, WIRELESS, 0, 0 }; ++ 0, WIRELESS, 0, 0, .touch_max = 16 }; + static const struct wacom_features wacom_features_0xD0 = + { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, +- 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 2 }; + static const struct wacom_features wacom_features_0xD1 = + { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, +- 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 2 }; + static const struct wacom_features wacom_features_0xD2 = + { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + static const struct wacom_features wacom_features_0xD3 = + { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, +- 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 2 }; + static const struct wacom_features wacom_features_0xD4 = + { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; +@@ -1814,28 +1820,35 @@ static const struct wacom_features wacom_features_0xD5 = + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + static const struct wacom_features wacom_features_0xD6 = + { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, +- 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 2 }; + static const struct wacom_features wacom_features_0xD7 = + { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, +- 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 2 }; + static const struct wacom_features wacom_features_0xD8 = + { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, +- 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 2 }; + static const struct wacom_features wacom_features_0xDA = + { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, +- 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 2 }; + static struct wacom_features wacom_features_0xDB = + { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, +- 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 2 }; + static const struct wacom_features wacom_features_0xDD = + { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + static const struct wacom_features wacom_features_0xDE = + { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, +- 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 16 }; + static const struct wacom_features wacom_features_0xDF = + { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023, +- 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; ++ 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, ++ .touch_max = 16 }; + static const struct wacom_features wacom_features_0x6004 = + { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, + 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; +diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h +index 17ba1868f0cd..321269c1ac4c 100644 +--- a/drivers/input/tablet/wacom_wac.h ++++ b/drivers/input/tablet/wacom_wac.h +@@ -99,6 +99,7 @@ struct wacom_features { + int pressure_fuzz; + int distance_fuzz; + unsigned quirks; ++ unsigned touch_max; + }; + + struct wacom_shared { +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0025-Input-wacom-add-0xE5-MT-device-support.patch b/debian/patches/features/all/wacom/0025-Input-wacom-add-0xE5-MT-device-support.patch new file mode 100644 index 000000000..46219465f --- /dev/null +++ b/debian/patches/features/all/wacom/0025-Input-wacom-add-0xE5-MT-device-support.patch @@ -0,0 +1,430 @@ +From: Ping Cheng +Date: Sun, 29 Apr 2012 21:09:18 -0700 +Subject: Input: wacom - add 0xE5 (MT device) support + +commit 1963518b9b1b8019d33b4b08deee6f873ffa2730 upstream. + +Main part of patch is adding support for a new Wacom MT touch +packet and labels these devices using MTSCREEN type. + +Other items of interest: + +Delete some duplicate code in HID parsing for Y info since +its already done in X path. + +In wacom_query_tablet_data(), only invoke the set report +that requests tablets to send Wacom Touch packets for +Finger interfaces. Mostly, this is to make code intent clear. + +Tested-by: Jason Gerecke +Signed-off-by: Chris Bagwell +Signed-off-by: Ping Cheng +Signed-off-by: Dmitry Torokhov +Signed-off-by: Jonathan Nieder +--- + drivers/input/tablet/wacom.h | 4 +- + drivers/input/tablet/wacom_sys.c | 91 ++++++++++++++++++++--------------- + drivers/input/tablet/wacom_wac.c | 99 ++++++++++++++++++++++++++++++++++++-- + drivers/input/tablet/wacom_wac.h | 8 +++ + 4 files changed, 157 insertions(+), 45 deletions(-) + +diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h +index b4842d0e61dd..b79d45198d82 100644 +--- a/drivers/input/tablet/wacom.h ++++ b/drivers/input/tablet/wacom.h +@@ -135,6 +135,6 @@ extern const struct usb_device_id wacom_ids[]; + + void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len); + void wacom_setup_device_quirks(struct wacom_features *features); +-void wacom_setup_input_capabilities(struct input_dev *input_dev, +- struct wacom_wac *wacom_wac); ++int wacom_setup_input_capabilities(struct input_dev *input_dev, ++ struct wacom_wac *wacom_wac); + #endif +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index 53598c2065cf..734671aeb572 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -317,6 +317,10 @@ static int wacom_parse_hid(struct usb_interface *intf, + /* need to reset back */ + features->pktlen = WACOM_PKGLEN_TPC2FG; + } ++ ++ if (features->type == MTSCREEN) ++ features->pktlen = WACOM_PKGLEN_MTOUCH; ++ + if (features->type == BAMBOO_PT) { + /* need to reset back */ + features->pktlen = WACOM_PKGLEN_BBTOUCH; +@@ -349,18 +353,15 @@ static int wacom_parse_hid(struct usb_interface *intf, + case HID_USAGE_Y: + if (usage == WCM_DESKTOP) { + if (finger) { +- features->device_type = BTN_TOOL_FINGER; +- if (features->type == TABLETPC2FG) { +- /* need to reset back */ +- features->pktlen = WACOM_PKGLEN_TPC2FG; ++ int type = features->type; ++ ++ if (type == TABLETPC2FG || type == MTSCREEN) { + features->y_max = + get_unaligned_le16(&report[i + 3]); + features->y_phy = + get_unaligned_le16(&report[i + 6]); + i += 7; +- } else if (features->type == BAMBOO_PT) { +- /* need to reset back */ +- features->pktlen = WACOM_PKGLEN_BBTOUCH; ++ } else if (type == BAMBOO_PT) { + features->y_phy = + get_unaligned_le16(&report[i + 3]); + features->y_max = +@@ -374,10 +375,6 @@ static int wacom_parse_hid(struct usb_interface *intf, + i += 4; + } + } else if (pen) { +- /* penabled only accepts exact bytes of data */ +- if (features->type == TABLETPC2FG) +- features->pktlen = WACOM_PKGLEN_GRAPHIRE; +- features->device_type = BTN_TOOL_PEN; + features->y_max = + get_unaligned_le16(&report[i + 3]); + i += 4; +@@ -440,22 +437,29 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat + if (!rep_data) + return error; + +- /* ask to report tablet data if it is MT Tablet PC or +- * not a Tablet PC */ +- if (features->type == TABLETPC2FG) { +- do { +- rep_data[0] = 3; +- rep_data[1] = 4; +- rep_data[2] = 0; +- rep_data[3] = 0; +- report_id = 3; +- error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT, +- report_id, rep_data, 4, 1); +- if (error >= 0) +- error = wacom_get_report(intf, +- WAC_HID_FEATURE_REPORT, +- report_id, rep_data, 4, 1); +- } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); ++ /* ask to report Wacom data */ ++ if (features->device_type == BTN_TOOL_FINGER) { ++ /* if it is an MT Tablet PC touch */ ++ if (features->type == TABLETPC2FG || ++ features->type == MTSCREEN) { ++ do { ++ rep_data[0] = 3; ++ rep_data[1] = 4; ++ rep_data[2] = 0; ++ rep_data[3] = 0; ++ report_id = 3; ++ error = wacom_set_report(intf, ++ WAC_HID_FEATURE_REPORT, ++ report_id, ++ rep_data, 4, 1); ++ if (error >= 0) ++ error = wacom_get_report(intf, ++ WAC_HID_FEATURE_REPORT, ++ report_id, ++ rep_data, 4, 1); ++ } while ((error < 0 || rep_data[1] != 4) && ++ limit++ < WAC_MSG_RETRIES); ++ } + } else if (features->type != TABLETPC && + features->type != WIRELESS && + features->device_type == BTN_TOOL_PEN) { +@@ -477,7 +481,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat + } + + static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, +- struct wacom_features *features) ++ struct wacom_features *features) + { + int error = 0; + struct usb_host_interface *interface = intf->cur_altsetting; +@@ -505,10 +509,13 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, + } + } + +- /* only Tablet PCs and Bamboo P&T need to retrieve the info */ +- if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) && +- (features->type != BAMBOO_PT)) ++ /* only devices that support touch need to retrieve the info */ ++ if (features->type != TABLETPC && ++ features->type != TABLETPC2FG && ++ features->type != BAMBOO_PT && ++ features->type != MTSCREEN) { + goto out; ++ } + + if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) { + if (usb_get_extra_descriptor(&interface->endpoint[0], +@@ -978,8 +985,10 @@ static int wacom_register_input(struct wacom *wacom) + int error; + + input_dev = input_allocate_device(); +- if (!input_dev) +- return -ENOMEM; ++ if (!input_dev) { ++ error = -ENOMEM; ++ goto fail1; ++ } + + input_dev->name = wacom_wac->name; + input_dev->dev.parent = &intf->dev; +@@ -989,14 +998,20 @@ static int wacom_register_input(struct wacom *wacom) + input_set_drvdata(input_dev, wacom); + + wacom_wac->input = input_dev; +- wacom_setup_input_capabilities(input_dev, wacom_wac); ++ error = wacom_setup_input_capabilities(input_dev, wacom_wac); ++ if (error) ++ goto fail1; + + error = input_register_device(input_dev); +- if (error) { +- input_free_device(input_dev); +- wacom_wac->input = NULL; +- } ++ if (error) ++ goto fail2; + ++ return 0; ++ ++fail2: ++ input_free_device(input_dev); ++ wacom_wac->input = NULL; ++fail1: + return error; + } + +diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c +index e5cd0e57d178..10e5cf870359 100644 +--- a/drivers/input/tablet/wacom_wac.c ++++ b/drivers/input/tablet/wacom_wac.c +@@ -768,6 +768,72 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) + return 1; + } + ++static int find_slot_from_contactid(struct wacom_wac *wacom, int contactid) ++{ ++ int touch_max = wacom->features.touch_max; ++ int i; ++ ++ if (!wacom->slots) ++ return -1; ++ ++ for (i = 0; i < touch_max; ++i) { ++ if (wacom->slots[i] == contactid) ++ return i; ++ } ++ for (i = 0; i < touch_max; ++i) { ++ if (wacom->slots[i] == -1) ++ return i; ++ } ++ return -1; ++} ++ ++static int wacom_mt_touch(struct wacom_wac *wacom) ++{ ++ struct input_dev *input = wacom->input; ++ char *data = wacom->data; ++ int i; ++ int current_num_contacts = data[2]; ++ int contacts_to_send = 0; ++ ++ /* ++ * First packet resets the counter since only the first ++ * packet in series will have non-zero current_num_contacts. ++ */ ++ if (current_num_contacts) ++ wacom->num_contacts_left = current_num_contacts; ++ ++ /* There are at most 5 contacts per packet */ ++ contacts_to_send = min(5, wacom->num_contacts_left); ++ ++ for (i = 0; i < contacts_to_send; i++) { ++ int offset = (WACOM_BYTES_PER_MT_PACKET * i) + 3; ++ bool touch = data[offset] & 0x1; ++ int id = le16_to_cpup((__le16 *)&data[offset + 1]); ++ int slot = find_slot_from_contactid(wacom, id); ++ ++ if (slot < 0) ++ continue; ++ ++ input_mt_slot(input, slot); ++ input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); ++ if (touch) { ++ int x = le16_to_cpup((__le16 *)&data[offset + 7]); ++ int y = le16_to_cpup((__le16 *)&data[offset + 9]); ++ input_report_abs(input, ABS_MT_POSITION_X, x); ++ input_report_abs(input, ABS_MT_POSITION_Y, y); ++ } ++ wacom->slots[slot] = touch ? id : -1; ++ } ++ ++ input_mt_report_pointer_emulation(input, true); ++ ++ wacom->num_contacts_left -= contacts_to_send; ++ if (wacom->num_contacts_left < 0) ++ wacom->num_contacts_left = 0; ++ ++ return 1; ++} ++ + static int wacom_tpc_mt_touch(struct wacom_wac *wacom) + { + struct input_dev *input = wacom->input; +@@ -806,6 +872,9 @@ static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len) + bool prox; + int x = 0, y = 0; + ++ if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) ++ return 0; ++ + if (!wacom->shared->stylus_in_proximity) { + if (len == WACOM_PKGLEN_TPC1FG) { + prox = data[0] & 0x01; +@@ -873,10 +942,10 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) + + switch (len) { + case WACOM_PKGLEN_TPC1FG: +- return wacom_tpc_single_touch(wacom, len); ++ return wacom_tpc_single_touch(wacom, len); + + case WACOM_PKGLEN_TPC2FG: +- return wacom_tpc_mt_touch(wacom); ++ return wacom_tpc_mt_touch(wacom); + + default: + switch (data[0]) { +@@ -885,6 +954,9 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) + case WACOM_REPORT_TPCST: + return wacom_tpc_single_touch(wacom, len); + ++ case WACOM_REPORT_TPCMT: ++ return wacom_mt_touch(wacom); ++ + case WACOM_REPORT_PENABLED: + return wacom_tpc_pen(wacom); + } +@@ -1164,6 +1236,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) + + case TABLETPC: + case TABLETPC2FG: ++ case MTSCREEN: + sync = wacom_tpc_irq(wacom_wac, len); + break; + +@@ -1237,7 +1310,8 @@ void wacom_setup_device_quirks(struct wacom_features *features) + /* these device have multiple inputs */ + if (features->type == TABLETPC || features->type == TABLETPC2FG || + features->type == BAMBOO_PT || features->type == WIRELESS || +- (features->type >= INTUOS5S && features->type <= INTUOS5L)) ++ (features->type >= INTUOS5S && features->type <= INTUOS5L) || ++ features->type == MTSCREEN) + features->quirks |= WACOM_QUIRK_MULTI_INPUT; + + /* quirk for bamboo touch with 2 low res touches */ +@@ -1268,8 +1342,8 @@ static unsigned int wacom_calculate_touch_res(unsigned int logical_max, + return (logical_max * 100) / physical_max; + } + +-void wacom_setup_input_capabilities(struct input_dev *input_dev, +- struct wacom_wac *wacom_wac) ++int wacom_setup_input_capabilities(struct input_dev *input_dev, ++ struct wacom_wac *wacom_wac) + { + struct wacom_features *features = &wacom_wac->features; + int i; +@@ -1465,8 +1539,18 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, + break; + + case TABLETPC2FG: ++ case MTSCREEN: + if (features->device_type == BTN_TOOL_FINGER) { + ++ wacom_wac->slots = kmalloc(features->touch_max * ++ sizeof(int), ++ GFP_KERNEL); ++ if (!wacom_wac->slots) ++ return -ENOMEM; ++ ++ for (i = 0; i < features->touch_max; i++) ++ wacom_wac->slots[i] = -1; ++ + input_mt_init_slots(input_dev, features->touch_max); + input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, + 0, MT_TOOL_MAX, 0, 0); +@@ -1552,6 +1636,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, + } + break; + } ++ return 0; + } + + static const struct wacom_features wacom_features_0x00 = +@@ -1784,6 +1869,9 @@ static const struct wacom_features wacom_features_0xE3 = + { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, + 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, + .touch_max = 2 }; ++static const struct wacom_features wacom_features_0xE5 = ++ { "Wacom ISDv4 E5", WACOM_PKGLEN_MTOUCH, 26202, 16325, 255, ++ 0, MTSCREEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + static const struct wacom_features wacom_features_0xE6 = + { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255, + 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, +@@ -1962,6 +2050,7 @@ const struct usb_device_id wacom_ids[] = { + { USB_DEVICE_WACOM(0x9F) }, + { USB_DEVICE_WACOM(0xE2) }, + { USB_DEVICE_WACOM(0xE3) }, ++ { USB_DEVICE_WACOM(0xE5) }, + { USB_DEVICE_WACOM(0xE6) }, + { USB_DEVICE_WACOM(0xEC) }, + { USB_DEVICE_WACOM(0x47) }, +diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h +index 321269c1ac4c..78fbd3f42009 100644 +--- a/drivers/input/tablet/wacom_wac.h ++++ b/drivers/input/tablet/wacom_wac.h +@@ -25,6 +25,10 @@ + #define WACOM_PKGLEN_BBTOUCH3 64 + #define WACOM_PKGLEN_BBPEN 10 + #define WACOM_PKGLEN_WIRELESS 32 ++#define WACOM_PKGLEN_MTOUCH 62 ++ ++/* wacom data size per MT contact */ ++#define WACOM_BYTES_PER_MT_PACKET 11 + + /* device IDs */ + #define STYLUS_DEVICE_ID 0x02 +@@ -41,6 +45,7 @@ + #define WACOM_REPORT_INTUOS5PAD 3 + #define WACOM_REPORT_TPC1FG 6 + #define WACOM_REPORT_TPC2FG 13 ++#define WACOM_REPORT_TPCMT 13 + #define WACOM_REPORT_TPCHID 15 + #define WACOM_REPORT_TPCST 16 + +@@ -76,6 +81,7 @@ enum { + WACOM_MO, + TABLETPC, + TABLETPC2FG, ++ MTSCREEN, + MAX_TYPE + }; + +@@ -118,6 +124,8 @@ struct wacom_wac { + struct input_dev *input; + int pid; + int battery_capacity; ++ int num_contacts_left; ++ int *slots; + }; + + #endif +-- +1.7.10.1 + diff --git a/debian/patches/features/all/wacom/0026-Input-wacom-return-proper-error-if-usb_get_extra_des.patch b/debian/patches/features/all/wacom/0026-Input-wacom-return-proper-error-if-usb_get_extra_des.patch new file mode 100644 index 000000000..8b714a64f --- /dev/null +++ b/debian/patches/features/all/wacom/0026-Input-wacom-return-proper-error-if-usb_get_extra_des.patch @@ -0,0 +1,41 @@ +From: Dmitry Torokhov +Date: Wed, 2 May 2012 00:13:38 -0700 +Subject: [PATCH 26/26] Input: wacom - return proper error if + usb_get_extra_descriptor() fails + +commit a882c932a628cbab17752fc8b1c94692f95bbf9a upstream. + +Instead of returning 1 (which is not even negative) let's capture and return +error codde returned by usb_get_extra_descriptor(). + +Reviewed-by: Chris Bagwell +Signed-off-by: Dmitry Torokhov +--- + drivers/input/tablet/wacom_sys.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c +index 364f2c343..8f3b30b 100644 +--- a/drivers/input/tablet/wacom_sys.c ++++ b/drivers/input/tablet/wacom_sys.c +@@ -517,11 +517,12 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, + goto out; + } + +- if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) { +- if (usb_get_extra_descriptor(&interface->endpoint[0], +- HID_DEVICET_REPORT, &hid_desc)) { +- printk("wacom: can not retrieve extra class descriptor\n"); +- error = 1; ++ error = usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc); ++ if (error) { ++ error = usb_get_extra_descriptor(&interface->endpoint[0], ++ HID_DEVICET_REPORT, &hid_desc); ++ if (error) { ++ printk(KERN_ERR "wacom: can not retrieve extra class descriptor\n"); + goto out; + } + } +-- +1.7.10 + diff --git a/debian/patches/series/base b/debian/patches/series/base index b9ac37b4f..1576c6b6f 100644 --- a/debian/patches/series/base +++ b/debian/patches/series/base @@ -199,3 +199,31 @@ + bugfix/all/sky2-fix-receive-length-error-in-mixed-non-vlan-vlan.patch + bugfix/all/kvm-ensure-all-vcpus-are-consistent-with-in-kernel-irqchip.patch + bugfix/all/kvm-lock-slots_lock-around-device-assignment.patch + +# Update wacom driver to 3.5ish ++ features/all/wacom/0001-Input-wacom-cleanup-feature-report-for-bamboos.patch ++ features/all/wacom/0002-Input-wacom-remove-unused-bamboo-HID-parsing.patch ++ features/all/wacom/0003-Input-wacom-add-some-comments-to-wacom_parse_hid.patch ++ features/all/wacom/0004-Input-wacom-relax-Bamboo-stylus-ID-check.patch ++ features/all/wacom/0005-Input-wacom-read-3rd-gen-Bamboo-Touch-HID-data.patch ++ features/all/wacom/0006-Input-wacom-3rd-gen-Bamboo-P-Touch-packet-support.patch ++ features/all/wacom/0007-Input-wacom-ignore-unwanted-bamboo-packets.patch ++ features/all/wacom/0008-Input-wacom-add-support-for-Cintiq-24HD.patch ++ features/all/wacom/0009-Input-wacom-add-LED-support-for-Cintiq-24HD.patch ++ features/all/wacom/0010-Input-wacom-use-BTN_TOOL_FINGER-to-indicate-touch-de.patch ++ features/all/wacom/0011-Input-wacom-use-switch-statement-for-wacom_tpc_irq.patch ++ features/all/wacom/0012-Input-wacom-add-missing-LEDS_CLASS-to-Kconfig.patch ++ features/all/wacom/0013-Input-wacom-fix-3rd-gen-Bamboo-MT-when-4-fingers-are.patch ++ features/all/wacom/0014-Input-wacom-fix-physical-size-calculation-for-3rd-ge.patch ++ features/all/wacom/0015-Input-wacom-isolate-input-registration.patch ++ features/all/wacom/0016-Input-wacom-check-for-allocation-failure-in-probe.patch ++ features/all/wacom/0017-Input-wacom-wireless-monitor-framework.patch ++ features/all/wacom/0018-Input-wacom-create-inputs-when-wireless-connect.patch ++ features/all/wacom/0019-Input-wacom-wireless-battery-status.patch ++ features/all/wacom/0020-Input-wacom-add-basic-Intuos5-support.patch ++ features/all/wacom/0021-Input-wacom-add-Intuos5-Touch-Ring-ExpressKey-suppor.patch ++ features/all/wacom/0022-Input-wacom-add-Intuos5-Touch-Ring-LED-support.patch ++ features/all/wacom/0023-Input-wacom-add-Intuos5-multitouch-sensor-support.patch ++ features/all/wacom/0024-Input-wacom-retrieve-maximum-number-of-touch-points.patch ++ features/all/wacom/0025-Input-wacom-add-0xE5-MT-device-support.patch ++ features/all/wacom/0026-Input-wacom-return-proper-error-if-usb_get_extra_des.patch