diff mbox

[2/3] Input: wacom - Don't declare ABS_X/Y for multitouch

Message ID 1401232687-9738-1-git-send-email-pingc@wacom.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ping Cheng May 27, 2014, 11:18 p.m. UTC
We use ABS_MT_POSITION_X/Y for multitouch (touch_max > 1) events now.
No need to declare ABS_X/Y for touch_max == 2 any more.

Signed-off-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
---
 drivers/input/tablet/wacom_wac.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Dmitry Torokhov May 29, 2014, 7:08 a.m. UTC | #1
On Tue, May 27, 2014 at 04:18:07PM -0700, Ping Cheng wrote:
> We use ABS_MT_POSITION_X/Y for multitouch (touch_max > 1) events now.
> No need to declare ABS_X/Y for touch_max == 2 any more.

This will make legacy clients, such as GPM on text console, very sad.

Thanks.

> 
> Signed-off-by: Ping Cheng <pingc@wacom.com>
> Reviewed-by: Jason Gerecke <killertofu@gmail.com>
> Tested-by: Jason Gerecke <killertofu@gmail.com>
> ---
>  drivers/input/tablet/wacom_wac.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
> index c98e51c..0eb9960 100644
> --- a/drivers/input/tablet/wacom_wac.c
> +++ b/drivers/input/tablet/wacom_wac.c
> @@ -1217,8 +1217,8 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
>  			 * a=(pi*r^2)/C.
>  			 */
>  			int a = data[5];
> -			int x_res  = input_abs_get_res(input, ABS_X);
> -			int y_res  = input_abs_get_res(input, ABS_Y);
> +			int x_res  = input_abs_get_res(input, ABS_MT_POSITION_X);
> +			int y_res  = input_abs_get_res(input, ABS_MT_POSITION_Y);
>  			width  = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE);
>  			height = width * y_res / x_res;
>  		}
> @@ -1587,7 +1587,7 @@ static void wacom_abs_set_axis(struct input_dev *input_dev,
>  		input_abs_set_res(input_dev, ABS_X, features->x_resolution);
>  		input_abs_set_res(input_dev, ABS_Y, features->y_resolution);
>  	} else {
> -		if (features->touch_max <= 2) {
> +		if (features->touch_max == 1) {
>  			input_set_abs_params(input_dev, ABS_X, 0,
>  				features->x_max, features->x_fuzz, 0);
>  			input_set_abs_params(input_dev, ABS_Y, 0,
> -- 
> 1.9.1
>
Ping Cheng May 29, 2014, 5:26 p.m. UTC | #2
On Thu, May 29, 2014 at 12:08 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Tue, May 27, 2014 at 04:18:07PM -0700, Ping Cheng wrote:
>> We use ABS_MT_POSITION_X/Y for multitouch (touch_max > 1) events now.
>> No need to declare ABS_X/Y for touch_max == 2 any more.
>
> This will make legacy clients, such as GPM on text console,

I see your point. But, since copy_abs() is added in
input_mt_init_slots(), which copies ABS_MT_* parameters to ABS_* for
MT (all touch_max >= 2 devices), we do not need to duplicate the same
statements in individual drivers.

> very sad.

It won't upset legacy clients as long as they don't remove copy_abs()
from input-hid.c manually. However, you do have a very good point. It
made me review the relevant code where (touch_max == 2) again. I see
more cleanup needed. I'll make another patch for it.

Ping

>> Signed-off-by: Ping Cheng <pingc@wacom.com>
>> Reviewed-by: Jason Gerecke <killertofu@gmail.com>
>> Tested-by: Jason Gerecke <killertofu@gmail.com>
>> ---
>>  drivers/input/tablet/wacom_wac.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
>> index c98e51c..0eb9960 100644
>> --- a/drivers/input/tablet/wacom_wac.c
>> +++ b/drivers/input/tablet/wacom_wac.c
>> @@ -1217,8 +1217,8 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
>>                        * a=(pi*r^2)/C.
>>                        */
>>                       int a = data[5];
>> -                     int x_res  = input_abs_get_res(input, ABS_X);
>> -                     int y_res  = input_abs_get_res(input, ABS_Y);
>> +                     int x_res  = input_abs_get_res(input, ABS_MT_POSITION_X);
>> +                     int y_res  = input_abs_get_res(input, ABS_MT_POSITION_Y);
>>                       width  = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE);
>>                       height = width * y_res / x_res;
>>               }
>> @@ -1587,7 +1587,7 @@ static void wacom_abs_set_axis(struct input_dev *input_dev,
>>               input_abs_set_res(input_dev, ABS_X, features->x_resolution);
>>               input_abs_set_res(input_dev, ABS_Y, features->y_resolution);
>>       } else {
>> -             if (features->touch_max <= 2) {
>> +             if (features->touch_max == 1) {
>>                       input_set_abs_params(input_dev, ABS_X, 0,
>>                               features->x_max, features->x_fuzz, 0);
>>                       input_set_abs_params(input_dev, ABS_Y, 0,
>> --
>> 1.9.1
>>
>
> --
> Dmitry
--
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
diff mbox

Patch

diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index c98e51c..0eb9960 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1217,8 +1217,8 @@  static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
 			 * a=(pi*r^2)/C.
 			 */
 			int a = data[5];
-			int x_res  = input_abs_get_res(input, ABS_X);
-			int y_res  = input_abs_get_res(input, ABS_Y);
+			int x_res  = input_abs_get_res(input, ABS_MT_POSITION_X);
+			int y_res  = input_abs_get_res(input, ABS_MT_POSITION_Y);
 			width  = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE);
 			height = width * y_res / x_res;
 		}
@@ -1587,7 +1587,7 @@  static void wacom_abs_set_axis(struct input_dev *input_dev,
 		input_abs_set_res(input_dev, ABS_X, features->x_resolution);
 		input_abs_set_res(input_dev, ABS_Y, features->y_resolution);
 	} else {
-		if (features->touch_max <= 2) {
+		if (features->touch_max == 1) {
 			input_set_abs_params(input_dev, ABS_X, 0,
 				features->x_max, features->x_fuzz, 0);
 			input_set_abs_params(input_dev, ABS_Y, 0,