From: Andrew Duggan <aduggan@synaptics.com> To: <linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org> Cc: Andrew Duggan <aduggan@synaptics.com>, Jiri Kosina <jkosina@suse.cz>, Benjamin Tissoires <benjamin.tissoires@redhat.com> Subject: [PATCH v2 2/3] HID: rmi: Support touchpads with external buttons Date: Thu, 8 Jan 2015 14:51:34 -0800 [thread overview] Message-ID: <1420757496-3955-1-git-send-email-aduggan@synaptics.com> (raw) 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. Unfortunately, there is no way to query the touchpad to determine that it has pass through buttons so the RMI_DEVICE_HAS_PHYS_BUTTONS should be set manually when adding the device to rmi_id[]. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> --- Here is the second version of the remaining patches in this patch series from last month. The most significant changes are setting the HAS_PHYS_BUTTONS flags in driver_data and avoiding reset being called with every button press. drivers/hid/hid-rmi.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 018f80f..290f8f7 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,15 @@ 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 (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) { + if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) + return 0; + + if ((usage->hid == HID_GD_X || usage->hid == HID_GD_Y) + && !value) + return 1; + } + rmi_schedule_reset(hdev); return 1; } @@ -942,8 +952,13 @@ 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) + if (data->device_flags & RMI_DEVICE) { + if ((data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) && + ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)) + return 0; + return -1; + } return 0; } @@ -991,6 +1006,9 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) return ret; } + if (id->driver_data) + data->device_flags = id->driver_data; + /* * Check for the RMI specific report ids. If they are misisng * simply return and let the events be processed by hid-input -- 2.1.0
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Duggan <aduggan@synaptics.com> To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andrew Duggan <aduggan@synaptics.com>, Jiri Kosina <jkosina@suse.cz>, Benjamin Tissoires <benjamin.tissoires@redhat.com> Subject: [PATCH v2 2/3] HID: rmi: Support touchpads with external buttons Date: Thu, 8 Jan 2015 14:51:34 -0800 [thread overview] Message-ID: <1420757496-3955-1-git-send-email-aduggan@synaptics.com> (raw) 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. Unfortunately, there is no way to query the touchpad to determine that it has pass through buttons so the RMI_DEVICE_HAS_PHYS_BUTTONS should be set manually when adding the device to rmi_id[]. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> --- Here is the second version of the remaining patches in this patch series from last month. The most significant changes are setting the HAS_PHYS_BUTTONS flags in driver_data and avoiding reset being called with every button press. drivers/hid/hid-rmi.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 018f80f..290f8f7 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,15 @@ 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 (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) { + if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) + return 0; + + if ((usage->hid == HID_GD_X || usage->hid == HID_GD_Y) + && !value) + return 1; + } + rmi_schedule_reset(hdev); return 1; } @@ -942,8 +952,13 @@ 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) + if (data->device_flags & RMI_DEVICE) { + if ((data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) && + ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)) + return 0; + return -1; + } return 0; } @@ -991,6 +1006,9 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) return ret; } + if (id->driver_data) + data->device_flags = id->driver_data; + /* * Check for the RMI specific report ids. If they are misisng * simply return and let the events be processed by hid-input -- 2.1.0
next reply other threads:[~2015-01-08 22:53 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-01-08 22:51 Andrew Duggan [this message] 2015-01-08 22:51 ` [PATCH v2 2/3] HID: rmi: Support touchpads with external buttons Andrew Duggan 2015-01-08 22:51 ` [PATCH v2 3/3] HID: rmi: Add support for the touchpad in the Razer Blade 14 laptop Andrew Duggan 2015-01-08 22:51 ` Andrew Duggan 2015-01-12 9:14 ` Jiri Kosina 2015-01-08 22:51 ` [PATCH] HID: rmi: Use hid_report_len to compute the size of reports Andrew Duggan 2015-01-08 22:51 ` Andrew Duggan 2015-01-12 9:14 ` Jiri Kosina 2015-01-12 9:14 ` [PATCH v2 2/3] HID: rmi: Support touchpads with external buttons 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=1420757496-3955-1-git-send-email-aduggan@synaptics.com \ --to=aduggan@synaptics.com \ --cc=benjamin.tissoires@redhat.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.