diff options
author | Ping Cheng <pinglinux@gmail.com> | 2014-06-13 16:37:33 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-06-15 03:28:38 -0400 |
commit | d7da3a3ccdeb64ceedb51b0a3377ba56cc2999fa (patch) | |
tree | f14ade0a104b94f60a8d2667d6e817c6cc60d668 /drivers/input/tablet/wacom_wac.c | |
parent | a292241cccb7e20e8b997a9a44177e7c98141859 (diff) |
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: Ping Cheng <pingc@wacom.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/tablet/wacom_wac.c')
-rw-r--r-- | drivers/input/tablet/wacom_wac.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 977d05cd9e2e..e73cf2c71f35 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -1217,9 +1217,9 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) | |||
1217 | * a=(pi*r^2)/C. | 1217 | * a=(pi*r^2)/C. |
1218 | */ | 1218 | */ |
1219 | int a = data[5]; | 1219 | int a = data[5]; |
1220 | int x_res = input_abs_get_res(input, ABS_X); | 1220 | int x_res = input_abs_get_res(input, ABS_MT_POSITION_X); |
1221 | int y_res = input_abs_get_res(input, ABS_Y); | 1221 | int y_res = input_abs_get_res(input, ABS_MT_POSITION_Y); |
1222 | width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE); | 1222 | width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE); |
1223 | height = width * y_res / x_res; | 1223 | height = width * y_res / x_res; |
1224 | } | 1224 | } |
1225 | 1225 | ||
@@ -1587,7 +1587,7 @@ static void wacom_abs_set_axis(struct input_dev *input_dev, | |||
1587 | input_abs_set_res(input_dev, ABS_X, features->x_resolution); | 1587 | input_abs_set_res(input_dev, ABS_X, features->x_resolution); |
1588 | input_abs_set_res(input_dev, ABS_Y, features->y_resolution); | 1588 | input_abs_set_res(input_dev, ABS_Y, features->y_resolution); |
1589 | } else { | 1589 | } else { |
1590 | if (features->touch_max <= 2) { | 1590 | if (features->touch_max == 1) { |
1591 | input_set_abs_params(input_dev, ABS_X, 0, | 1591 | input_set_abs_params(input_dev, ABS_X, 0, |
1592 | features->x_max, features->x_fuzz, 0); | 1592 | features->x_max, features->x_fuzz, 0); |
1593 | input_set_abs_params(input_dev, ABS_Y, 0, | 1593 | input_set_abs_params(input_dev, ABS_Y, 0, |
@@ -1815,14 +1815,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1815 | case MTTPC: | 1815 | case MTTPC: |
1816 | case MTTPC_B: | 1816 | case MTTPC_B: |
1817 | case TABLETPC2FG: | 1817 | case TABLETPC2FG: |
1818 | if (features->device_type == BTN_TOOL_FINGER) { | 1818 | if (features->device_type == BTN_TOOL_FINGER && features->touch_max > 1) |
1819 | unsigned int flags = INPUT_MT_DIRECT; | 1819 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT); |
1820 | |||
1821 | if (wacom_wac->features.type == TABLETPC2FG) | ||
1822 | flags = 0; | ||
1823 | |||
1824 | input_mt_init_slots(input_dev, features->touch_max, flags); | ||
1825 | } | ||
1826 | /* fall through */ | 1820 | /* fall through */ |
1827 | 1821 | ||
1828 | case TABLETPC: | 1822 | case TABLETPC: |
@@ -1883,10 +1877,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1883 | __set_bit(BTN_RIGHT, input_dev->keybit); | 1877 | __set_bit(BTN_RIGHT, input_dev->keybit); |
1884 | 1878 | ||
1885 | if (features->touch_max) { | 1879 | if (features->touch_max) { |
1886 | /* touch interface */ | ||
1887 | unsigned int flags = INPUT_MT_POINTER; | ||
1888 | |||
1889 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
1890 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { | 1880 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { |
1891 | input_set_abs_params(input_dev, | 1881 | input_set_abs_params(input_dev, |
1892 | ABS_MT_TOUCH_MAJOR, | 1882 | ABS_MT_TOUCH_MAJOR, |
@@ -1894,12 +1884,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1894 | input_set_abs_params(input_dev, | 1884 | input_set_abs_params(input_dev, |
1895 | ABS_MT_TOUCH_MINOR, | 1885 | ABS_MT_TOUCH_MINOR, |
1896 | 0, features->y_max, 0, 0); | 1886 | 0, features->y_max, 0, 0); |
1897 | } else { | ||
1898 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); | ||
1899 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | ||
1900 | flags = 0; | ||
1901 | } | 1887 | } |
1902 | input_mt_init_slots(input_dev, features->touch_max, flags); | 1888 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); |
1903 | } else { | 1889 | } else { |
1904 | /* buttons/keys only interface */ | 1890 | /* buttons/keys only interface */ |
1905 | __clear_bit(ABS_X, input_dev->absbit); | 1891 | __clear_bit(ABS_X, input_dev->absbit); |