linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Andrew Duggan <aduggan@synaptics.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jiri Kosina <jkosina@suse.cz>
Subject: Re: [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12.
Date: Tue, 15 Jul 2014 15:07:02 -0400	[thread overview]
Message-ID: <20140715190702.GB21045@mail.corp.redhat.com> (raw)
In-Reply-To: <1405114551-24354-1-git-send-email-aduggan@synaptics.com>

On Jul 11 2014 or thereabouts, Andrew Duggan wrote:
> There are additional queries which are optional and may not be present depending on the configuration of the firmware. Knowing which queries are present is needed to properly compute the address of Query 12 and all subsequent queries. Additional bits in Query 1 are used to indicate the presence of these optional queries.
> 
> Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
> ---

Looks good to me

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

>  drivers/hid/hid-rmi.c | 35 +++++++++++++++++++++++++----------
>  1 file changed, 25 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
> index 578bbe6..3221a95 100644
> --- a/drivers/hid/hid-rmi.c
> +++ b/drivers/hid/hid-rmi.c
> @@ -549,10 +549,12 @@ static int rmi_populate_f11(struct hid_device *hdev)
>  	u8 buf[20];
>  	int ret;
>  	bool has_query9;
> -	bool has_query10;
> +	bool has_query10 = false;
>  	bool has_query11;
>  	bool has_query12;
>  	bool has_physical_props;
> +	bool has_gestures;
> +	bool has_rel;
>  	unsigned x_size, y_size;
>  	u16 query12_offset;
>  
> @@ -589,19 +591,32 @@ static int rmi_populate_f11(struct hid_device *hdev)
>  		return -ENODEV;
>  	}
>  
> -	/* query 8 to find out if query 10 exists */
> -	ret = rmi_read(hdev, data->f11.query_base_addr + 8, buf);
> -	if (ret) {
> -		hid_err(hdev, "can not read gesture information: %d.\n", ret);
> -		return ret;
> +	has_rel = !!(buf[0] & BIT(3));
> +	has_gestures = !!(buf[0] & BIT(5));
> +
> +	if (has_gestures) {
> +		/* query 8 to find out if query 10 exists */
> +		ret = rmi_read(hdev, data->f11.query_base_addr + 8, buf);
> +		if (ret) {
> +			hid_err(hdev, "can not read gesture information: %d.\n",
> +				ret);
> +			return ret;
> +		}
> +		has_query10 = !!(buf[0] & BIT(2));
>  	}
> -	has_query10 = !!(buf[0] & BIT(2));
>  
>  	/*
> -	 * At least 8 queries are guaranteed to be present in F11
> -	 * +1 for query12.
> +	 * At least 4 queries are guaranteed to be present in F11
> +	 * +1 for query 5 which is present since absolute events are
> +	 * reported and +1 for query 12.
>  	 */
> -	query12_offset = 9;
> +	query12_offset = 6;
> +
> +	if (has_rel)
> +		++query12_offset; /* query 6 is present */
> +
> +	if (has_gestures)
> +		query12_offset += 2; /* query 7 and 8 are present */
>  
>  	if (has_query9)
>  		++query12_offset;
> -- 
> 1.9.1
> 

  parent reply	other threads:[~2014-07-15 19:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 21:35 [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12 Andrew Duggan
2014-07-11 21:35 ` [PATCH] HID: rmi: change logging level of log messages related to unexpected reports Andrew Duggan
2014-07-15 19:07   ` Benjamin Tissoires  
2014-07-29  9:10     ` Jiri Kosina
2014-07-15 19:07 ` Benjamin Tissoires [this message]
2014-07-29  9:10   ` [PATCH] HID: rmi: add additional checks for the existence of optional queries in order to compute the address of Query 12 Jiri Kosina

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=20140715190702.GB21045@mail.corp.redhat.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=aduggan@synaptics.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).