Commit d7da3a3c authored by Ping Cheng's avatar Ping Cheng Committed by Dmitry Torokhov

Input: wacom - cleanup multitouch code when touch_max is 2

Historically we dealt with touch_max equals to 2 differently from
other MT devices. Now we use input_mt_*() to process all MT events,
as long as touch_max is greater than 1. So, there is no need to
take (touch_max == 2) as a special case any more.
Signed-off-by: default avatarPing Cheng <pingc@wacom.com>
Reviewed-by: default avatarJason Gerecke <killertofu@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent a292241c
...@@ -1217,9 +1217,9 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) ...@@ -1217,9 +1217,9 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
* a=(pi*r^2)/C. * a=(pi*r^2)/C.
*/ */
int a = data[5]; int a = data[5];
int x_res = input_abs_get_res(input, ABS_X); int x_res = input_abs_get_res(input, ABS_MT_POSITION_X);
int y_res = input_abs_get_res(input, ABS_Y); int y_res = input_abs_get_res(input, ABS_MT_POSITION_Y);
width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE); width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE);
height = width * y_res / x_res; height = width * y_res / x_res;
} }
...@@ -1587,7 +1587,7 @@ static void wacom_abs_set_axis(struct input_dev *input_dev, ...@@ -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_X, features->x_resolution);
input_abs_set_res(input_dev, ABS_Y, features->y_resolution); input_abs_set_res(input_dev, ABS_Y, features->y_resolution);
} else { } else {
if (features->touch_max <= 2) { if (features->touch_max == 1) {
input_set_abs_params(input_dev, ABS_X, 0, input_set_abs_params(input_dev, ABS_X, 0,
features->x_max, features->x_fuzz, 0); features->x_max, features->x_fuzz, 0);
input_set_abs_params(input_dev, ABS_Y, 0, input_set_abs_params(input_dev, ABS_Y, 0,
...@@ -1815,14 +1815,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, ...@@ -1815,14 +1815,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
case MTTPC: case MTTPC:
case MTTPC_B: case MTTPC_B:
case TABLETPC2FG: case TABLETPC2FG:
if (features->device_type == BTN_TOOL_FINGER) { if (features->device_type == BTN_TOOL_FINGER && features->touch_max > 1)
unsigned int flags = INPUT_MT_DIRECT; input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT);
if (wacom_wac->features.type == TABLETPC2FG)
flags = 0;
input_mt_init_slots(input_dev, features->touch_max, flags);
}
/* fall through */ /* fall through */
case TABLETPC: case TABLETPC:
...@@ -1883,10 +1877,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, ...@@ -1883,10 +1877,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
__set_bit(BTN_RIGHT, input_dev->keybit); __set_bit(BTN_RIGHT, input_dev->keybit);
if (features->touch_max) { if (features->touch_max) {
/* touch interface */
unsigned int flags = INPUT_MT_POINTER;
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
input_set_abs_params(input_dev, input_set_abs_params(input_dev,
ABS_MT_TOUCH_MAJOR, ABS_MT_TOUCH_MAJOR,
...@@ -1894,12 +1884,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, ...@@ -1894,12 +1884,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
input_set_abs_params(input_dev, input_set_abs_params(input_dev,
ABS_MT_TOUCH_MINOR, ABS_MT_TOUCH_MINOR,
0, features->y_max, 0, 0); 0, features->y_max, 0, 0);
} else {
__set_bit(BTN_TOOL_FINGER, input_dev->keybit);
__set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
flags = 0;
} }
input_mt_init_slots(input_dev, features->touch_max, flags); input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER);
} else { } else {
/* buttons/keys only interface */ /* buttons/keys only interface */
__clear_bit(ABS_X, input_dev->absbit); __clear_bit(ABS_X, input_dev->absbit);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment