linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4 v3] input: wacom - make sure touch_max is set for touch devices
@ 2013-11-15 19:59 Ping Cheng
  2013-11-15 21:31 ` Chris Bagwell
  0 siblings, 1 reply; 2+ messages in thread
From: Ping Cheng @ 2013-11-15 19:59 UTC (permalink / raw)
  To: linux-input
  Cc: dmitry.torokhov, killertofu, chris, peter.hutterer, Ping Cheng

Old single touch Tablet PCs do not have touch_max set at
wacom_features. Since touch device at lease supports one
finger, assign touch_max to 1 when touch usage is defined
in its HID Descriptor and touch_max is not pre-defined.

Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Ping Cheng <pingc@wacom.com>
---
 drivers/input/tablet/wacom_sys.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 8a90da1..3d71b60 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -304,7 +304,7 @@ static int wacom_parse_hid(struct usb_interface *intf,
 	struct usb_device *dev = interface_to_usbdev(intf);
 	char limit = 0;
 	/* result has to be defined as int for some devices */
-	int result = 0;
+	int result = 0, touch_max = 0;
 	int i = 0, usage = WCM_UNDEFINED, finger = 0, pen = 0;
 	unsigned char *report;
 
@@ -351,7 +351,8 @@ static int wacom_parse_hid(struct usb_interface *intf,
 				if (usage == WCM_DESKTOP) {
 					if (finger) {
 						features->device_type = BTN_TOOL_FINGER;
-
+						/* touch device at least supports one touch point */
+						touch_max = 1;
 						switch (features->type) {
 						case TABLETPC2FG:
 							features->pktlen = WACOM_PKGLEN_TPC2FG;
@@ -504,6 +505,8 @@ static int wacom_parse_hid(struct usb_interface *intf,
 	}
 
  out:
+	if (!features->touch_max && touch_max)
+		features->touch_max = touch_max;
 	result = 0;
 	kfree(report);
 	return result;
-- 
1.8.3.2


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

* Re: [PATCH 2/4 v3] input: wacom - make sure touch_max is set for touch devices
  2013-11-15 19:59 [PATCH 2/4 v3] input: wacom - make sure touch_max is set for touch devices Ping Cheng
@ 2013-11-15 21:31 ` Chris Bagwell
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Bagwell @ 2013-11-15 21:31 UTC (permalink / raw)
  To: Ping Cheng
  Cc: linux-input@vger.kernel.org, Dmitry Torokhov, Jason Gerecke,
	Peter Hutterer, Ping Cheng

On Fri, Nov 15, 2013 at 1:59 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> Old single touch Tablet PCs do not have touch_max set at
> wacom_features. Since touch device at lease supports one
> finger, assign touch_max to 1 when touch usage is defined
> in its HID Descriptor and touch_max is not pre-defined.

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

>
> Tested-by: Jason Gerecke <killertofu@gmail.com>
> Signed-off-by: Ping Cheng <pingc@wacom.com>
> ---
>  drivers/input/tablet/wacom_sys.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index 8a90da1..3d71b60 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -304,7 +304,7 @@ static int wacom_parse_hid(struct usb_interface *intf,
>         struct usb_device *dev = interface_to_usbdev(intf);
>         char limit = 0;
>         /* result has to be defined as int for some devices */
> -       int result = 0;
> +       int result = 0, touch_max = 0;
>         int i = 0, usage = WCM_UNDEFINED, finger = 0, pen = 0;
>         unsigned char *report;
>
> @@ -351,7 +351,8 @@ static int wacom_parse_hid(struct usb_interface *intf,
>                                 if (usage == WCM_DESKTOP) {
>                                         if (finger) {
>                                                 features->device_type = BTN_TOOL_FINGER;
> -
> +                                               /* touch device at least supports one touch point */
> +                                               touch_max = 1;
>                                                 switch (features->type) {
>                                                 case TABLETPC2FG:
>                                                         features->pktlen = WACOM_PKGLEN_TPC2FG;
> @@ -504,6 +505,8 @@ static int wacom_parse_hid(struct usb_interface *intf,
>         }
>
>   out:
> +       if (!features->touch_max && touch_max)
> +               features->touch_max = touch_max;
>         result = 0;
>         kfree(report);
>         return result;
> --
> 1.8.3.2
>

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

end of thread, other threads:[~2013-11-15 21:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-15 19:59 [PATCH 2/4 v3] input: wacom - make sure touch_max is set for touch devices Ping Cheng
2013-11-15 21:31 ` 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).