I have a PineTab2 tablet. When it is docked to the keyboard it is in fixed landscape mode, when it is undocked it can auto-rotate the screen based on the accellerometer.
Sadly this does not seem to quite work in GNOME:
When I configure ACCEL_MOUNT_MATRIX so that monitor-sensors considers the tablet ‘normal’ when the keyboard connector is at the bottom, when I disconnect the keyboard, the screen is auto-rotated to always rotated 90 degrees to the left.
When I configure ACCEL_MOUNT_MATRIX so that monitor-sensors considers the tablet ‘normal’ in portrait mode with the buttons on the top edge, the screen auto-rotates correctly, but now the screen is rotated 90 degrees when I connect the keyboard.
Is there any other setting to take into account to get this right? It seems to work on plasma.
Reading up on this more, I have some observations:
The ‘native’ orientation of this display panel is portrait (checked with /sys/class/drm/card0-DSI-1/modes)
The ‘native’ orientation of this tablet is landscape. libdrm knows about this (modetest confirms it is oriented ‘Right Side Up’, xrandr (under wayland) indeed shows the resolutions in landscape mode
ACCEL_MOUNT_MATRIX should be set so that monitor-sensors considers the orientation ‘normal’ when it is in the display panel’s ‘native’ orientation, i.e. portrait
When the tablet is docked, I can set Settings→Display→Orientation to ‘Landscape’ to orient the screen correctly
When the tablet is not docked, it indeed auto-rotates correctly (and Settings→Display→Orientation is not available)
When the tablet is docked again (PanelOrientationManaged become false again), Settings→Display→Orientation (incorrectly) appears as “Portrait Right” and the display is rotated.
I guess I want GNOME to remember the Settings→Display→Orientation setting even when it temporarily disappears when I undock the tablet. Would that make sense?
for now I ended up creating an udev rule that does gdctl set --logical-monitor --primary --monitor=DSI-1 --transform normal whenever USB device 1018:1006 appears. Note gdctl needs DBUS_SESSION_BUS_ADDRESS to be set.
For Nix users I shared my configuration for this device on codeberg
I’d be interested in contributing a fix that would make this work right out-of-the-box without udev, though, but it wasn’t clear to me where that should live.