Input - elantech: force a resolution of 31 u/mm
Subsystems (2)
PATCH 1/1 Input - elantech: force a resolution of 31 u/mm
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.
--- drivers/input/mouse/elantech.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/input/mouse/elantech.c +8 -5
@@ -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;
Signature · 1 line
2.4.3
Hi,
Quoted 6 lines · Peter Hutterer
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 <[email protected]>Signed-off-by Peter Hutterer <[email protected]>
Ah I was planning on writing the same patch today, looks like you've beat me to it :)
Patch looks good:
Regards,
Hans
Quoted 50 lines
--- drivers/input/mouse/elantech.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)drivers/input/mouse/elantech.c +8
-5@@ -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;
Hi
Quoted 9 lines · Peter Hutterer
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 <[email protected]>Signed-off-by Peter Hutterer <[email protected]>--- 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!
Thanks
David
Quoted 52 lines
drivers/input/mouse/elantech.c +8
-6@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 14 lines · David Herrmann
Hi
Quoted 9 lines · Peter Hutterer
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 <[email protected]>Signed-off-by Peter Hutterer <[email protected]>--- drivers/input/mouse/elantech.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
Quoted 4 lines
I think this is much nicer than having to work around this in user-space. Much appreciated!
Reviewed-by David Herrmann <[email protected]>
Applied, thank you.
Signature · 1 line
Dmitry