linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/4] input: wacom - use switch statement for wacom_tpc_irq()
@ 2011-12-17  0:38 Ping Cheng
  2011-12-19  1:23 ` Chris Bagwell
  0 siblings, 1 reply; 2+ messages in thread
From: Ping Cheng @ 2011-12-17  0:38 UTC (permalink / raw)
  To: linux-input; +Cc: Ping Cheng, Ping Cheng

And add two new data formats.

Signed-off-by: Ping Cheng <pingc@wacom.com>
---
 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 33a4359..8dc185d 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -833,12 +833,24 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
 	dbg("wacom_tpc_irq: received report #%d with %d contacts",
 	     data[0], wacom->features.touch_max);
 
-	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 6ddd2e4..1c9dc3e 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.6.4


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

* Re: [PATCH 3/4] input: wacom - use switch statement for wacom_tpc_irq()
  2011-12-17  0:38 [PATCH 3/4] input: wacom - use switch statement for wacom_tpc_irq() Ping Cheng
@ 2011-12-19  1:23 ` Chris Bagwell
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Bagwell @ 2011-12-19  1:23 UTC (permalink / raw)
  To: Ping Cheng; +Cc: linux-input, Ping Cheng

Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>

On Fri, Dec 16, 2011 at 6:38 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> And add two new data formats.
>
> Signed-off-by: Ping Cheng <pingc@wacom.com>
> ---
>  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 33a4359..8dc185d 100644
> --- a/drivers/input/tablet/wacom_wac.c
> +++ b/drivers/input/tablet/wacom_wac.c
> @@ -833,12 +833,24 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
>        dbg("wacom_tpc_irq: received report #%d with %d contacts",
>             data[0], wacom->features.touch_max);
>
> -       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 6ddd2e4..1c9dc3e 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.6.4
>
> --
> 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
--
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] 2+ messages in thread

end of thread, other threads:[~2011-12-19  1:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-17  0:38 [PATCH 3/4] input: wacom - use switch statement for wacom_tpc_irq() Ping Cheng
2011-12-19  1:23 ` Chris Bagwell

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).