OpenTabletDriver / OpenTabletDriver/OpenTabletDriver
Better joystick detection avoidance for Linux Absolute Mode
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.1k
- Forks
- 534
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 12
Description
Description
While #2939 does prevent us from being used as a joystick, I personally don't have a good feeling about this approach (removing the associated js endpoint). Instead, I propose we adapt to joydev.c's detection routines.
There are fundamentally 2 checks that makes joydev ignore a device:
- It matches with their blacklist, either with:
- presence of
BTN_TOUCHinEV_KEYtypecodes - presence of
BTN_DIGI(akaBTN_TOOL_PEN) inEV_KEYtypecodes - or that it matches VID+PID of some preexisting devices containing accelerometers (currently only console controllers) - which seems unreliable to abuse
- presence of
- It matches their absolute mouse detection.
- The absolute mouse detection is a little more complicated. Right now, they:
- Check for a minimum amount of events (at least
EV_SYN,EV_KEYandEV_ABS) - Check specific axis count (
ABS_XandABS_Yonly), - Check for specific buttons (
BTN_LEFT,BTN_RIGHTandBTN_MIDDLEonly)
- Check for a minimum amount of events (at least
- The absolute mouse detection is a little more complicated. Right now, they:
In our current state, we do get matched on the amount of events and axises, but get discarded as we have too many buttons (SIDE and EXTRA, aka mouse4 and mouse5).
This means there are 3 ways to work around this, in rough order of realisticity:
-
Spoof that we're using
BTN_TOUCH
This does not seem to have any side effects in my limited testing -
Remove the side buttons from Linux' Absolute Mode.
This is the option with the least unknowns - we lose side buttons, but we also no longer get detected as a joystick. -
Ask the joydev maintainer to also support usage of
BTN_SIDEandBTN_EXTRA
This is probably not ideal given that we likely want to expand button compatibility, though their detection routine could be changed to account for that.
Testing show that spoofing BTN_TOOL_PEN instantly qualifies the device to be a full-on tablet, which defeats the purpose of absolute mode.
Acknowledgements
- I have searched the existing issues and this new issue is not a duplicate of any.
- I have written a concise and meaningful title.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review issue #2939 and the referenced Linux drivers/input/joydev.c detection checks first, then locate the repository's Linux Absolute Mode implementation. Decide which compatibility approach is intended before changing behavior. Done means the tablet is no longer exposed as a joystick on Linux while the supported absolute-mode buttons and tablet behavior remain intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, linux
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100