OpenTabletDriver / OpenTabletDriver/OpenTabletDriver

Better joystick detection avoidance for Linux Absolute Mode

Open
#2,943 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement external linux/gtk priority:low
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:

  1. It matches with their blacklist, either with:
  2. It matches their absolute mouse detection.
    • The absolute mouse detection is a little more complicated. Right now, they:
      1. Check for a minimum amount of events (at least EV_SYN, EV_KEY and EV_ABS)
      2. Check specific axis count (ABS_X and ABS_Y only),
      3. Check for specific buttons (BTN_LEFT, BTN_RIGHT and BTN_MIDDLE only)

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:

  1. Spoof that we're using BTN_TOUCH
    This does not seem to have any side effects in my limited testing

  2. 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.

  3. Ask the joydev maintainer to also support usage of BTN_SIDE and BTN_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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.