linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: wacom: Add support for Cintiq Companion 2
@ 2015-10-07 23:55 Jason Gerecke
  2015-10-08  0:59 ` Bastien Nocera
  0 siblings, 1 reply; 8+ messages in thread
From: Jason Gerecke @ 2015-10-07 23:55 UTC (permalink / raw)
  To: linux-input
  Cc: Jiri Kosina, Benjamin Tissoires, Ping Cheng, Aaron Skomra,
	expiredpopsicle, Jason Gerecke, Jason Gerecke

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Clifford Jolly <expiredpopsicle@gmail.com>
---
 drivers/hid/wacom_sys.c |  2 +-
 drivers/hid/wacom_wac.c | 41 ++++++++++++++++++++++++++++++++++++++++-
 drivers/hid/wacom_wac.h |  1 +
 3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 5f6e48e..2e7a1c7 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -420,7 +420,7 @@ static int wacom_query_tablet_data(struct hid_device *hdev,
 			/* MT Tablet PC touch */
 			return wacom_set_device_mode(hdev, 3, 4, 4);
 		}
-		else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID) {
+		else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID || features->type == CINTIQ_COMPANION_2) {
 			return wacom_set_device_mode(hdev, 18, 3, 2);
 		}
 		else if (features->type == WACOM_27QHDT) {
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 46bd02b..44d4cc3 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -765,7 +765,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
 	/* general pen packet */
 	if ((data[1] & 0xb8) == 0xa0) {
 		t = (data[6] << 2) | ((data[7] >> 6) & 3);
-		if (features->type >= INTUOS4S && features->type <= CINTIQ_HYBRID) {
+		if (features->type >= INTUOS4S && features->type <= CINTIQ_COMPANION_2) {
 			t = (t << 1) | (data[1] & 1);
 		}
 		input_report_abs(input, ABS_PRESSURE, t);
@@ -948,6 +948,27 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
 			} else {
 				input_report_abs(input, ABS_MISC, 0);
 			}
+
+		} else if (features->type == CINTIQ_COMPANION_2) {
+			input_report_key(input, BTN_1, (data[1] & 0x02));
+			input_report_key(input, BTN_2, (data[2] & 0x01));
+			input_report_key(input, BTN_3, (data[2] & 0x02));
+			input_report_key(input, BTN_4, (data[2] & 0x04));
+			input_report_key(input, BTN_5, (data[2] & 0x08));
+			input_report_key(input, BTN_6, (data[1] & 0x04));
+
+			input_report_key(input, BTN_7, (data[2] & 0x10));  /* Right  */
+			input_report_key(input, BTN_8, (data[2] & 0x20));  /* Up	 */
+			input_report_key(input, BTN_9, (data[2] & 0x40));  /* Left   */
+			input_report_key(input, BTN_A, (data[2] & 0x80));  /* Down   */
+			input_report_key(input, BTN_0, (data[1] & 0x01));  /* Center */
+
+			if (data[4] | (data[3] & 0x01)) {
+				input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
+			} else {
+				input_report_abs(input, ABS_MISC, 0);
+			}
+
 		} else if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
 			int i;
 
@@ -2290,6 +2311,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
 	case WACOM_27QHD:
 	case DTK:
 	case CINTIQ_HYBRID:
+	case CINTIQ_COMPANION_2:
 		sync = wacom_intuos_irq(wacom_wac);
 		break;
 
@@ -2543,6 +2565,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
 	case CINTIQ:
 	case WACOM_13HD:
 	case CINTIQ_HYBRID:
+	case CINTIQ_COMPANION_2:
 		input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
 		input_abs_set_res(input_dev, ABS_Z, 287);
 		__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
@@ -2595,6 +2618,12 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
 		__clear_bit(ABS_MISC, input_dev->absbit);
 		/* fall through */
 
+	case CINTIQ_COMPANION_2:
+		for (i = 0; i < 10; i++)
+			__set_bit(BTN_0 + i, input_dev->keybit);
+		__set_bit(BTN_A, input_dev->keybit);
+		break;
+
 	case DTUS:
 	case DTUSX:
 	case PL:
@@ -3347,6 +3376,14 @@ static const struct wacom_features wacom_features_0x318 =
 static const struct wacom_features wacom_features_0x319 =
 	{ "Wacom Wireless Bamboo PAD", 4095, 4095, /* Touch */
 	  .type = BAMBOO_PAD, 35, 48, .touch_max = 4 };
+static const struct wacom_features wacom_features_0x325 =
+	{ "Wacom ISDv5 325", 59552, 33848, 2047, 63,
+	  CINTIQ_COMPANION_2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
+	  WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
+	  .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x326 };
+static const struct wacom_features wacom_features_0x326 = /* Touch */
+	{ "Wacom ISDv5 326", .type = HID_GENERIC, .oVid = USB_VENDOR_ID_WACOM,
+	  .oPid = 0x325 };
 static const struct wacom_features wacom_features_0x323 =
 	{ "Wacom Intuos P M", 21600, 13500, 1023, 31,
 	  INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
@@ -3506,6 +3543,8 @@ const struct hid_device_id wacom_ids[] = {
 	{ USB_DEVICE_WACOM(0x318) },
 	{ USB_DEVICE_WACOM(0x319) },
 	{ USB_DEVICE_WACOM(0x323) },
+	{ USB_DEVICE_WACOM(0x325) },
+	{ USB_DEVICE_WACOM(0x326) },
 	{ USB_DEVICE_WACOM(0x32A) },
 	{ USB_DEVICE_WACOM(0x32B) },
 	{ USB_DEVICE_WACOM(0x32C) },
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index 809c03e..5a1ec76 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -124,6 +124,7 @@ enum {
 	WACOM_24HD,
 	WACOM_27QHD,
 	CINTIQ_HYBRID,
+	CINTIQ_COMPANION_2,
 	CINTIQ,
 	WACOM_BEE,
 	WACOM_13HD,
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] HID: wacom: Add support for Cintiq Companion 2
  2015-10-07 23:55 [PATCH] HID: wacom: Add support for Cintiq Companion 2 Jason Gerecke
@ 2015-10-08  0:59 ` Bastien Nocera
  2015-10-08  2:31   ` Cliff Jolly
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien Nocera @ 2015-10-08  0:59 UTC (permalink / raw)
  To: Jason Gerecke, linux-input
  Cc: Jiri Kosina, Benjamin Tissoires, Ping Cheng, Aaron Skomra,
	expiredpopsicle, Jason Gerecke

On Wed, 2015-10-07 at 16:55 -0700, Jason Gerecke wrote:
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
> Signed-off-by: Clifford Jolly <expiredpopsicle@gmail.com>

Is that support for using the Cintiq Companion 2 as an accessory (eg.
still running Windows on the machine, and plugging it in to a Linux
machine), or for the Wacom device inside the tablet when it's running
Linux (if that's possible)?

Either way, which it is should be included in the commit message.

For those who don't know about that device:
http://www.wacom.com/en-us/products/pen-displays/cintiq-companion-2

Cheers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] HID: wacom: Add support for Cintiq Companion 2
  2015-10-08  0:59 ` Bastien Nocera
@ 2015-10-08  2:31   ` Cliff Jolly
  2015-10-08 18:28     ` [PATCH v2] " Jason Gerecke
  0 siblings, 1 reply; 8+ messages in thread
From: Cliff Jolly @ 2015-10-08  2:31 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Jason Gerecke, linux-input, Jiri Kosina, Benjamin Tissoires,
	Ping Cheng, Aaron Skomra, Jason Gerecke

This applies to both. When running as a standalone tablet, all the
tablet input devices still go through the usb system. The different
modes show the same usb vendor and product IDs and seem to behave
identically in the testing I've done.

Sorry for the multiple-message spam.

On Wed, Oct 7, 2015 at 5:59 PM, Bastien Nocera <hadess@hadess.net> wrote:
> On Wed, 2015-10-07 at 16:55 -0700, Jason Gerecke wrote:
>> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
>> Signed-off-by: Clifford Jolly <expiredpopsicle@gmail.com>
>
> Is that support for using the Cintiq Companion 2 as an accessory (eg.
> still running Windows on the machine, and plugging it in to a Linux
> machine), or for the Wacom device inside the tablet when it's running
> Linux (if that's possible)?
>
> Either way, which it is should be included in the commit message.
>
> For those who don't know about that device:
> http://www.wacom.com/en-us/products/pen-displays/cintiq-companion-2
>
> Cheers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] HID: wacom: Add support for Cintiq Companion 2
  2015-10-08  2:31   ` Cliff Jolly
@ 2015-10-08 18:28     ` Jason Gerecke
  2015-10-11 23:02       ` Jiri Kosina
  0 siblings, 1 reply; 8+ messages in thread
From: Jason Gerecke @ 2015-10-08 18:28 UTC (permalink / raw)
  To: linux-input
  Cc: Jiri Kosina, Benjamin Tissoires, Ping Cheng, Aaron Skomra,
	Jason Gerecke, Jason Gerecke, Clifford Jolly

Adds support for the EMR (pen+pad) and touchscreen devices used by the
Wacom Cintiq Companion 2. This applies both to using the device as a
standalone system, as well as when operating in "Cintiq mode" (where
the EMR/touchscreen are simply exposed as USB devices to the system
its connected to).

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Clifford Jolly <expiredpopsicle@gmail.com>
---
 drivers/hid/wacom_sys.c |  2 +-
 drivers/hid/wacom_wac.c | 41 ++++++++++++++++++++++++++++++++++++++++-
 drivers/hid/wacom_wac.h |  1 +
 3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 5f6e48e..2e7a1c7 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -420,7 +420,7 @@ static int wacom_query_tablet_data(struct hid_device *hdev,
 			/* MT Tablet PC touch */
 			return wacom_set_device_mode(hdev, 3, 4, 4);
 		}
-		else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID) {
+		else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID || features->type == CINTIQ_COMPANION_2) {
 			return wacom_set_device_mode(hdev, 18, 3, 2);
 		}
 		else if (features->type == WACOM_27QHDT) {
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 46bd02b..44d4cc3 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -765,7 +765,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
 	/* general pen packet */
 	if ((data[1] & 0xb8) == 0xa0) {
 		t = (data[6] << 2) | ((data[7] >> 6) & 3);
-		if (features->type >= INTUOS4S && features->type <= CINTIQ_HYBRID) {
+		if (features->type >= INTUOS4S && features->type <= CINTIQ_COMPANION_2) {
 			t = (t << 1) | (data[1] & 1);
 		}
 		input_report_abs(input, ABS_PRESSURE, t);
@@ -948,6 +948,27 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
 			} else {
 				input_report_abs(input, ABS_MISC, 0);
 			}
+
+		} else if (features->type == CINTIQ_COMPANION_2) {
+			input_report_key(input, BTN_1, (data[1] & 0x02));
+			input_report_key(input, BTN_2, (data[2] & 0x01));
+			input_report_key(input, BTN_3, (data[2] & 0x02));
+			input_report_key(input, BTN_4, (data[2] & 0x04));
+			input_report_key(input, BTN_5, (data[2] & 0x08));
+			input_report_key(input, BTN_6, (data[1] & 0x04));
+
+			input_report_key(input, BTN_7, (data[2] & 0x10));  /* Right  */
+			input_report_key(input, BTN_8, (data[2] & 0x20));  /* Up	 */
+			input_report_key(input, BTN_9, (data[2] & 0x40));  /* Left   */
+			input_report_key(input, BTN_A, (data[2] & 0x80));  /* Down   */
+			input_report_key(input, BTN_0, (data[1] & 0x01));  /* Center */
+
+			if (data[4] | (data[3] & 0x01)) {
+				input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
+			} else {
+				input_report_abs(input, ABS_MISC, 0);
+			}
+
 		} else if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
 			int i;
 
@@ -2290,6 +2311,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
 	case WACOM_27QHD:
 	case DTK:
 	case CINTIQ_HYBRID:
+	case CINTIQ_COMPANION_2:
 		sync = wacom_intuos_irq(wacom_wac);
 		break;
 
@@ -2543,6 +2565,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
 	case CINTIQ:
 	case WACOM_13HD:
 	case CINTIQ_HYBRID:
+	case CINTIQ_COMPANION_2:
 		input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
 		input_abs_set_res(input_dev, ABS_Z, 287);
 		__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
@@ -2595,6 +2618,12 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
 		__clear_bit(ABS_MISC, input_dev->absbit);
 		/* fall through */
 
+	case CINTIQ_COMPANION_2:
+		for (i = 0; i < 10; i++)
+			__set_bit(BTN_0 + i, input_dev->keybit);
+		__set_bit(BTN_A, input_dev->keybit);
+		break;
+
 	case DTUS:
 	case DTUSX:
 	case PL:
@@ -3347,6 +3376,14 @@ static const struct wacom_features wacom_features_0x318 =
 static const struct wacom_features wacom_features_0x319 =
 	{ "Wacom Wireless Bamboo PAD", 4095, 4095, /* Touch */
 	  .type = BAMBOO_PAD, 35, 48, .touch_max = 4 };
+static const struct wacom_features wacom_features_0x325 =
+	{ "Wacom ISDv5 325", 59552, 33848, 2047, 63,
+	  CINTIQ_COMPANION_2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
+	  WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
+	  .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x326 };
+static const struct wacom_features wacom_features_0x326 = /* Touch */
+	{ "Wacom ISDv5 326", .type = HID_GENERIC, .oVid = USB_VENDOR_ID_WACOM,
+	  .oPid = 0x325 };
 static const struct wacom_features wacom_features_0x323 =
 	{ "Wacom Intuos P M", 21600, 13500, 1023, 31,
 	  INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
@@ -3506,6 +3543,8 @@ const struct hid_device_id wacom_ids[] = {
 	{ USB_DEVICE_WACOM(0x318) },
 	{ USB_DEVICE_WACOM(0x319) },
 	{ USB_DEVICE_WACOM(0x323) },
+	{ USB_DEVICE_WACOM(0x325) },
+	{ USB_DEVICE_WACOM(0x326) },
 	{ USB_DEVICE_WACOM(0x32A) },
 	{ USB_DEVICE_WACOM(0x32B) },
 	{ USB_DEVICE_WACOM(0x32C) },
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index 809c03e..5a1ec76 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -124,6 +124,7 @@ enum {
 	WACOM_24HD,
 	WACOM_27QHD,
 	CINTIQ_HYBRID,
+	CINTIQ_COMPANION_2,
 	CINTIQ,
 	WACOM_BEE,
 	WACOM_13HD,
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] HID: wacom: Add support for Cintiq Companion 2
  2015-10-08 18:28     ` [PATCH v2] " Jason Gerecke
@ 2015-10-11 23:02       ` Jiri Kosina
  2015-10-12 16:23         ` Jason Gerecke
  0 siblings, 1 reply; 8+ messages in thread
From: Jiri Kosina @ 2015-10-11 23:02 UTC (permalink / raw)
  To: Jason Gerecke
  Cc: linux-input, Benjamin Tissoires, Ping Cheng, Aaron Skomra,
	Jason Gerecke, Clifford Jolly

On Thu, 8 Oct 2015, Jason Gerecke wrote:

> Adds support for the EMR (pen+pad) and touchscreen devices used by the
> Wacom Cintiq Companion 2. This applies both to using the device as a
> standalone system, as well as when operating in "Cintiq mode" (where
> the EMR/touchscreen are simply exposed as USB devices to the system
> its connected to).
> 
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
> Signed-off-by: Clifford Jolly <expiredpopsicle@gmail.com>
[ ... snip ... ]
> @@ -2290,6 +2311,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
>  	case WACOM_27QHD:
>  	case DTK:
>  	case CINTIQ_HYBRID:
> +	case CINTIQ_COMPANION_2:
>  		sync = wacom_intuos_irq(wacom_wac);
>  		break;

This doesn't make any sense. You break here out after handling 
CINTIQ_COMPANION_2 in features->type switch ...

>  
> @@ -2543,6 +2565,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
>  	case CINTIQ:
>  	case WACOM_13HD:
>  	case CINTIQ_HYBRID:
> +	case CINTIQ_COMPANION_2:
>  		input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
>  		input_abs_set_res(input_dev, ABS_Z, 287);
>  		__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);

... here you break out of the switch case a few lines below again.


> @@ -2595,6 +2618,12 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
>  		__clear_bit(ABS_MISC, input_dev->absbit);
>  		/* fall through */
>  
> +	case CINTIQ_COMPANION_2:
> +		for (i = 0; i < 10; i++)

Where do you define this 'i'?

> +			__set_bit(BTN_0 + i, input_dev->keybit);
> +		__set_bit(BTN_A, input_dev->keybit);
> +		break;
> +

And here you break out of the same case again explicitly again.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] HID: wacom: Add support for Cintiq Companion 2
  2015-10-11 23:02       ` Jiri Kosina
@ 2015-10-12 16:23         ` Jason Gerecke
  2015-10-13 17:03           ` [PATCH v3] " Jason Gerecke
  0 siblings, 1 reply; 8+ messages in thread
From: Jason Gerecke @ 2015-10-12 16:23 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: linux-input, Benjamin Tissoires, Ping Cheng, Aaron Skomra,
	Jason Gerecke, Clifford Jolly

10/11/2015 4:02 PM, Jiri Kosina wrote:
> On Thu, 8 Oct 2015, Jason Gerecke wrote:
> 
>> Adds support for the EMR (pen+pad) and touchscreen devices used by the
>> Wacom Cintiq Companion 2. This applies both to using the device as a
>> standalone system, as well as when operating in "Cintiq mode" (where
>> the EMR/touchscreen are simply exposed as USB devices to the system
>> its connected to).
>>
>> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
>> Signed-off-by: Clifford Jolly <expiredpopsicle@gmail.com>
> [ ... snip ... ]
>> @@ -2290,6 +2311,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
>>  	case WACOM_27QHD:
>>  	case DTK:
>>  	case CINTIQ_HYBRID:
>> +	case CINTIQ_COMPANION_2:
>>  		sync = wacom_intuos_irq(wacom_wac);
>>  		break;
> 
> This doesn't make any sense. You break here out after handling 
> CINTIQ_COMPANION_2 in features->type switch ...
> 
>>  
>> @@ -2543,6 +2565,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
>>  	case CINTIQ:
>>  	case WACOM_13HD:
>>  	case CINTIQ_HYBRID:
>> +	case CINTIQ_COMPANION_2:
>>  		input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
>>  		input_abs_set_res(input_dev, ABS_Z, 287);
>>  		__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
> 
> ... here you break out of the switch case a few lines below again.
> 
> 
>> @@ -2595,6 +2618,12 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
>>  		__clear_bit(ABS_MISC, input_dev->absbit);
>>  		/* fall through */
>>  
>> +	case CINTIQ_COMPANION_2:
>> +		for (i = 0; i < 10; i++)
> 
> Where do you define this 'i'?
> 
>> +			__set_bit(BTN_0 + i, input_dev->keybit);
>> +		__set_bit(BTN_A, input_dev->keybit);
>> +		break;
>> +
> 
> And here you break out of the same case again explicitly again.
> 

Looks like something went awry when migrating my patch from my branch in
our local "input-wacom" tree to your upstream branch. Based on what's
wrong, it looks like `patch` may have been confused by Aaron's recent
changes to 'wacom_setup_pad_input_capabilities' (70ee06c) that weren't
integrated into my local branch.

I'll submit a fixed version shortly. Apologies for the noise.

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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3] HID: wacom: Add support for Cintiq Companion 2
  2015-10-12 16:23         ` Jason Gerecke
@ 2015-10-13 17:03           ` Jason Gerecke
  2015-10-21  9:21             ` Jiri Kosina
  0 siblings, 1 reply; 8+ messages in thread
From: Jason Gerecke @ 2015-10-13 17:03 UTC (permalink / raw)
  To: linux-input
  Cc: Jiri Kosina, Benjamin Tissoires, Ping Cheng, Aaron Skomra,
	Jason Gerecke, Jason Gerecke, Clifford Jolly

Adds support for the EMR (pen+pad) and touchscreen devices used by the
Wacom Cintiq Companion 2. This applies both to using the device as a
standalone system, as well as when operating in "Cintiq mode" (where
the EMR/touchscreen are simply exposed as USB devices to the system
its connected to).

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Clifford Jolly <expiredpopsicle@gmail.com>
---
Changes from v2:
 * The switch in wacom_setup_pen_input_capabilities now only contains the
   first CINTIQ_COMPANION_2 case. The second case has been moved to the
   switch in wacom_setup_pad_input_capabilities where it belongs.

 * The second CINTIQ_COMPANION_2 case mentioned above no longer explicitly
   sets up the pad buttons since wacom_setup_numbered_buttons is now
   (70ee06c) in charge of this initialization.

 drivers/hid/wacom_sys.c |  2 +-
 drivers/hid/wacom_wac.c | 36 +++++++++++++++++++++++++++++++++++-
 drivers/hid/wacom_wac.h |  1 +
 3 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 5f6e48e..2e7a1c7 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -420,7 +420,7 @@ static int wacom_query_tablet_data(struct hid_device *hdev,
 			/* MT Tablet PC touch */
 			return wacom_set_device_mode(hdev, 3, 4, 4);
 		}
-		else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID) {
+		else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID || features->type == CINTIQ_COMPANION_2) {
 			return wacom_set_device_mode(hdev, 18, 3, 2);
 		}
 		else if (features->type == WACOM_27QHDT) {
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 46bd02b..e0b9320 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -765,7 +765,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
 	/* general pen packet */
 	if ((data[1] & 0xb8) == 0xa0) {
 		t = (data[6] << 2) | ((data[7] >> 6) & 3);
-		if (features->type >= INTUOS4S && features->type <= CINTIQ_HYBRID) {
+		if (features->type >= INTUOS4S && features->type <= CINTIQ_COMPANION_2) {
 			t = (t << 1) | (data[1] & 1);
 		}
 		input_report_abs(input, ABS_PRESSURE, t);
@@ -948,6 +948,27 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
 			} else {
 				input_report_abs(input, ABS_MISC, 0);
 			}
+
+		} else if (features->type == CINTIQ_COMPANION_2) {
+			input_report_key(input, BTN_1, (data[1] & 0x02));
+			input_report_key(input, BTN_2, (data[2] & 0x01));
+			input_report_key(input, BTN_3, (data[2] & 0x02));
+			input_report_key(input, BTN_4, (data[2] & 0x04));
+			input_report_key(input, BTN_5, (data[2] & 0x08));
+			input_report_key(input, BTN_6, (data[1] & 0x04));
+
+			input_report_key(input, BTN_7, (data[2] & 0x10));  /* Right  */
+			input_report_key(input, BTN_8, (data[2] & 0x20));  /* Up	 */
+			input_report_key(input, BTN_9, (data[2] & 0x40));  /* Left   */
+			input_report_key(input, BTN_A, (data[2] & 0x80));  /* Down   */
+			input_report_key(input, BTN_0, (data[1] & 0x01));  /* Center */
+
+			if (data[4] | (data[3] & 0x01)) {
+				input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
+			} else {
+				input_report_abs(input, ABS_MISC, 0);
+			}
+
 		} else if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
 			int i;
 
@@ -2290,6 +2311,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
 	case WACOM_27QHD:
 	case DTK:
 	case CINTIQ_HYBRID:
+	case CINTIQ_COMPANION_2:
 		sync = wacom_intuos_irq(wacom_wac);
 		break;
 
@@ -2543,6 +2565,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
 	case CINTIQ:
 	case WACOM_13HD:
 	case CINTIQ_HYBRID:
+	case CINTIQ_COMPANION_2:
 		input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
 		input_abs_set_res(input_dev, ABS_Z, 287);
 		__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
@@ -2775,6 +2798,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
 	switch (features->type) {
 
 	case CINTIQ_HYBRID:
+	case CINTIQ_COMPANION_2:
 	case DTK:
 	case DTUS:
 	case GRAPHIRE_BT:
@@ -3347,6 +3371,14 @@ static const struct wacom_features wacom_features_0x318 =
 static const struct wacom_features wacom_features_0x319 =
 	{ "Wacom Wireless Bamboo PAD", 4095, 4095, /* Touch */
 	  .type = BAMBOO_PAD, 35, 48, .touch_max = 4 };
+static const struct wacom_features wacom_features_0x325 =
+	{ "Wacom ISDv5 325", 59552, 33848, 2047, 63,
+	  CINTIQ_COMPANION_2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 11,
+	  WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
+	  .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x326 };
+static const struct wacom_features wacom_features_0x326 = /* Touch */
+	{ "Wacom ISDv5 326", .type = HID_GENERIC, .oVid = USB_VENDOR_ID_WACOM,
+	  .oPid = 0x325 };
 static const struct wacom_features wacom_features_0x323 =
 	{ "Wacom Intuos P M", 21600, 13500, 1023, 31,
 	  INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
@@ -3506,6 +3538,8 @@ const struct hid_device_id wacom_ids[] = {
 	{ USB_DEVICE_WACOM(0x318) },
 	{ USB_DEVICE_WACOM(0x319) },
 	{ USB_DEVICE_WACOM(0x323) },
+	{ USB_DEVICE_WACOM(0x325) },
+	{ USB_DEVICE_WACOM(0x326) },
 	{ USB_DEVICE_WACOM(0x32A) },
 	{ USB_DEVICE_WACOM(0x32B) },
 	{ USB_DEVICE_WACOM(0x32C) },
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index 809c03e..5a1ec76 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -124,6 +124,7 @@ enum {
 	WACOM_24HD,
 	WACOM_27QHD,
 	CINTIQ_HYBRID,
+	CINTIQ_COMPANION_2,
 	CINTIQ,
 	WACOM_BEE,
 	WACOM_13HD,
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3] HID: wacom: Add support for Cintiq Companion 2
  2015-10-13 17:03           ` [PATCH v3] " Jason Gerecke
@ 2015-10-21  9:21             ` Jiri Kosina
  0 siblings, 0 replies; 8+ messages in thread
From: Jiri Kosina @ 2015-10-21  9:21 UTC (permalink / raw)
  To: Jason Gerecke
  Cc: linux-input, Benjamin Tissoires, Ping Cheng, Aaron Skomra,
	Jason Gerecke, Clifford Jolly

On Tue, 13 Oct 2015, Jason Gerecke wrote:

> Adds support for the EMR (pen+pad) and touchscreen devices used by the
> Wacom Cintiq Companion 2. This applies both to using the device as a
> standalone system, as well as when operating in "Cintiq mode" (where
> the EMR/touchscreen are simply exposed as USB devices to the system
> its connected to).
> 
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
> Signed-off-by: Clifford Jolly <expiredpopsicle@gmail.com>
> ---
> Changes from v2:
>  * The switch in wacom_setup_pen_input_capabilities now only contains the
>    first CINTIQ_COMPANION_2 case. The second case has been moved to the
>    switch in wacom_setup_pad_input_capabilities where it belongs.
> 
>  * The second CINTIQ_COMPANION_2 case mentioned above no longer explicitly
>    sets up the pad buttons since wacom_setup_numbered_buttons is now
>    (70ee06c) in charge of this initialization.

Applied to for-4.4/wacom.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-21  9:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-07 23:55 [PATCH] HID: wacom: Add support for Cintiq Companion 2 Jason Gerecke
2015-10-08  0:59 ` Bastien Nocera
2015-10-08  2:31   ` Cliff Jolly
2015-10-08 18:28     ` [PATCH v2] " Jason Gerecke
2015-10-11 23:02       ` Jiri Kosina
2015-10-12 16:23         ` Jason Gerecke
2015-10-13 17:03           ` [PATCH v3] " Jason Gerecke
2015-10-21  9:21             ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).