Bug 466271 - Automatic tablet mode does not work on some hardware
Summary: Automatic tablet mode does not work on some hardware
Status: CONFIRMED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 5.27.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-22 22:15 UTC by Danilo Luvizotto
Modified: 2023-02-24 19:18 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Danilo Luvizotto 2023-02-22 22:15:21 UTC
SUMMARY
When set to enable it automatically, plasma requires that no pointers are detected by libinput to turn on the tablet mode. In other words, `libinput list-devices` must not show any pointers at all.

This is problematic, because it is not possible to remove all pointers in some hardware. For instance, I'm running Arch Linux (upstream, not SteamOS) on a Steam Deck, and one of the pointers detected by `libinput` is a "Valve Software Steam Controller", which is a non-removable part of the hardware. I could work around the issue by creating the following udev rule:

```
# from https://wiki.archlinux.org/title/libinput#Disable_device

# FTS3528:00 2808:1015 UNKNOWN (tablet device)
ACTION=="add|change", KERNEL=="event[0-9]*", \
   ATTRS{id/vendor}=="2808", \
   ATTRS{id/product}=="1015", \
   ATTRS{name}=="FTS3528:00 2808:1015 UNKNOWN", \
   ENV{LIBINPUT_IGNORE_DEVICE}="1"

# Valve Software Steam Controller (pointer device)
ACTION=="add|change", KERNEL=="event[0-9]*", \
   ATTRS{id/vendor}=="28de", \
   ATTRS{id/product}=="1205", \
   ATTRS{name}=="Valve Software Steam Controller", \
   ENV{LIBINPUT_IGNORE_DEVICE}="1"
```

But this workaround is applied system-wide, not only for KDE, meaning if I use the deck on "game mode" (which does not run KDE), the input device will also be disabled.

It is already possible to disable pointers using system-settings, but, unfortunately, disabled pointers still prevent plasma to enable tablet mode. The easier fix to this bug is probably to not consider disabled pointers when checking if tablet mode should be enabled.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 5.27.1
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
Running on a Steam Deck with upstream Arch Linux
Comment 1 Danilo Luvizotto 2023-02-22 22:29:11 UTC
I just was told on the Plasma Matrix channel, there's a TAG that can be used in the udev rule so only Plasma will ignore a pointer device:

```
# FTS3528:00 2808:1015 UNKNOWN (tablet device)
ACTION=="add|change", KERNEL=="event[0-9]*", \
   ATTRS{id/vendor}=="2808", \
   ATTRS{id/product}=="1015", \
   ATTRS{name}=="FTS3528:00 2808:1015 UNKNOWN", \
   TAG+="kwin-ignore-tablet-mode"

# Valve Software Steam Controller (pointer device)
ACTION=="add|change", KERNEL=="event[0-9]*", \
   ATTRS{id/vendor}=="28de", \
   ATTRS{id/product}=="1205", \
   ATTRS{name}=="Valve Software Steam Controller", \
   TAG+="kwin-ignore-tablet-mode"
```

This is a much better workaround, but still not a fix.