Some devices may report other data in their buttons bits. wacom_report_numbered_buttons() ignores this data when reporting buttons, but we also need to ignore this data when reporting prox.
Signed-off-by: Aaron Armstrong Skomra <sko...@gmail.com> --- 2.6.30/wacom_wac.c | 14 ++++++++++++++ 2.6.38/wacom_wac.c | 14 ++++++++++++++ 3.7/wacom_wac.c | 14 ++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/2.6.30/wacom_wac.c b/2.6.30/wacom_wac.c index 2cf0f0787376..36a87b90c955 100644 --- a/2.6.30/wacom_wac.c +++ b/2.6.30/wacom_wac.c @@ -1633,6 +1633,17 @@ static int wacom_mspro_device_irq(struct wacom_wac *wacom) return 0; } +int wacom_mask_with_numbered_buttons(int nbuttons, int buttons) +{ + int mask = 0; + int i; + + for (i = 0; i < nbuttons; i++) + mask |= buttons & (1 << i); + + return mask; +} + static int wacom_mspro_pad_irq(struct wacom_wac *wacom) { struct wacom_features *features = &wacom->features; @@ -1699,6 +1710,9 @@ static int wacom_mspro_pad_irq(struct wacom_wac *wacom) ringvalue -= 72; } + /* Mask off buttons greater than nbuttons to avoid having them set prox */ + buttons = wacom_mask_with_numbered_buttons(nbuttons, buttons); + if (ring != WACOM_INTUOSP2_RING_UNTOUCHED) prox = buttons || ring; else diff --git a/2.6.38/wacom_wac.c b/2.6.38/wacom_wac.c index 7e08ddee9ad2..b3b1e032eeb5 100644 --- a/2.6.38/wacom_wac.c +++ b/2.6.38/wacom_wac.c @@ -1842,6 +1842,17 @@ static int wacom_mspro_device_irq(struct wacom_wac *wacom) return 0; } +int wacom_mask_with_numbered_buttons(int nbuttons, int buttons) +{ + int mask = 0; + int i; + + for (i = 0; i < nbuttons; i++) + mask |= buttons & (1 << i); + + return mask; +} + static int wacom_mspro_pad_irq(struct wacom_wac *wacom) { struct wacom_features *features = &wacom->features; @@ -1908,6 +1919,9 @@ static int wacom_mspro_pad_irq(struct wacom_wac *wacom) ringvalue -= 72; } + /* Mask off buttons greater than nbuttons to avoid having them set prox */ + buttons = wacom_mask_with_numbered_buttons(nbuttons, buttons); + if (ring != WACOM_INTUOSP2_RING_UNTOUCHED) prox = buttons || ring; else diff --git a/3.7/wacom_wac.c b/3.7/wacom_wac.c index a02d191d9431..a8ac0af7093e 100644 --- a/3.7/wacom_wac.c +++ b/3.7/wacom_wac.c @@ -1824,6 +1824,17 @@ static int wacom_mspro_device_irq(struct wacom_wac *wacom) return 0; } +int wacom_mask_with_numbered_buttons(int nbuttons, int buttons) +{ + int mask = 0; + int i; + + for (i = 0; i < nbuttons; i++) + mask |= buttons & (1 << i); + + return mask; +} + static int wacom_mspro_pad_irq(struct wacom_wac *wacom) { struct wacom_features *features = &wacom->features; @@ -1890,6 +1901,9 @@ static int wacom_mspro_pad_irq(struct wacom_wac *wacom) ringvalue -= 72; } + /* Mask off buttons greater than nbuttons to avoid having them set prox */ + buttons = wacom_mask_with_numbered_buttons(nbuttons, buttons); + if (ring != WACOM_INTUOSP2_RING_UNTOUCHED) prox = buttons || ring; else -- 2.7.4 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel