Skip to content

Commit

Permalink
Ignore ABS_MISC as a source of device type information for AES pens
Browse files Browse the repository at this point in the history
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: linuxwacom#74
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
  • Loading branch information
jigpu committed Oct 31, 2019
1 parent b40122d commit 1cfc3b2
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/wcmUSB.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1cfc3b2

Please sign in to comment.