linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maurus Cuelenaere <mcuelenaere@gmail.com>
To: chris@cnpbagwell.com
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
	Ping Cheng <pinglinux@gmail.com>, Ping Cheng <pingc@wacom.com>
Subject: Re: [PATCH 1/2] input : wacom - retrieve maximum number of touch points
Date: Wed, 01 Feb 2012 12:53:34 +0100	[thread overview]
Message-ID: <4F2927BE.4010905@gmail.com> (raw)
In-Reply-To: <1328069031-16873-1-git-send-email-chris@cnpbagwell.com>

Op 01-02-12 05:03, chris@cnpbagwell.com schreef:
> From: Ping Cheng<pinglinux@gmail.com>
>
>  From the HID usage table when it is supported.
>
> Tested-by: Chris Bagwell<chris@cnpbagwell.com>
> Signed-off-by: Chris Bagwell<chris@cnpbagwell.com>
> Signed-off-by: Ping Cheng<pingc@wacom.com>
> ---
>
> These two patches were originally in a set of 4 from Ping.
> 2 of those 4 have already been committed to next branch.
>
> The change between this version and Ping's last version is
> making use of features to set the new touch_max value.
> The 2nd patch is unmodified.
>
>   drivers/input/tablet/wacom_sys.c |   26 +++++++++++++++++-
>   drivers/input/tablet/wacom_wac.c |   55 +++++++++++++++++++++++--------------
>   drivers/input/tablet/wacom_wac.h |    1 +
>   3 files changed, 60 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index c9588ee..5004a75 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
> @@ -196,6 +197,24 @@ static int wacom_parse_logical_collection(unsigned char *report,
>   	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;

Why not allocate this on the stack?
This also can't leak memory (like you currently do).

> +
> +	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];
> +}
> +

-- 
Maurus Cuelenaere


  parent reply	other threads:[~2012-02-01 11:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-01  4:03 [PATCH 1/2] input : wacom - retrieve maximum number of touch points chris
2012-02-01  4:03 ` [PATCH 2/2] input: wacom - add 0xE5 (MT device) support chris
2012-02-01 11:53 ` Maurus Cuelenaere [this message]
2012-02-01 16:16   ` [PATCH 1/2] input : wacom - retrieve maximum number of touch points Chris Bagwell
  -- strict thread matches above, loose matches on Subject: below --
2012-04-15 22:50 [PATCH 0/2] Add E5 support chris
2012-04-15 22:50 ` [PATCH 1/2] input: wacom - retrieve maximum number of touch points chris
2012-04-21  5:56   ` Dmitry Torokhov
     [not found]     ` <CAF8JNh+t4fnsigjta1xoRQ565NU6+rf8zDDCte=4d68MwdVK6A@mail.gmail.com>
2012-04-25  5:05       ` Dmitry Torokhov
2012-04-26  1:13 Ping Cheng
2012-04-30  4:09 ` 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=4F2927BE.4010905@gmail.com \
    --to=mcuelenaere@gmail.com \
    --cc=chris@cnpbagwell.com \
    --cc=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).