diff options
Diffstat (limited to 'drivers/input/tablet/wacom_wac.c')
-rw-r--r-- | drivers/input/tablet/wacom_wac.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 93171098abbd..c3468c8dbd89 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -25,6 +25,11 @@ | |||
25 | #define WACOM_INTUOS_RES 100 | 25 | #define WACOM_INTUOS_RES 100 |
26 | #define WACOM_INTUOS3_RES 200 | 26 | #define WACOM_INTUOS3_RES 200 |
27 | 27 | ||
28 | /* Scale factor relating reported contact size to logical contact area. | ||
29 | * 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo | ||
30 | */ | ||
31 | #define WACOM_CONTACT_AREA_SCALE 2607 | ||
32 | |||
28 | static int wacom_penpartner_irq(struct wacom_wac *wacom) | 33 | static int wacom_penpartner_irq(struct wacom_wac *wacom) |
29 | { | 34 | { |
30 | unsigned char *data = wacom->data; | 35 | unsigned char *data = wacom->data; |
@@ -326,7 +331,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
326 | 331 | ||
327 | /* Enter report */ | 332 | /* Enter report */ |
328 | if ((data[1] & 0xfc) == 0xc0) { | 333 | if ((data[1] & 0xfc) == 0xc0) { |
329 | if (features->type >= INTUOS5S && features->type <= INTUOS5L) | 334 | if (features->quirks == WACOM_QUIRK_MULTI_INPUT) |
330 | wacom->shared->stylus_in_proximity = true; | 335 | wacom->shared->stylus_in_proximity = true; |
331 | 336 | ||
332 | /* serial number of the tool */ | 337 | /* serial number of the tool */ |
@@ -414,7 +419,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
414 | 419 | ||
415 | /* Exit report */ | 420 | /* Exit report */ |
416 | if ((data[1] & 0xfe) == 0x80) { | 421 | if ((data[1] & 0xfe) == 0x80) { |
417 | if (features->type >= INTUOS5S && features->type <= INTUOS5L) | 422 | if (features->quirks == WACOM_QUIRK_MULTI_INPUT) |
418 | wacom->shared->stylus_in_proximity = false; | 423 | wacom->shared->stylus_in_proximity = false; |
419 | 424 | ||
420 | /* | 425 | /* |
@@ -1043,11 +1048,19 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) | |||
1043 | if (touch) { | 1048 | if (touch) { |
1044 | int x = (data[2] << 4) | (data[4] >> 4); | 1049 | int x = (data[2] << 4) | (data[4] >> 4); |
1045 | int y = (data[3] << 4) | (data[4] & 0x0f); | 1050 | int y = (data[3] << 4) | (data[4] & 0x0f); |
1046 | int w = data[6]; | 1051 | int a = data[5]; |
1052 | |||
1053 | // "a" is a scaled-down area which we assume is roughly | ||
1054 | // circular and which can be described as: a=(pi*r^2)/C. | ||
1055 | int x_res = input_abs_get_res(input, ABS_X); | ||
1056 | int y_res = input_abs_get_res(input, ABS_Y); | ||
1057 | int width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE); | ||
1058 | int height = width * y_res / x_res; | ||
1047 | 1059 | ||
1048 | input_report_abs(input, ABS_MT_POSITION_X, x); | 1060 | input_report_abs(input, ABS_MT_POSITION_X, x); |
1049 | input_report_abs(input, ABS_MT_POSITION_Y, y); | 1061 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
1050 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, w); | 1062 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, width); |
1063 | input_report_abs(input, ABS_MT_TOUCH_MINOR, height); | ||
1051 | } | 1064 | } |
1052 | } | 1065 | } |
1053 | 1066 | ||
@@ -1530,10 +1543,12 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1530 | __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); | 1543 | __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); |
1531 | __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit); | 1544 | __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit); |
1532 | 1545 | ||
1533 | input_mt_init_slots(input_dev, features->touch_max); | 1546 | input_mt_init_slots(input_dev, features->touch_max, 0); |
1534 | 1547 | ||
1535 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, | 1548 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, |
1536 | 0, 255, 0, 0); | 1549 | 0, features->x_max, 0, 0); |
1550 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, | ||
1551 | 0, features->y_max, 0, 0); | ||
1537 | 1552 | ||
1538 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | 1553 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
1539 | 0, features->x_max, | 1554 | 0, features->x_max, |
@@ -1575,7 +1590,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1575 | 1590 | ||
1576 | case TABLETPC2FG: | 1591 | case TABLETPC2FG: |
1577 | if (features->device_type == BTN_TOOL_FINGER) { | 1592 | if (features->device_type == BTN_TOOL_FINGER) { |
1578 | input_mt_init_slots(input_dev, features->touch_max); | 1593 | input_mt_init_slots(input_dev, features->touch_max, 0); |
1579 | input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, | 1594 | input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, |
1580 | 0, MT_TOOL_MAX, 0, 0); | 1595 | 0, MT_TOOL_MAX, 0, 0); |
1581 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | 1596 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
@@ -1631,7 +1646,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1631 | 1646 | ||
1632 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); | 1647 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); |
1633 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | 1648 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); |
1634 | input_mt_init_slots(input_dev, features->touch_max); | 1649 | input_mt_init_slots(input_dev, features->touch_max, 0); |
1635 | 1650 | ||
1636 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { | 1651 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { |
1637 | __set_bit(BTN_TOOL_TRIPLETAP, | 1652 | __set_bit(BTN_TOOL_TRIPLETAP, |
@@ -1641,7 +1656,10 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1641 | 1656 | ||
1642 | input_set_abs_params(input_dev, | 1657 | input_set_abs_params(input_dev, |
1643 | ABS_MT_TOUCH_MAJOR, | 1658 | ABS_MT_TOUCH_MAJOR, |
1644 | 0, 255, 0, 0); | 1659 | 0, features->x_max, 0, 0); |
1660 | input_set_abs_params(input_dev, | ||
1661 | ABS_MT_TOUCH_MINOR, | ||
1662 | 0, features->y_max, 0, 0); | ||
1645 | } | 1663 | } |
1646 | 1664 | ||
1647 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | 1665 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |