Bug 465439 - In wayland, tablet mode enables (keyboard is disabled) but auto-rotate does not enable (but the option to auto-rotate in tablet mode is on)
Summary: In wayland, tablet mode enables (keyboard is disabled) but auto-rotate does n...
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-07 19:16 UTC by Magnus Anderson
Modified: 2023-02-08 18:58 UTC (History)
1 user (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 Magnus Anderson 2023-02-07 19:16:34 UTC
SUMMARY
Tablet mode is enabled when I flip my convertible tablet (lenovo yoga c940 14), as the keyboard turns off. Auto-rotate works when it is on all the time, as expected. Auto-rotation does not happen when the keyboard turns off and "Auto-rotate in tablet mode" is on.

STEPS TO REPRODUCE
1. Enable automatic rotation and "Auto-rotate in Tablet Mode"
2. Flip to convertible mode when the keyboard turns off
3. rotate the screen

OBSERVED RESULT
No rotation

EXPECTED RESULT
Screen rotates

SOFTWARE/OS VERSIONS
Operating System: Garuda Linux
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.9-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-1065G7 CPU @ 1.30GHz
Memory: 11.3 GiB of RAM
Graphics Processor: Mesa Intel® Iris® Plus Graphics
Manufacturer: LENOVO
Product Name: 81Q9
System Version: Yoga C940-14IIL

ADDITIONAL INFORMATION
This has always happened I think, it is not a regression.

Additionally, tablet mode only enables (keyboard disables) when the screen is entirely flipped back. On Windows it enables when the screen passes the plane of the keyboard. How can I see
1. raw iio-sensor information
2. whether KDE thinks it is in tablet mode
Furthermore, how can KDE settings be changed from the command line?
Comment 1 Magnus Anderson 2023-02-07 19:28:57 UTC
https://github.com/alesya-h/linux_detect_tablet_mode

gives instructions to run
```
stdbuf -oL libinput debug-events
```
to detect the correct events. It seems that no events are emitted when I flip the screen and the keyboard turns off. So it actually makes sense that it is not enabling. The keyboard disabling must be hardware-enforced?

It does work on Windows though; and `iio-sensor-proxy` is installed. It's possible that driver support is not here or something?
Comment 2 Magnus Anderson 2023-02-07 20:40:01 UTC
A substitute I produced, as I was annoyed by this a long time ago and found nothing, hopefully this can be useful for someone else:

```
sh -c 'rm "/tmp/fake-tablet-mode-rotated" 2>/dev/null && { kscreen-doctor output.1.rotation.none ; } || { kscreen-doctor output.1.rotation.left ; touch /tmp/fake-tablet-mode-rotated ; }'
```

I put this command into a widget in the title bar. The main thing I learned is `kscreen-doctor` existing.
Comment 3 Nate Graham 2023-02-08 18:58:55 UTC
Yeah, this is going to end up being an issue in Libinput, iio-sensor-proxy, or even the kernel. I'd recommend starting with Libinput. Good luck!