Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1712861 > unrolled thread
| Started by | Maxime Bellengé <maxime.bellenge@gmail.com> |
|---|---|
| First post | 2017-08-16 13:50 +0200 |
| Last post | 2017-08-17 16:40 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] Input: elan_i2c - Make hardware buttons work properly on Asus ROG G752xx Maxime Bellengé <maxime.bellenge@gmail.com> - 2017-08-16 13:50 +0200
Re: [PATCH] Input: elan_i2c - Make hardware buttons work properly on Asus ROG G752xx Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-08-16 20:30 +0200
RE: [PATCH] Input: elan_i2c - Make hardware buttons work properly on Asus ROG G752xx 廖崇榮 <kt.liao@emc.com.tw> - 2017-08-17 16:40 +0200
| From | Maxime Bellengé <maxime.bellenge@gmail.com> |
|---|---|
| Date | 2017-08-16 13:50 +0200 |
| Subject | [PATCH] Input: elan_i2c - Make hardware buttons work properly on Asus ROG G752xx |
| Message-ID | <uf4ZI-6ww-17@gated-at.bofh.it> |
Asus ROG G752xx laptops have hardware buttons. Currently only the left button works if a finger touches the pad which is not very convenient.
I couldn't find a clear pattern based on ic type and product id to determine if the device has hardware buttons or if it is a clickpad as it is vendor dependant. So I chose to base the patch on dmi as I couldn't find any other laptop based on elan i2c and having hardware buttons.
Signed-off-by: Maxime Bellengé <maxime.bellenge@gmail.com>
---
drivers/input/mouse/elan_i2c_core.c | 40 ++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index 3b616cb7c67f..fa417105898f 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -37,6 +37,7 @@
#include <linux/of.h>
#include <linux/regulator/consumer.h>
#include <asm/unaligned.h>
+#include <linux/dmi.h>
#include "elan_i2c.h"
@@ -923,6 +924,7 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)
}
input_report_key(input, BTN_LEFT, tp_info & 0x01);
+ input_report_key(input, BTN_RIGHT, tp_info & 0x02);
input_report_abs(input, ABS_DISTANCE, hover_event != 0);
input_mt_report_pointer_emulation(input, true);
input_sync(input);
@@ -960,6 +962,39 @@ static irqreturn_t elan_isr(int irq, void *dev_id)
}
/*
+ * Asus ROG G752xx have hardware buttons
+ */
+ static const struct dmi_system_id elan_dmi_has_hw_buttons[] = {
+ #if defined(CONFIG_DMI) && defined(CONFIG_X86)
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "G752VT"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "G752VS"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "G752VY"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "G752VL"),
+ },
+ },
+ #endif
+ { }
+ };
+
+/*
******************************************************************
* Elan initialization functions
******************************************************************
@@ -991,7 +1026,10 @@ static int elan_setup_input_device(struct elan_tp_data *data)
__set_bit(EV_ABS, input->evbit);
__set_bit(INPUT_PROP_POINTER, input->propbit);
- __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
+ if (dmi_check_system(elan_dmi_has_hw_buttons)) {
+ __set_bit(BTN_RIGHT, input->keybit);
+ } else
+ __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
__set_bit(BTN_LEFT, input->keybit);
/* Set up ST parameters */
--
2.13.5
[toc] | [next] | [standalone]
| From | Dmitry Torokhov <dmitry.torokhov@gmail.com> |
|---|---|
| Date | 2017-08-16 20:30 +0200 |
| Subject | Re: [PATCH] Input: elan_i2c - Make hardware buttons work properly on Asus ROG G752xx |
| Message-ID | <ufbeP-25d-47@gated-at.bofh.it> |
| In reply to | #1712861 |
On Wed, Aug 16, 2017 at 01:45:13PM +0200, Maxime Bellengé wrote:
> Asus ROG G752xx laptops have hardware buttons. Currently only the left
> button works if a finger touches the pad which is not very convenient.
>
> I couldn't find a clear pattern based on ic type and product id to
> determine if the device has hardware buttons or if it is a clickpad as
> it is vendor dependant. So I chose to base the patch on dmi as I
> couldn't find any other laptop based on elan i2c and having hardware
> buttons.
>
KT, any feedback here?
> Signed-off-by: Maxime Bellengé <maxime.bellenge@gmail.com>
> ---
> drivers/input/mouse/elan_i2c_core.c | 40 ++++++++++++++++++++++++++++++++++++-
> 1 file changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
> index 3b616cb7c67f..fa417105898f 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -37,6 +37,7 @@
> #include <linux/of.h>
> #include <linux/regulator/consumer.h>
> #include <asm/unaligned.h>
> +#include <linux/dmi.h>
>
> #include "elan_i2c.h"
>
> @@ -923,6 +924,7 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)
> }
>
> input_report_key(input, BTN_LEFT, tp_info & 0x01);
> + input_report_key(input, BTN_RIGHT, tp_info & 0x02);
> input_report_abs(input, ABS_DISTANCE, hover_event != 0);
> input_mt_report_pointer_emulation(input, true);
> input_sync(input);
> @@ -960,6 +962,39 @@ static irqreturn_t elan_isr(int irq, void *dev_id)
> }
>
> /*
> + * Asus ROG G752xx have hardware buttons
> + */
> + static const struct dmi_system_id elan_dmi_has_hw_buttons[] = {
> + #if defined(CONFIG_DMI) && defined(CONFIG_X86)
> + {
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
> + DMI_MATCH(DMI_PRODUCT_NAME, "G752VT"),
> + },
> + },
> + {
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
> + DMI_MATCH(DMI_PRODUCT_NAME, "G752VS"),
> + },
> + },
> + {
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
> + DMI_MATCH(DMI_PRODUCT_NAME, "G752VY"),
> + },
> + },
> + {
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
> + DMI_MATCH(DMI_PRODUCT_NAME, "G752VL"),
> + },
> + },
> + #endif
> + { }
> + };
> +
> +/*
> ******************************************************************
> * Elan initialization functions
> ******************************************************************
> @@ -991,7 +1026,10 @@ static int elan_setup_input_device(struct elan_tp_data *data)
>
> __set_bit(EV_ABS, input->evbit);
> __set_bit(INPUT_PROP_POINTER, input->propbit);
> - __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
> + if (dmi_check_system(elan_dmi_has_hw_buttons)) {
> + __set_bit(BTN_RIGHT, input->keybit);
> + } else
> + __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
> __set_bit(BTN_LEFT, input->keybit);
>
> /* Set up ST parameters */
> --
> 2.13.5
>
--
Dmitry
[toc] | [prev] | [next] | [standalone]
| From | 廖崇榮 <kt.liao@emc.com.tw> |
|---|---|
| Date | 2017-08-17 16:40 +0200 |
| Message-ID | <ufu7M-67i-23@gated-at.bofh.it> |
| In reply to | #1713220 |
[Multipart message — attachments visible in raw view] — view raw
-----Original Message-----
From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
Sent: Thursday, August 17, 2017 2:27 AM
To: Maxime Bellengé; KT Liao
Cc: linux-input@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: elan_i2c - Make hardware buttons work properly
on Asus ROG G752xx
On Wed, Aug 16, 2017 at 01:45:13PM +0200, Maxime Bellengé wrote:
> Asus ROG G752xx laptops have hardware buttons. Currently only the left
> button works if a finger touches the pad which is not very convenient.
>
> I couldn't find a clear pattern based on ic type and product id to
> determine if the device has hardware buttons or if it is a clickpad as
> it is vendor dependant. So I chose to base the patch on dmi as I
> couldn't find any other laptop based on elan i2c and having hardware
> buttons.
>
KT, any feedback here?
Basically, I think it's ok to use DMI_MATCH because
(1) It's rare to see such kind of platform.
(2) Only one file need to be modified
We have a command to get button type.
I quickly make a patch as attached file but I don't have the platform to
test it now.
It would be great if Maxime can help to try it. Or I will test it and
upstream next week.
thanks
> Signed-off-by: Maxime Bellengé <maxime.bellenge@gmail.com>
> ---
> drivers/input/mouse/elan_i2c_core.c | 40
> ++++++++++++++++++++++++++++++++++++-
> 1 file changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/mouse/elan_i2c_core.c
> b/drivers/input/mouse/elan_i2c_core.c
> index 3b616cb7c67f..fa417105898f 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -37,6 +37,7 @@
> #include <linux/of.h>
> #include <linux/regulator/consumer.h> #include <asm/unaligned.h>
> +#include <linux/dmi.h>
>
> #include "elan_i2c.h"
>
> @@ -923,6 +924,7 @@ static void elan_report_absolute(struct elan_tp_data
*data, u8 *packet)
> }
>
> input_report_key(input, BTN_LEFT, tp_info & 0x01);
> + input_report_key(input, BTN_RIGHT, tp_info & 0x02);
> input_report_abs(input, ABS_DISTANCE, hover_event != 0);
> input_mt_report_pointer_emulation(input, true);
> input_sync(input);
> @@ -960,6 +962,39 @@ static irqreturn_t elan_isr(int irq, void
> *dev_id) }
>
> /*
> + * Asus ROG G752xx have hardware buttons */ static const struct
> + dmi_system_id elan_dmi_has_hw_buttons[] = { #if defined(CONFIG_DMI)
> + && defined(CONFIG_X86)
> + {
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
> + DMI_MATCH(DMI_PRODUCT_NAME, "G752VT"),
> + },
> + },
> + {
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
> + DMI_MATCH(DMI_PRODUCT_NAME, "G752VS"),
> + },
> + },
> + {
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
> + DMI_MATCH(DMI_PRODUCT_NAME, "G752VY"),
> + },
> + },
> + {
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
> + DMI_MATCH(DMI_PRODUCT_NAME, "G752VL"),
> + },
> + },
> + #endif
> + { }
> + };
> +
> +/*
> ******************************************************************
> * Elan initialization functions
> ******************************************************************
> @@ -991,7 +1026,10 @@ static int elan_setup_input_device(struct
> elan_tp_data *data)
>
> __set_bit(EV_ABS, input->evbit);
> __set_bit(INPUT_PROP_POINTER, input->propbit);
> - __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
> + if (dmi_check_system(elan_dmi_has_hw_buttons)) {
> + __set_bit(BTN_RIGHT, input->keybit);
> + } else
> + __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
> __set_bit(BTN_LEFT, input->keybit);
>
> /* Set up ST parameters */
> --
> 2.13.5
>
--
Dmitry
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web