8000 Sensor reports right-up and wrong real orientation on gnome while laptop mode · Issue #10 · fstanis/chuwi-minibook · GitHub
[go: up one dir, main page]

Skip to content

Sensor reports right-up and wrong real orientation on gnome while laptop mode #10

Closed

Description

@bdy5n6bnbb-ops

May be I am stupid, but after installing tablet mode with iio proxy it works quite well, but switching back to laptop mode actually making orientation wrong. Its a gnome thing for sure, but may be there is a way to tinker it?

Laptop mode -> Tablet mode = everything is fine, auto rotation works. Sensors reporting right up while in real landscape mode and normal while in portrait mode.
Tablet mode -> Laptop mode = sensors still reporting right up but gnome switching orientation to portrait so the screen is axtually portrait.

The other thing related to that is that in tablet mode there are two buttons on the keyboard still functioning for whatever reason - brightness up and down. This is kinda cool actually, but why volume buttons doesnt work in this case ?:)

Activity

  1. changed the title [-]Right-up orientation and wrong real orientation on gnome[/-] [+]Sensor reports right-up and wrong real orientation on gnome while laptop mode[/+] on Jun 16, 2026
  2. fstanis commented on Jun 21, 2026

    @fstanis
    Owner

    The issue I've encountered is that the laptop's "native" rotation is portrait, i.e. it registers as a 1080x1920 display (rather than 1920x1080). Because of this, on Niri and with iio-niri, the "correct" rotation for laptop mode is right-up - the "right" side is actually the top of the laptop and it should be up.

    The specific logic for that is here:

    if (drv_data->mode != 1)
    new_orient = MXC_ORIENT_RIGHT;

    You can try changing it to MXC_ORIENT_NORMAL or removing that if all together (in which case the laptop will rotate even in laptop mode).

    Have you applied any other tweaks for screen rotation, e.g. BIOS tweaks or bootloader-level changes? This could explain why "right-up" isn't correct on your machine.

  3. bdy5n6bnbb-ops commented on Jun 21, 2026

    @bdy5n6bnbb-ops
    Author

    The thing is on KDE there is a setting to rotate the screen only in tablet mode and with it everything is fine. So only gnome being gnome I guess. But I will try your suggestion soon.

    None of the other screen rotation methods were applied.

    Also gonna report an issue with thermal tool install. There is something while building and copying the files from src folder to src folder. Need to look closer to pkgbuild. Also in near future.

  4. bdy5n6bnbb-ops commented on Jun 21, 2026

    @bdy5n6bnbb-ops
    Author
    Image

    Thats actually total default on gnome

  5. bdy5n6bnbb-ops commented on Jun 21, 2026

    @bdy5n6bnbb-ops
    Author

    I have checked, sensor are reporting “normal” position as default on laptop mode. Even without your suggestions. I think thats the reason , right-up rotation were never be a thing on gnome lap mode bc it works kinda different

  6. bdy5n6bnbb-ops commented on Jun 21, 2026

    @bdy5n6bnbb-ops
    Author

    Image and we are getting this after all

  7. fstanis commented on Jun 22, 2026

    @fstanis
    Owner

    Is that last photo with the new_orient set to MXC_ORIENT_RIGHT or default?

  8. bdy5n6bnbb-ops commented on Jun 23, 2026

    @bdy5n6bnbb-ops
    Author

    Is that last photo with the new_orient set to MXC_ORIENT_RIGHT or default?

    Default, but its RIGHT by default.

  9. fstanis commented on Jun 27, 2026

    @fstanis
    Owner

    Could you try changing that line to MXC_ORIENT_NORMAL and see if that works?

    MXC_ORIENT_INVERTED and MXC_ORIENT_LEFT are worth trying so we can figure out the correct default.

  10. victorewik commented on Jul 13, 2026

    @victorewik

    I've been experimenting with the VBT patcher and I found that many users (myself included) prefer to have a horizontal boot logo and TTY console. This can be achieved by applying a hardware rotation via the VBT patcher (--rotation 1).

    However, this currently breaks the logic in your patched iio-sensor-proxy. Since the proxy has hardcoded logic to rotate the MiniBook X panel (assuming it's always in portrait mode), applying a VBT rotation results in a double rotation in GNOME (the "upside down" laptop mode issue).

    Question:
    Would it be possible to modify the iio-sensor-proxy logic to check the native panel orientation reported by the kernel before applying the MiniBook-specific offset?

    If the proxy could detect that the panel is already reporting a landscape orientation (due to a patched VBT), it could skip the internal 90°/270° correction. This would allow:

    Horizontal BIOS/Boot logo (via VBT).
    
    Horizontal TTY/Console (via VBT).
    
    Perfect auto-rotation in GNOME/KDE without conflicts.
    

    This would be the cleanest setup possible, as it removes the need for video=panel_orientation in GRUB and provides a seamless landscape experience from the moment the power button is pressed.

    What do you think about making the proxy logic conditional based on the reported hardware orientation?

  11. fstanis commented on Jul 19, 2026

    @fstanis
    Owner

    check the native panel orientation reported by the kernel

    I think that's a great idea - I'll just need to check if / how the kernel exposes this (likely via DRM).

  12. self-assigned this
    on Jul 19, 2026
  13. tonozawa1 commented on Aug 9, 2026

    @tonozawa1

    I’m seeing a related issue on a MiniBook X running Ubuntu 26.04 / GNOME, although I think part of what I found may be separate from the GNOME orientation issue here.

    My desired behavior is basically the same as discussed above: tablet mode should use auto-rotation, but when returning to laptop mode I want the panel forced back to the normal landscape orientation.

    While investigating, I found two lower-level things in the patched iio-sensor-proxy:

    ClaimAccelerometer() was timing out when the MXC6655 driver was already polling. In mxc6655_set_polling(), if want_polling == state, it returned without sending the initial reading that the generic proxy waits for before completing the claim. I changed it so an existing TRUE polling state resends the current orientation, and ClaimAccelerometer() then returned immediately.
    On my machine, ACPI/GMTR provides the expected thresholds 185 / 175 / 30, but compute_hinge_angle() only reaches about 150–155° when physically folded. Normal laptop mode is roughly 90–116°. As an experiment, forcing:
    tablet_thresh = 140.0f;
    laptop_thresh = 125.0f;

    gave me a clean:

    Laptop mode (angle=116.4)
    Tablet mode (angle=153.5)
    Laptop mode (angle=109.3)

    I also found that the existing pre-check skips hinge calculation based on the Y components, even though compute_hinge_angle() uses the X/Z projection. Changing that check to test X/Z magnitude made hinge reporting much more consistent when the device is tilted/wobbled during folding.

    I’m not sure whether the 150–155° maximum is due to calibration, the hinge-angle reconstruction, or a hardware/firmware difference on my unit, so I’m not claiming the 140/125 values are the correct fix. I’m happy to test anything useful on my machine.

    Separately, GNOME still does not return to the correct landscape orientation after unfolding, so that part still seems closely related to this issue.

  14. fstanis commented on Aug 9, 2026

    @fstanis
    Owner

    @tonozawa1 do you mind trying #13 and seeing whether this fixes the orientation after unfolding? I haven't had a chance to test this other than some basic usage, I'm curious if it actually works for you.

  15. tonozawa1 commented on Aug 10, 2026

    @tonozawa1

    I tested PR #13 on Ubuntu 26.04 / GNOME.

    It builds after adding:

    libdrm_dep = dependency('libdrm')

    to the top-level meson.build and installing libdrm-dev.

    The PR detects:

    MXC6655: DRM panel orientation 0, compensating sensor output by 0°, laptop mode reports orientation 3

    Unfortunately the behavior is unchanged for me. Tablet mode works, but after unfolding back to laptop mode GNOME still leaves the display in the wrong orientation, and I still have to manually select Landscape Left.

    So on my machine the kernel reports panel orientation 0 (normal), meaning PR #13 applies no compensation.

  16. fstanis commented on Aug 13, 2026

    @fstanis
    Owner

    I think I found the cause for both of the issues you reported. GNOME likely didn't receive the final state after folding back, which should now be emitted unconditionally; there was also an error in the angle calculation which would explain why you're seeing the ~150 as maximum angle (if not, I can just add a setting for it).

    Hopefully both are fixed in fbae02e (same PR), @tonozawa1 do you mind trying again (same PR)?

  17. tonozawa1 commented on Aug 13, 2026

    @tonozawa1

    Hi @fstanis. Folding the F7B1 keyboard by itself does not trigger tablet mode. With the device still folded, rotating the whole MiniBook 90° triggers Tablet mode (angle=315.9), followed about 1.7s later by Laptop mode (angle=81.8). libinput shows the corresponding state 1 → state 0. This means tablet-mode detection is still dependent on how the whole device is oriented relative to gravity, rather than only the hinge position.

  18. fstanis commented on Aug 15, 2026

    @fstanis
    Owner

    Is this a new issue you're seeing? My last commit is meant to address this bit:

    but after unfolding back to laptop mode GNOME still leaves the display in the wrong orientation, and I still have to manually select Landscape Left.

    But now if I understand correctly, it's tablet mode that doesn't happen, not returning from it? Do you mind recording a video or writing step by step instructions to reproduce this?

  19. tonozawa1 commented on Aug 15, 2026

    @tonozawa1

    Thanks — I retested this today with the latest PR and recorded both the Linux screen and the physical device.

    I need to correct my previous observation: tablet mode itself appears to be working now.

    What I see in the recording is:

    1. Start in normal laptop mode.
    2. Fold the keyboard fully behind the display.
    3. Tablet mode engages correctly.
    4. While in tablet mode, rotating the physical device causes the display to rotate as expected.
    5. Unfold the keyboard back into normal laptop position.
    6. The driver reports Laptop mode, but GNOME leaves the display in the last tablet orientation instead of restoring Landscape Left.
    7. I still have to manually select Landscape Left afterward.

    For example, the log shows:

    Tablet mode (angle=293.9)

    and later, when unfolding:

    Laptop mode (angle=87.1)

    So at least in this test, hinge/tablet detection looks much better after your angle fix. The remaining issue seems specifically related to the final orientation state when returning to laptop mode.

    I'm attaching two recordings:

    • Linux screen recording showing GNOME/display behavior and the live log
    • Vision Pro recording showing the physical MiniBook at the same time
    • iio-sensor-proxy output

    The Vision Pro recording makes it fairly clear that the machine is physically back in laptop mode while the display remains in the tablet orientation.

    https://www.dropbox.com/scl/fo/6tp46p5lsky13ik8km80w/AAZifQ6hqpzIcUiJc0MenCs?rlkey=hh1w00mjrw49vfqymlxpx40v7&st=qakn0veu&dl=0

  20. victorewik commented on Aug 17, 2026

    @victorewik

    Hi @fstanis,

    I've been testing the detect-drm branch (PR #13) on my MiniBook X N150 (Debian 13 / BIOS V2.51). Unfortunately, I haven't been able to get the correct orientation in Laptop Mode when using manual GRUB rotation.
    My setup:

    GRUB: video=DSI-1:panel_orientation=right_side_up (needed for horizontal boot/TTY).
    
    Kernel: 6.12.86+deb13.
    
    Display: card0-DSI-1.
    

    The Problem:

    The proxy doesn't seem to correctly compensate for the manual GRUB orientation, leading to "double rotations" or incorrect fixed states in Laptop Mode.
    Manual Tests performed (modifying drv-mxc6655-accel.c):

    I tried overriding the hardcoded MXC_ORIENT_RIGHT for Laptop Mode (mode != 1) with the following results:

    Default (MXC_ORIENT_RIGHT): Screen is inverted (180°) when returning to Laptop Mode.
    
    Set to MXC_ORIENT_NORMAL: Screen is vertical (90° Left).
    
    Set to MXC_ORIENT_LEFT: Still incorrect orientation.
    

    It seems that read_panel_orientation() via libdrm is returning 0 (Normal) on my unit, so the compensation logic isn't being triggered, even though the hardware/GRUB is actually rotated.
    Additional observations:

    monitor-sensor still only reports one accelerometer, which prevents the automatic "Laptop Mode" rotation lock from being reliable.
    
    Every time I unfold the device, I have to manually set "Landscape" in GNOME settings.
    

    Could we implement a way to override the laptop_mode orientation via an environment variable or a config file? This would help users with different GRUB/VBT setups.

  21. nonFilterOne commented on Aug 19, 2026

    @nonFilterOne

    Did I understand correctly that on Ubuntu 26 with the latest GNOME everything will work correctly, both tablet mode and the correct orientation when returning to laptop mode?

  22. fstanis commented on Sep 13, 2026

    @fstanis
    Owner

    Could we implement a way to override the laptop_mode orientation via an environment variable or a config file? This would help users with different GRUB/VBT setups.

    Done in #20.

  23. 4leite commented on Sep 16, 2026

    @4leite
    Collaborator

    We investigated the remaining tablet -> laptop orientation problem on another MiniBook X. This part is a Mutter bug, not a hinge or SensorProxy state bug.

    When laptop mode returns from tablet, Mutter forces the physical CRTC transform to normal regardless. On a portrait-native panel whose DRM orientation is right_side_up, that produces logical transform 1 and leaves the desktop sideways. SensorProxy is already correctly reporting right-up. Kernel params, vbt patches and changing the SensorProxy laptop orientation does not prevent this transition.

    The same bug is tracked upstream here:
    https://gitlab.gnome.org/GNOME/mutter/-/issues/4650

    There is also an open Mutter fix:
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4898

  24. fstanis commented on Sep 17, 2026

    @fstanis
    Owner

    Thank you - I updated iio-sensor-proxy.md to include this.

    I'll go ahead and close this issue since it seems to have become a catch-all for various semi-related rotation issues and it's hard to keep track over what's fixed and what isn't. I suspect #24 will address most of the outstanding bugs - if you're still experiencing issues after we merge it, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0