Re: [Linuxwacom-devel] [PATCH] Support DTU-1141B in the 3.7, 2.6.38, and 2.6.30 branches

2018-10-02 Thread Aaron Armstrong Skomra
On Fri, Sep 28, 2018 at 3:51 PM Ping Cheng  wrote:
>
> Signed-off-by: Ping Cheng 
Nit: The patch title says 2.6.30 but we've moved to 2.6.32.

It will be challenging to use this device on these older kernels given
the fact that
DisplayLink's driver starts support at 3.14. However, I can see the
kernel events
coming from the device.

Tested-by: Aaron Armstrong Skomra 

> ---
>  2.6.32/wacom_wac.c | 31 ++-
>  2.6.32/wacom_wac.h |  1 +
>  2.6.38/wacom_wac.c | 31 ++-
>  2.6.38/wacom_wac.h |  1 +
>  3.7/wacom_wac.c| 31 ++-
>  3.7/wacom_wac.h|  1 +
>  6 files changed, 81 insertions(+), 15 deletions(-)
>
> diff --git a/2.6.32/wacom_wac.c b/2.6.32/wacom_wac.c
> index c29c75c..c4705f8 100644
> --- a/2.6.32/wacom_wac.c
> +++ b/2.6.32/wacom_wac.c
> @@ -303,6 +303,20 @@ static int wacom_dth1152_irq(struct wacom_wac *wacom)
> unsigned short prox, pressure = 0;
>
> if (data[0] != WACOM_REPORT_DTUS) {
> +   if (data[0] == WACOM_REPORT_DTUSPAD) {
> +   input_report_key(input, BTN_0, (data[1] & 0x01));
> +   input_report_key(input, BTN_1, (data[1] & 0x02));
> +   input_report_key(input, BTN_2, (data[1] & 0x04));
> +   input_report_key(input, BTN_3, (data[1] & 0x08));
> +   input_report_abs(input, ABS_MISC,
> +data[1] & 0x0f ? PAD_DEVICE_ID : 0);
> +   /*
> +* Serial number is required when expresskeys are
> +* reported through pen interface.
> +*/
> +   input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
> +   return 1;
> +   }
> dev_dbg(input->dev.parent,
> "%s: received unknown report #%d", __func__, data[0]);
> return 0;
> @@ -1896,6 +1910,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t 
> len)
> sync = wacom_dtus_irq(wacom_wac);
> break;
>
> +   case DTUS2:
> case DTH1152:
> sync = wacom_dth1152_irq(wacom_wac);
> break;
> @@ -2382,14 +2397,16 @@ void wacom_setup_input_capabilities(struct input_dev 
> *input_dev,
> /* fall through */
>
> case DTUS:
> -   case DTUSX:
> +   case DTUS2:
> case DTK2451:
> +   input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
> +
> +   case DTUSX:
> case PL:
> case DTU:
> -   __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
> -   __set_bit(BTN_STYLUS2, input_dev->keybit);
> -   if (features->type == DTUS || features->type == DTK2451) {
> -   input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
> +   if (features->type != DTUS2) {
> +   __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
> +   __set_bit(BTN_STYLUS2, input_dev->keybit);
> }
> /* fall through */
>
> @@ -2991,6 +3008,9 @@ static const struct wacom_features wacom_features_0x357 
> =
>  static const struct wacom_features wacom_features_0x358 =
> { "Wacom Intuos Pro L", WACOM_PKGLEN_INTUOSP2, 62200, 43200, 8191, 63,
>   INTUOSP2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 10 
> };
> +static const struct wacom_features wacom_features_0x359 =
> +   { "Wacom DTU-1141B", WACOM_PKGLEN_DTH1152, 22320, 12555, 1023, 0,
> + DTUS2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4 };
>  static const struct wacom_features wacom_features_0x35A =
> { "Wacom DTH-1152", WACOM_PKGLEN_DTH1152, 22320, 12555, 1023, 0,
>   DTH1152, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
> @@ -3205,6 +3225,7 @@ const struct usb_device_id wacom_ids[] = {
> { USB_DEVICE_WACOM(0x356) },
> { USB_DEVICE_DETAILED(0x357, USB_CLASS_HID, 0, 0) },
> { USB_DEVICE_DETAILED(0x358, USB_CLASS_HID, 0, 0) },
> +   { USB_DEVICE_WACOM(0x359) },
> { USB_DEVICE_WACOM(0x35A) },
> { USB_DEVICE_WACOM(0x368) },
> { USB_DEVICE_WACOM(0x374) },
> diff --git a/2.6.32/wacom_wac.h b/2.6.32/wacom_wac.h
> index bdefbc1..56dcea3 100755
> --- a/2.6.32/wacom_wac.h
> +++ b/2.6.32/wacom_wac.h
> @@ -92,6 +92,7 @@ enum {
> PL,
> DTU,
> DTUS,
> +   DTUS2,
> DTUSX,
> DTH1152,
> DTK2451,
> diff --git a/2.6.38/wacom_wac.c b/2.6.38/wacom_wac.c
> index ebff932..2e090cf 100644
> --- a/2.6.38/wacom_wac.c
> +++ b/2.6.38/wacom_wac.c
> @@ -339,6 +339,20 @@ static int wacom_dth1152_irq(struct wacom_wac *wacom)
> unsigned short prox, pressure = 0;
>
> if (data[0] != WACOM_REPORT_DTUS) {
> +   if (data[0] == WACOM_REPORT_DTUSPAD) {
> +   input_report_key(input, BTN_0, (data[1] & 0x01));
> +

[Linuxwacom-devel] [PATCH] Support DTU-1141B in the 3.7, 2.6.38, and 2.6.30 branches

2018-09-28 Thread Ping Cheng
Signed-off-by: Ping Cheng 
---
 2.6.32/wacom_wac.c | 31 ++-
 2.6.32/wacom_wac.h |  1 +
 2.6.38/wacom_wac.c | 31 ++-
 2.6.38/wacom_wac.h |  1 +
 3.7/wacom_wac.c| 31 ++-
 3.7/wacom_wac.h|  1 +
 6 files changed, 81 insertions(+), 15 deletions(-)

diff --git a/2.6.32/wacom_wac.c b/2.6.32/wacom_wac.c
index c29c75c..c4705f8 100644
--- a/2.6.32/wacom_wac.c
+++ b/2.6.32/wacom_wac.c
@@ -303,6 +303,20 @@ static int wacom_dth1152_irq(struct wacom_wac *wacom)
unsigned short prox, pressure = 0;
 
if (data[0] != WACOM_REPORT_DTUS) {
+   if (data[0] == WACOM_REPORT_DTUSPAD) {
+   input_report_key(input, BTN_0, (data[1] & 0x01));
+   input_report_key(input, BTN_1, (data[1] & 0x02));
+   input_report_key(input, BTN_2, (data[1] & 0x04));
+   input_report_key(input, BTN_3, (data[1] & 0x08));
+   input_report_abs(input, ABS_MISC,
+data[1] & 0x0f ? PAD_DEVICE_ID : 0);
+   /*
+* Serial number is required when expresskeys are
+* reported through pen interface.
+*/
+   input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
+   return 1;
+   }
dev_dbg(input->dev.parent,
"%s: received unknown report #%d", __func__, data[0]);
return 0;
@@ -1896,6 +1910,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t 
len)
sync = wacom_dtus_irq(wacom_wac);
break;
 
+   case DTUS2:
case DTH1152:
sync = wacom_dth1152_irq(wacom_wac);
break;
@@ -2382,14 +2397,16 @@ void wacom_setup_input_capabilities(struct input_dev 
*input_dev,
/* fall through */
 
case DTUS:
-   case DTUSX:
+   case DTUS2:
case DTK2451:
+   input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
+
+   case DTUSX:
case PL:
case DTU:
-   __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
-   __set_bit(BTN_STYLUS2, input_dev->keybit);
-   if (features->type == DTUS || features->type == DTK2451) {
-   input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
+   if (features->type != DTUS2) {
+   __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
+   __set_bit(BTN_STYLUS2, input_dev->keybit);
}
/* fall through */
 
@@ -2991,6 +3008,9 @@ static const struct wacom_features wacom_features_0x357 =
 static const struct wacom_features wacom_features_0x358 =
{ "Wacom Intuos Pro L", WACOM_PKGLEN_INTUOSP2, 62200, 43200, 8191, 63,
  INTUOSP2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 10 };
+static const struct wacom_features wacom_features_0x359 =
+   { "Wacom DTU-1141B", WACOM_PKGLEN_DTH1152, 22320, 12555, 1023, 0,
+ DTUS2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4 };
 static const struct wacom_features wacom_features_0x35A =
{ "Wacom DTH-1152", WACOM_PKGLEN_DTH1152, 22320, 12555, 1023, 0,
  DTH1152, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
@@ -3205,6 +3225,7 @@ const struct usb_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0x356) },
{ USB_DEVICE_DETAILED(0x357, USB_CLASS_HID, 0, 0) },
{ USB_DEVICE_DETAILED(0x358, USB_CLASS_HID, 0, 0) },
+   { USB_DEVICE_WACOM(0x359) },
{ USB_DEVICE_WACOM(0x35A) },
{ USB_DEVICE_WACOM(0x368) },
{ USB_DEVICE_WACOM(0x374) },
diff --git a/2.6.32/wacom_wac.h b/2.6.32/wacom_wac.h
index bdefbc1..56dcea3 100755
--- a/2.6.32/wacom_wac.h
+++ b/2.6.32/wacom_wac.h
@@ -92,6 +92,7 @@ enum {
PL,
DTU,
DTUS,
+   DTUS2,
DTUSX,
DTH1152,
DTK2451,
diff --git a/2.6.38/wacom_wac.c b/2.6.38/wacom_wac.c
index ebff932..2e090cf 100644
--- a/2.6.38/wacom_wac.c
+++ b/2.6.38/wacom_wac.c
@@ -339,6 +339,20 @@ static int wacom_dth1152_irq(struct wacom_wac *wacom)
unsigned short prox, pressure = 0;
 
if (data[0] != WACOM_REPORT_DTUS) {
+   if (data[0] == WACOM_REPORT_DTUSPAD) {
+   input_report_key(input, BTN_0, (data[1] & 0x01));
+   input_report_key(input, BTN_1, (data[1] & 0x02));
+   input_report_key(input, BTN_2, (data[1] & 0x04));
+   input_report_key(input, BTN_3, (data[1] & 0x08));
+   input_report_abs(input, ABS_MISC,
+data[1] & 0x0f ? PAD_DEVICE_ID : 0);
+   /*
+* Serial number is required when expresskeys are
+* reported through pen interface.
+*/
+