diff options
-rw-r--r-- | drivers/hid/wacom_wac.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 59b8e27909d4..4d559c1e7779 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -1768,9 +1768,6 @@ static int wacom_bpt_pen(struct wacom_wac *wacom) | |||
1768 | if (data[0] != WACOM_REPORT_PENABLED) | 1768 | if (data[0] != WACOM_REPORT_PENABLED) |
1769 | return 0; | 1769 | return 0; |
1770 | 1770 | ||
1771 | if (wacom->shared->touch_down) | ||
1772 | return 0; | ||
1773 | |||
1774 | prox = (data[1] & 0x20) == 0x20; | 1771 | prox = (data[1] & 0x20) == 0x20; |
1775 | 1772 | ||
1776 | /* | 1773 | /* |
@@ -1783,17 +1780,21 @@ static int wacom_bpt_pen(struct wacom_wac *wacom) | |||
1783 | * | 1780 | * |
1784 | * Hardware does report zero in most out-of-prox cases but not all. | 1781 | * Hardware does report zero in most out-of-prox cases but not all. |
1785 | */ | 1782 | */ |
1786 | if (prox) { | 1783 | if (!wacom->shared->stylus_in_proximity) { |
1787 | if (!wacom->shared->stylus_in_proximity) { | 1784 | if (data[1] & 0x08) { |
1788 | if (data[1] & 0x08) { | 1785 | wacom->tool[0] = BTN_TOOL_RUBBER; |
1789 | wacom->tool[0] = BTN_TOOL_RUBBER; | 1786 | wacom->id[0] = ERASER_DEVICE_ID; |
1790 | wacom->id[0] = ERASER_DEVICE_ID; | 1787 | } else { |
1791 | } else { | 1788 | wacom->tool[0] = BTN_TOOL_PEN; |
1792 | wacom->tool[0] = BTN_TOOL_PEN; | 1789 | wacom->id[0] = STYLUS_DEVICE_ID; |
1793 | wacom->id[0] = STYLUS_DEVICE_ID; | ||
1794 | } | ||
1795 | wacom->shared->stylus_in_proximity = true; | ||
1796 | } | 1790 | } |
1791 | } | ||
1792 | |||
1793 | wacom->shared->stylus_in_proximity = prox; | ||
1794 | if (wacom->shared->touch_down) | ||
1795 | return 0; | ||
1796 | |||
1797 | if (prox) { | ||
1797 | x = le16_to_cpup((__le16 *)&data[2]); | 1798 | x = le16_to_cpup((__le16 *)&data[2]); |
1798 | y = le16_to_cpup((__le16 *)&data[4]); | 1799 | y = le16_to_cpup((__le16 *)&data[4]); |
1799 | p = le16_to_cpup((__le16 *)&data[6]); | 1800 | p = le16_to_cpup((__le16 *)&data[6]); |
@@ -1809,6 +1810,8 @@ static int wacom_bpt_pen(struct wacom_wac *wacom) | |||
1809 | pen = data[1] & 0x01; | 1810 | pen = data[1] & 0x01; |
1810 | btn1 = data[1] & 0x02; | 1811 | btn1 = data[1] & 0x02; |
1811 | btn2 = data[1] & 0x04; | 1812 | btn2 = data[1] & 0x04; |
1813 | } else { | ||
1814 | wacom->id[0] = 0; | ||
1812 | } | 1815 | } |
1813 | 1816 | ||
1814 | input_report_key(input, BTN_TOUCH, pen); | 1817 | input_report_key(input, BTN_TOUCH, pen); |
@@ -1820,11 +1823,6 @@ static int wacom_bpt_pen(struct wacom_wac *wacom) | |||
1820 | input_report_abs(input, ABS_PRESSURE, p); | 1823 | input_report_abs(input, ABS_PRESSURE, p); |
1821 | input_report_abs(input, ABS_DISTANCE, d); | 1824 | input_report_abs(input, ABS_DISTANCE, d); |
1822 | 1825 | ||
1823 | if (!prox) { | ||
1824 | wacom->id[0] = 0; | ||
1825 | wacom->shared->stylus_in_proximity = false; | ||
1826 | } | ||
1827 | |||
1828 | input_report_key(input, wacom->tool[0], prox); /* PEN or RUBBER */ | 1826 | input_report_key(input, wacom->tool[0], prox); /* PEN or RUBBER */ |
1829 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */ | 1827 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */ |
1830 | 1828 | ||