* [PATCH] Input - elantech: force a resolution of 31 u/mm
@ 2015-07-10 0:32 Peter Hutterer
2015-07-10 6:57 ` Hans de Goede
2015-07-14 17:59 ` David Herrmann
0 siblings, 2 replies; 4+ messages in thread
From: Peter Hutterer @ 2015-07-10 0:32 UTC (permalink / raw)
To: linux-input, linux-kernel
Cc: Dmitry Torokhov, Hans de Goede, Benjamin Tissoires, Duson Lin
All Elantech touchpads pre-v4 with dynamic resolution queries have a fixed
resolution of 800dpi -> 31.49 units/mm. Set this statically, so userspace does
not have to guess.
Cc: Duson Lin <dusonlin@emc.com.tw>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
drivers/input/mouse/elantech.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index ce3d400..22b9ca9 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1167,7 +1167,7 @@ static int elantech_set_input_params(struct psmouse *psmouse)
struct input_dev *dev = psmouse->dev;
struct elantech_data *etd = psmouse->private;
unsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0, width = 0;
- unsigned int x_res = 0, y_res = 0;
+ unsigned int x_res = 31, y_res = 31;
if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width))
return -1;
@@ -1232,8 +1232,6 @@ static int elantech_set_input_params(struct psmouse *psmouse)
/* For X to recognize me as touchpad. */
input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0);
input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0);
- input_abs_set_res(dev, ABS_X, x_res);
- input_abs_set_res(dev, ABS_Y, y_res);
/*
* range of pressure and width is the same as v2,
* report ABS_PRESSURE, ABS_TOOL_WIDTH for compatibility.
@@ -1246,8 +1244,6 @@ static int elantech_set_input_params(struct psmouse *psmouse)
input_mt_init_slots(dev, ETP_MAX_FINGERS, 0);
input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0);
input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0);
- input_abs_set_res(dev, ABS_MT_POSITION_X, x_res);
- input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res);
input_set_abs_params(dev, ABS_MT_PRESSURE, ETP_PMIN_V2,
ETP_PMAX_V2, 0, 0);
/*
@@ -1259,6 +1255,13 @@ static int elantech_set_input_params(struct psmouse *psmouse)
break;
}
+ input_abs_set_res(dev, ABS_X, x_res);
+ input_abs_set_res(dev, ABS_Y, y_res);
+ if (etd->hw_version > 1) {
+ input_abs_set_res(dev, ABS_MT_POSITION_X, x_res);
+ input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res);
+ }
+
etd->y_max = y_max;
etd->width = width;
--
2.4.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Input - elantech: force a resolution of 31 u/mm
2015-07-10 0:32 [PATCH] Input - elantech: force a resolution of 31 u/mm Peter Hutterer
@ 2015-07-10 6:57 ` Hans de Goede
2015-07-14 17:59 ` David Herrmann
1 sibling, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2015-07-10 6:57 UTC (permalink / raw)
To: Peter Hutterer, linux-input, linux-kernel
Cc: Dmitry Torokhov, Benjamin Tissoires, Duson Lin
Hi,
On 10-07-15 02:32, Peter Hutterer wrote:
> All Elantech touchpads pre-v4 with dynamic resolution queries have a fixed
> resolution of 800dpi -> 31.49 units/mm. Set this statically, so userspace does
> not have to guess.
>
> Cc: Duson Lin <dusonlin@emc.com.tw>
> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ah I was planning on writing the same patch today, looks like you've
beat me to it :)
Patch looks good:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
> ---
> drivers/input/mouse/elantech.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
> index ce3d400..22b9ca9 100644
> --- a/drivers/input/mouse/elantech.c
> +++ b/drivers/input/mouse/elantech.c
> @@ -1167,7 +1167,7 @@ static int elantech_set_input_params(struct psmouse *psmouse)
> struct input_dev *dev = psmouse->dev;
> struct elantech_data *etd = psmouse->private;
> unsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0, width = 0;
> - unsigned int x_res = 0, y_res = 0;
> + unsigned int x_res = 31, y_res = 31;
>
> if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width))
> return -1;
> @@ -1232,8 +1232,6 @@ static int elantech_set_input_params(struct psmouse *psmouse)
> /* For X to recognize me as touchpad. */
> input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0);
> input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0);
> - input_abs_set_res(dev, ABS_X, x_res);
> - input_abs_set_res(dev, ABS_Y, y_res);
> /*
> * range of pressure and width is the same as v2,
> * report ABS_PRESSURE, ABS_TOOL_WIDTH for compatibility.
> @@ -1246,8 +1244,6 @@ static int elantech_set_input_params(struct psmouse *psmouse)
> input_mt_init_slots(dev, ETP_MAX_FINGERS, 0);
> input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0);
> input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0);
> - input_abs_set_res(dev, ABS_MT_POSITION_X, x_res);
> - input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res);
> input_set_abs_params(dev, ABS_MT_PRESSURE, ETP_PMIN_V2,
> ETP_PMAX_V2, 0, 0);
> /*
> @@ -1259,6 +1255,13 @@ static int elantech_set_input_params(struct psmouse *psmouse)
> break;
> }
>
> + input_abs_set_res(dev, ABS_X, x_res);
> + input_abs_set_res(dev, ABS_Y, y_res);
> + if (etd->hw_version > 1) {
> + input_abs_set_res(dev, ABS_MT_POSITION_X, x_res);
> + input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res);
> + }
> +
> etd->y_max = y_max;
> etd->width = width;
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Input - elantech: force a resolution of 31 u/mm
2015-07-10 0:32 [PATCH] Input - elantech: force a resolution of 31 u/mm Peter Hutterer
2015-07-10 6:57 ` Hans de Goede
@ 2015-07-14 17:59 ` David Herrmann
2015-07-16 17:40 ` Dmitry Torokhov
1 sibling, 1 reply; 4+ messages in thread
From: David Herrmann @ 2015-07-14 17:59 UTC (permalink / raw)
To: Peter Hutterer
Cc: open list:HID CORE LAYER, linux-kernel, Dmitry Torokhov,
Hans de Goede, Benjamin Tissoires, Duson Lin
Hi
On Fri, Jul 10, 2015 at 2:32 AM, Peter Hutterer
<peter.hutterer@who-t.net> wrote:
> All Elantech touchpads pre-v4 with dynamic resolution queries have a fixed
> resolution of 800dpi -> 31.49 units/mm. Set this statically, so userspace does
> not have to guess.
>
> Cc: Duson Lin <dusonlin@emc.com.tw>
> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
> ---
> drivers/input/mouse/elantech.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
I think this is much nicer than having to work around this in
user-space. Much appreciated!
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Thanks
David
> diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
> index ce3d400..22b9ca9 100644
> --- a/drivers/input/mouse/elantech.c
> +++ b/drivers/input/mouse/elantech.c
> @@ -1167,7 +1167,7 @@ static int elantech_set_input_params(struct psmouse *psmouse)
> struct input_dev *dev = psmouse->dev;
> struct elantech_data *etd = psmouse->private;
> unsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0, width = 0;
> - unsigned int x_res = 0, y_res = 0;
> + unsigned int x_res = 31, y_res = 31;
>
> if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width))
> return -1;
> @@ -1232,8 +1232,6 @@ static int elantech_set_input_params(struct psmouse *psmouse)
> /* For X to recognize me as touchpad. */
> input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0);
> input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0);
> - input_abs_set_res(dev, ABS_X, x_res);
> - input_abs_set_res(dev, ABS_Y, y_res);
> /*
> * range of pressure and width is the same as v2,
> * report ABS_PRESSURE, ABS_TOOL_WIDTH for compatibility.
> @@ -1246,8 +1244,6 @@ static int elantech_set_input_params(struct psmouse *psmouse)
> input_mt_init_slots(dev, ETP_MAX_FINGERS, 0);
> input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0);
> input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0);
> - input_abs_set_res(dev, ABS_MT_POSITION_X, x_res);
> - input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res);
> input_set_abs_params(dev, ABS_MT_PRESSURE, ETP_PMIN_V2,
> ETP_PMAX_V2, 0, 0);
> /*
> @@ -1259,6 +1255,13 @@ static int elantech_set_input_params(struct psmouse *psmouse)
> break;
> }
>
> + input_abs_set_res(dev, ABS_X, x_res);
> + input_abs_set_res(dev, ABS_Y, y_res);
> + if (etd->hw_version > 1) {
> + input_abs_set_res(dev, ABS_MT_POSITION_X, x_res);
> + input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res);
> + }
> +
> etd->y_max = y_max;
> etd->width = width;
>
> --
> 2.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Input - elantech: force a resolution of 31 u/mm
2015-07-14 17:59 ` David Herrmann
@ 2015-07-16 17:40 ` Dmitry Torokhov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2015-07-16 17:40 UTC (permalink / raw)
To: David Herrmann
Cc: Peter Hutterer, open list:HID CORE LAYER, linux-kernel,
Hans de Goede, Benjamin Tissoires, Duson Lin
On Tue, Jul 14, 2015 at 07:59:47PM +0200, David Herrmann wrote:
> Hi
>
> On Fri, Jul 10, 2015 at 2:32 AM, Peter Hutterer
> <peter.hutterer@who-t.net> wrote:
> > All Elantech touchpads pre-v4 with dynamic resolution queries have a fixed
> > resolution of 800dpi -> 31.49 units/mm. Set this statically, so userspace does
> > not have to guess.
> >
> > Cc: Duson Lin <dusonlin@emc.com.tw>
> > Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
> > ---
> > drivers/input/mouse/elantech.c | 13 ++++++++-----
> > 1 file changed, 8 insertions(+), 5 deletions(-)
>
> I think this is much nicer than having to work around this in
> user-space. Much appreciated!
>
> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-16 17:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-10 0:32 [PATCH] Input - elantech: force a resolution of 31 u/mm Peter Hutterer
2015-07-10 6:57 ` Hans de Goede
2015-07-14 17:59 ` David Herrmann
2015-07-16 17:40 ` Dmitry Torokhov
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).