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 2/3] HID: rmi: Support touchpads with external buttons
Date: Fri, 19 Dec 2014 20:53:31 -0500	[thread overview]
Message-ID: <20141220015331.GD32189@mail.corp.redhat.com> (raw)
In-Reply-To: <1419029143-20484-2-git-send-email-aduggan@synaptics.com>

On Dec 19 2014 or thereabouts, Andrew Duggan wrote:
> The external buttons on HID touchpads are connected as pass through devices and
> button events are not reported in the rmi registers. As a result on these
> devices we need to allow the HID generic desktop button events to be processed
> by hid-input.
> 
> Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
> ---

Just to be sure, could you also add in the commit message that the flag
RMI_DEVICE_HAS_PHYS_BUTTONS is not auto-detected by the driver and that
it has to be added manually when adding a device to rmi_id[].

BTW, you can use .driver_data in in struct hid_device_id to pass the
flags directly. So here, it would be nice to add such retrieval in
probe:
data->device_flags = id->driver_data;
and then check for RMI_DEVICE.

>  drivers/hid/hid-rmi.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
> index 018f80f..cdfe165 100644
> --- a/drivers/hid/hid-rmi.c
> +++ b/drivers/hid/hid-rmi.c
> @@ -35,6 +35,7 @@
>  
>  /* device flags */
>  #define RMI_DEVICE			BIT(0)
> +#define RMI_DEVICE_HAS_PHYS_BUTTONS	BIT(1)
>  
>  enum rmi_mode_type {
>  	RMI_MODE_OFF			= 0,
> @@ -472,6 +473,9 @@ static int rmi_event(struct hid_device *hdev, struct hid_field *field,
>  	if ((data->device_flags & RMI_DEVICE) &&
>  	    (field->application == HID_GD_POINTER ||
>  	    field->application == HID_GD_MOUSE)) {
> +		if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)
> +			return 0;
> +
>  		rmi_schedule_reset(hdev);

I think here you will get a reset for each button press. I believe the
mouse collection is pretty generic and you should also get the relX|Y
events with the button press.

>  		return 1;
>  	}
> @@ -942,6 +946,10 @@ static int rmi_input_mapping(struct hid_device *hdev,
>  	 * we want to make HID ignore the advertised HID collection
>  	 * for RMI deivces
>  	 */
> +	if ((data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) &&
> +	    ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON))
> +		return 0;
> +
>  	if (data->device_flags & RMI_DEVICE)
>  		return -1;
>  
> -- 
> 2.1.0
> 

Cheers,
Benjamin


  reply	other threads:[~2014-12-20  1:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19 22:45 [PATCH 1/3] HID: rmi: Support non rmi devices by passing events to hid-input Andrew Duggan
2014-12-19 22:45 ` [PATCH 2/3] HID: rmi: Support touchpads with external buttons Andrew Duggan
2014-12-20  1:53   ` Benjamin Tissoires [this message]
2014-12-19 22:45 ` [PATCH 3/3] HID: rmi: Add support for the touchpad in the Razer Blade 14 laptop Andrew Duggan
2014-12-20  1:56   ` Benjamin Tissoires
2014-12-20  1:42 ` [PATCH 1/3] HID: rmi: Support non rmi devices by passing events to hid-input Benjamin Tissoires
2014-12-22 13:24 ` 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=20141220015331.GD32189@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).