From 1cfc3b2939a59344b4b37f82836d3a6a1b1f7e61 Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Mon, 23 Sep 2019 14:29:09 -0700 Subject: [PATCH] Ignore ABS_MISC as a source of device type information for AES pens AES sensors "appear" to use protocol 5 since they send ABS_MISC events which contain information about the tool type in use. The tool type information sent by AES sensors does not contain stylus/eraser/puck information, however, so we need to ignore it or else we may randomly end up treating the pens as erasers if a certian bit is set. Fixes: https://github.com/linuxwacom/xf86-input-wacom/issues/74 Signed-off-by: Jason Gerecke --- src/wcmUSB.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/wcmUSB.c b/src/wcmUSB.c index 0e781ac9..ff49b883 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -1173,18 +1173,25 @@ static int usbFilterEvent(WacomCommonPtr common, struct input_event *event) static int usbIdToType(int id) { int type = STYLUS_ID; + Bool is_aes = id & 1; if (!id) return 0; - /* The existing tool ids have the following patten: all pucks, except - * one, have the third byte set to zero; all erasers have the fourth - * bit set. The rest are styli. - */ - if (id & ERASER_BIT) - type = ERASER_ID; - else if (!(id & PUCK_BITS) || (id == PUCK_EXCEPTION)) - type = CURSOR_ID; + if (is_aes) { + /* Type information is not available from the ID for AES */ + return 0; + } + else { + /* The existing EMR tool ids have the following patten: all + * pucks, except one, have the third byte set to zero; all + * erasers have the fourth bit set. The rest are styli. + */ + if (id & ERASER_BIT) + type = ERASER_ID; + else if (!(id & PUCK_BITS) || (id == PUCK_EXCEPTION)) + type = CURSOR_ID; + } return type; }