linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Ping Cheng <pinglinux@gmail.com>
Cc: linux-input@vger.kernel.org, Ping Cheng <pingc@wacom.com>
Subject: Re: [PATCH 2/4 v2] input : wacom - retrieve maximum number of touch points
Date: Sat, 28 Jan 2012 23:04:48 -0800	[thread overview]
Message-ID: <20120129070448.GF23595@core.coreip.homeip.net> (raw)
In-Reply-To: <1325717032-6378-1-git-send-email-pinglinux@gmail.com>

On Wed, Jan 04, 2012 at 02:43:52PM -0800, Ping Cheng wrote:
> From the HID usage table when it is supported.
> 
> Tested-by: Chris Bagwell <chris@cnpbagwell.com>
> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
> Signed-off-by: Ping Cheng <pingc@wacom.com>
> ---
> 
> v2: updated with Chris' comments.
> 
>  drivers/input/tablet/wacom_sys.c |   31 ++++++++++++++++++++++++++++++-
>  drivers/input/tablet/wacom_wac.c |   10 ++++------
>  drivers/input/tablet/wacom_wac.h |    1 +
>  3 files changed, 35 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index c9588ee..f7fe091 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -28,6 +28,7 @@
>  #define HID_USAGE_Y_TILT		0x3e
>  #define HID_USAGE_FINGER		0x22
>  #define HID_USAGE_STYLUS		0x20
> +#define HID_USAGE_CONTACTMAX		0x55
>  #define HID_COLLECTION			0xa1
>  #define HID_COLLECTION_LOGICAL		0x02
>  #define HID_COLLECTION_END		0xc0
> @@ -191,11 +192,30 @@ static int wacom_parse_logical_collection(unsigned char *report,
>  		features->x_max = features->y_max =
>  			get_unaligned_le16(&report[10]);
>  
> +		features->touch_max = 16;
>  		length = 11;
>  	}
>  	return length;
>  }
>  
> +static void wacom_retrieve_report_data(struct usb_interface *intf,
> +				       struct wacom_features *features)
> +{
> +	int result = 0;
> +	unsigned char *rep_data;
> +
> +	rep_data = kmalloc(2, GFP_KERNEL);
> +	if (!rep_data)
> +		return;
> +
> +	rep_data[0] = 12;
> +	result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
> +		 rep_data[0], rep_data, 2, WAC_MSG_RETRIES);
> +
> +	if ((result >= 0) && (rep_data[1] > 2))
> +		features->touch_max = rep_data[1];
> +}
> +
>  /*
>   * Interface Descriptor of wacom devices can be incomplete and
>   * inconsistent so wacom_features table is used to store stylus
> @@ -286,16 +306,19 @@ static int wacom_parse_hid(struct usb_interface *intf,
>  						if (features->type == TABLETPC2FG) {
>  							/* need to reset back */
>  							features->pktlen = WACOM_PKGLEN_TPC2FG;
> +							features->touch_max = 2;

Why do we set it dynamically for devices where number of contacts is
constant? Or, even if it is not constant, we could seed it in the
features that we set in driver_info and only adjust when we encounter
HID_USAGE_CONTACTMAX?

Thanks.

-- 
Dmitry

  parent reply	other threads:[~2012-01-29  7:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 22:43 [PATCH 2/4 v2] input : wacom - retrieve maximum number of touch points Ping Cheng
2012-01-28  2:51 ` Chris Bagwell
2012-01-29  7:04 ` Dmitry Torokhov [this message]
2012-01-31  2:08   ` Chris Bagwell
2012-01-31  8:23     ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120129070448.GF23595@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=pingc@wacom.com \
    --cc=pinglinux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).