Re: [Linuxwacom-devel] [PATCH] Add support for DTK-2451 and DTH-2452

2018-01-29 Thread Jason Gerecke
Looks good, thanks!

Reviewed-by: Jason Gerecke 

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



On Fri, Jan 26, 2018 at 3:25 PM, Ping Cheng  wrote:
> Signed-off-by: Ping Cheng 
> ---
>  2.6.30/wacom_sys.c |  8 ++--
>  2.6.30/wacom_wac.c | 45 +++--
>  2.6.30/wacom_wac.h |  3 +++
>  2.6.38/wacom_sys.c |  3 +++
>  2.6.38/wacom_wac.c | 45 +++--
>  2.6.38/wacom_wac.h |  3 +++
>  3.7/wacom_sys.c|  3 +++
>  3.7/wacom_wac.c| 45 +++--
>  3.7/wacom_wac.h|  3 +++
>  9 files changed, 138 insertions(+), 20 deletions(-)
>
> diff --git a/2.6.30/wacom_sys.c b/2.6.30/wacom_sys.c
> index ba17b1b..bdb1eb8 100644
> --- a/2.6.30/wacom_sys.c
> +++ b/2.6.30/wacom_sys.c
> @@ -266,7 +266,8 @@ static int wacom_parse_hid(struct usb_interface *intf, 
> struct hid_descriptor *hi
>  features->type == 
> WACOM_24HDT ||
>  features->type == 
> WACOM_MSPROT ||
>  features->type == 
> DTH1152T ||
> -features->type == 
> WACOM_27QHDT) {
> +features->type == 
> WACOM_27QHDT ||
> +features->type == 
> DTH2452T) {
> /* need to reset back */
> features->pktlen = 
> WACOM_PKGLEN_TPC2FG;
> if (features->type == MTTPC ||
> @@ -275,7 +276,8 @@ static int wacom_parse_hid(struct usb_interface *intf, 
> struct hid_descriptor *hi
> features->pktlen = 
> WACOM_PKGLEN_MTTPC;
> else if (features->type == 
> WACOM_24HDT)
> features->pktlen = 
> WACOM_PKGLEN_MTOUCH;
> -   else if (features->type == 
> WACOM_MSPROT)
> +   else if (features->type == 
> WACOM_MSPROT ||
> +features->type == 
> DTH2452T)
> features->pktlen = 
> WACOM_PKGLEN_MSPROT;
> else if (features->type == 
> DTH1152T ||
>  features->type == 
> WACOM_27QHDT)
> @@ -317,6 +319,7 @@ static int wacom_parse_hid(struct usb_interface *intf, 
> struct hid_descriptor *hi
>
> case WACOM_MSPROT:
> case MTTPC_B:
> +   case DTH2452T:
> features->x_max =
> 
> get_unaligned_le16([i + 3]);
> features->x_phy =
> @@ -394,6 +397,7 @@ static int wacom_parse_hid(struct usb_interface *intf, 
> struct hid_descriptor *hi
>
> case WACOM_MSPROT:
> case MTTPC_B:
> +   case DTH2452T:
> features->y_max =
> 
> get_unaligned_le16([i + 3]);
> features->y_phy =
> diff --git a/2.6.30/wacom_wac.c b/2.6.30/wacom_wac.c
> index 90c5c2b..4d4f924 100644
> --- a/2.6.30/wacom_wac.c
> +++ b/2.6.30/wacom_wac.c
> @@ -227,13 +227,16 @@ static int wacom_dtus_irq(struct wacom_wac *wacom)
>  {
> unsigned char *data = wacom->data;
> struct input_dev *input = wacom->input;
> +   struct wacom_features *features = >features;
> unsigned short prox, pressure = 0;
>
> -   if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD) {
> +   if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD
> +   && data[0] != WACOM_REPORT_DTK2451PAD) {
> dev_dbg(input->dev.parent,
> "%s: received unknown report #%d", __func__, data[0]);
> return 0;
> -   } else if (data[0] == WACOM_REPORT_DTUSPAD) {
> +   } else if (data[0] == WACOM_REPORT_DTUSPAD
> +   || data[0] == WACOM_REPORT_DTK2451PAD) {
> input_report_key(input, BTN_0, (data[1] & 0x01));
> 

[Linuxwacom-devel] [PATCH] Add support for DTK-2451 and DTH-2452

2018-01-26 Thread Ping Cheng
Signed-off-by: Ping Cheng 
---
 2.6.30/wacom_sys.c |  8 ++--
 2.6.30/wacom_wac.c | 45 +++--
 2.6.30/wacom_wac.h |  3 +++
 2.6.38/wacom_sys.c |  3 +++
 2.6.38/wacom_wac.c | 45 +++--
 2.6.38/wacom_wac.h |  3 +++
 3.7/wacom_sys.c|  3 +++
 3.7/wacom_wac.c| 45 +++--
 3.7/wacom_wac.h|  3 +++
 9 files changed, 138 insertions(+), 20 deletions(-)

diff --git a/2.6.30/wacom_sys.c b/2.6.30/wacom_sys.c
index ba17b1b..bdb1eb8 100644
--- a/2.6.30/wacom_sys.c
+++ b/2.6.30/wacom_sys.c
@@ -266,7 +266,8 @@ static int wacom_parse_hid(struct usb_interface *intf, 
struct hid_descriptor *hi
 features->type == 
WACOM_24HDT ||
 features->type == 
WACOM_MSPROT ||
 features->type == 
DTH1152T ||
-features->type == 
WACOM_27QHDT) {
+features->type == 
WACOM_27QHDT ||
+features->type == 
DTH2452T) {
/* need to reset back */
features->pktlen = 
WACOM_PKGLEN_TPC2FG;
if (features->type == MTTPC ||
@@ -275,7 +276,8 @@ static int wacom_parse_hid(struct usb_interface *intf, 
struct hid_descriptor *hi
features->pktlen = 
WACOM_PKGLEN_MTTPC;
else if (features->type == 
WACOM_24HDT)
features->pktlen = 
WACOM_PKGLEN_MTOUCH;
-   else if (features->type == 
WACOM_MSPROT)
+   else if (features->type == 
WACOM_MSPROT ||
+features->type == 
DTH2452T)
features->pktlen = 
WACOM_PKGLEN_MSPROT;
else if (features->type == 
DTH1152T ||
 features->type == 
WACOM_27QHDT)
@@ -317,6 +319,7 @@ static int wacom_parse_hid(struct usb_interface *intf, 
struct hid_descriptor *hi
 
case WACOM_MSPROT:
case MTTPC_B:
+   case DTH2452T:
features->x_max =

get_unaligned_le16([i + 3]);
features->x_phy =
@@ -394,6 +397,7 @@ static int wacom_parse_hid(struct usb_interface *intf, 
struct hid_descriptor *hi
 
case WACOM_MSPROT:
case MTTPC_B:
+   case DTH2452T:
features->y_max =

get_unaligned_le16([i + 3]);
features->y_phy =
diff --git a/2.6.30/wacom_wac.c b/2.6.30/wacom_wac.c
index 90c5c2b..4d4f924 100644
--- a/2.6.30/wacom_wac.c
+++ b/2.6.30/wacom_wac.c
@@ -227,13 +227,16 @@ static int wacom_dtus_irq(struct wacom_wac *wacom)
 {
unsigned char *data = wacom->data;
struct input_dev *input = wacom->input;
+   struct wacom_features *features = >features;
unsigned short prox, pressure = 0;
 
-   if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD) {
+   if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD
+   && data[0] != WACOM_REPORT_DTK2451PAD) {
dev_dbg(input->dev.parent,
"%s: received unknown report #%d", __func__, data[0]);
return 0;
-   } else if (data[0] == WACOM_REPORT_DTUSPAD) {
+   } else if (data[0] == WACOM_REPORT_DTUSPAD
+   || data[0] == WACOM_REPORT_DTK2451PAD) {
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));
@@ -264,9 +267,15 @@ static int wacom_dtus_irq(struct wacom_wac *wacom)
 
input_report_key(input, BTN_STYLUS, data[1] & 0x20);
input_report_key(input, BTN_STYLUS2, data[1] & 0x40);
-   input_report_abs(input, ABS_X, get_unaligned_be16([3]));
-   input_report_abs(input, ABS_Y, get_unaligned_be16([5]));
-   pressure = ((data[1] & 0x03) << 8) | (data[2] & 0xff);
+