Skip to contentSkip to conversation

Input: wacom - add support for three new Intuos devices

PATCH Superseded Ping Cheng 3 participants 3 messages Oct 3, 2013 – Oct 4, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ping Cheng

author
#0 lore raw

PATCH 2/2 Input: wacom - add support for three new Intuos devices

This series of models added a hardware switch to turn touch data on/off. To report the state of the switch, SW_TOUCH_ENABLED is added in include/uapi/linux/input.h.

The driver is also updated to process wireless devices that do not support touch interface.

---
 drivers/input/tablet/wacom_sys.c | 26 +++++++++++-
 drivers/input/tablet/wacom_wac.c | 86 ++++++++++++++++++++++++++++++++--------
 drivers/input/tablet/wacom_wac.h |  7 ++++
 include/uapi/linux/input.h       |  1 +
 4 files changed, 102 insertions(+), 18 deletions(-)
drivers/input/tablet/wacom_sys.c +24 -2
index 7bdb5e9..3a74fa4 100644
@@ -1190,12 +1190,15 @@ static void wacom_wireless_work(struct work_struct *work)
 		wacom_wac1->features.device_type = BTN_TOOL_PEN;
 		snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
 			 wacom_wac1->features.name);
+		wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max;
+		wacom_wac1->shared->type = wacom_wac1->features.type;
 		error = wacom_register_input(wacom1);
 		if (error)
 			goto fail;
 
 		/* Touch interface */
-		if (wacom_wac1->features.touch_max) {
+		if (wacom_wac1->features.touch_max ||
+		    wacom_wac1->features.type == INTUOS_HT) {
 			wacom_wac2->features =
 				*((struct wacom_features *)id->driver_info);
 			wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
@@ -1210,11 +1213,25 @@ static void wacom_wireless_work(struct work_struct *work)
 			error = wacom_register_input(wacom2);
 			if (error)
 				goto fail;
+
+			if (wacom_wac1->features.type == INTUOS_HT &&
+			    wacom_wac1->features.touch_max)
+				wacom_wac->shared->touch_input = wacom_wac2->input;
 		}
 
 		error = wacom_initialize_battery(wacom);
 		if (error)
 			goto fail;
+		else if ((wacom_wac->shared->type == INTUOS_HT) && wacom_wac->shared->touch_max) {
+			/* report SW_TOUCH_ENABLED initial state for wireless interface */
+			unsigned char *data = wacom_wac->data;
+
+			if (data[0] == WACOM_REPORT_WL_MODE) {
+				input_report_switch(wacom_wac->shared->touch_input,
+						SW_TOUCH_ENABLED, data[5] & 0x40);
+				input_sync(wacom_wac->shared->touch_input);
+			}
+		}
 	}
 
 	return;
@@ -1318,7 +1335,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
 	 * HID descriptor. If this is the touch interface (wMaxPacketSize
 	 * of WACOM_PKGLEN_BBTOUCH3), override the table values.
 	 */
-	if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
+	if (features->type >= INTUOS5S && features->type <= INTUOS_HT) {
 		if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) {
 			features->device_type = BTN_TOOL_FINGER;
 			features->pktlen = WACOM_PKGLEN_BBTOUCH3;
@@ -1390,6 +1407,11 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
 		}
 	}
 
+	if (wacom_wac->features.type == INTUOS_HT && wacom_wac->features.touch_max) {
+		if (wacom_wac->features.device_type == BTN_TOOL_FINGER)
+			wacom_wac->shared->touch_input = wacom_wac->input;
+	}
+
 	return 0;
 
  fail5: wacom_destroy_leds(wacom);
drivers/input/tablet/wacom_wac.c +70 -16

171 lines not on this page · raw message

drivers/input/tablet/wacom_wac.h +7 -0
index fd23a37..ba9e335 100644
@@ -54,6 +54,8 @@
 #define WACOM_REPORT_TPCST		16
 #define WACOM_REPORT_TPC1FGE		18
 #define WACOM_REPORT_24HDT		1
+#define WACOM_REPORT_WL_MODE		128
+#define WACOM_REPORT_USB_MODE		192
 
 /* device quirks */
 #define WACOM_QUIRK_MULTI_INPUT		0x0001
@@ -81,6 +83,7 @@ enum {
 	INTUOSPS,
 	INTUOSPM,
 	INTUOSPL,
+	INTUOS_HT,
 	WACOM_21UX2,
 	WACOM_22HD,
 	DTK,
@@ -129,6 +132,10 @@ struct wacom_features {
 struct wacom_shared {
 	bool stylus_in_proximity;
 	bool touch_down;
+	/* for wireless device to access USB interfaces */
+	unsigned touch_max;
+	int type;
+	struct input_dev *touch_input;
 };
 
 struct wacom_wac {
include/uapi/linux/input.h +1 -0
index d08abf9..d4097b0 100644
@@ -855,6 +855,7 @@ struct input_keymap_entry {
 #define SW_FRONT_PROXIMITY	0x0b  /* set = front proximity sensor active */
 #define SW_ROTATE_LOCK		0x0c  /* set = rotate locked/disabled */
 #define SW_LINEIN_INSERT	0x0d  /* set = inserted */
+#define SW_TOUCH_ENABLED	0x0e  /* set = touch switch turned on (touch events off) */
 #define SW_MAX			0x0f
 #define SW_CNT			(SW_MAX+1)
 
Signature · 1 line
1.8.1.2
maintainer
#1 lore raw
Quoted 3 lines · Ping Cheng

This series of models added a hardware switch to turn touch data on/off. To report the state of the switch, SW_TOUCH_ENABLED is added in include/uapi/linux/input.h.

Hmm, should we just postpone creating of input device until touch is enabled instead?

Signature · 1 line
Dmitry
#2 lore raw
Quoted 6 lines · Dmitry Torokhov
Quoted 3 lines · Ping Cheng

This series of models added a hardware switch to turn touch data on/off. To report the state of the switch, SW_TOUCH_ENABLED is added in include/uapi/linux/input.h.

Quoted 6 lines

Hmm, should we just postpone creating of input device until touch is enabled instead?

--
Dmitry
--

The idea of SW_TOUCH_ENABLED is to allow userspace to be a bit more helpful and display a "disabled" message rather than disappearing the device entirely when the switch is 'off'. In theory this could also be achieved through the libwacom support library (by scanning the list of event devices to see if any of the expected interfaces are missing), but the approach is somewhat fragile and I'm not convinced that linking the switch to device creation/removal is correct.

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one /
(That is to say, eight) to the two, /
But you can’t take seven from three, /
So you look at the sixty-fours....
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html