8000 iio-sensor-proxy: make orientation sensor selectable by 4leite · Pull Request #24 · fstanis/chuwi-minibook · GitHub
[go: up one dir, main page]

Skip to content

iio-sensor-proxy: make orientation sensor selectable - #24

Closed
4leite wants to merge 1 commit into
fstanis:mainfrom
4leite:feature/orientation-sensor
Closed

4leite wants to merge 1 commit into
fstanis:mainfrom
4leite:feature/orientation-sensor

Conversation

@4leite
@4leite 4leite commented Sep 16, 2026
Copy link
Copy Markdown
Collaborator

Closes #23.

What changed

  • add MINIBOOK_ORIENTATION_SENSOR=base|display
  • keep base as the default
  • pass the selected raw reading, with X reversed, into the existing orientation filter
  • keep sensor discovery, calibration, and hinge-angle calculation unchanged
  • add focused tests and short setup documentation

Why

Controlled movement tests on a MiniBook X showed that raw1 is in the base and raw2 is in the display. Selecting the display sensor makes automatic rotation follow the screen. Using calibrated a2 is not correct for orientation because its matrix also reverses Y and Z.

Validation

  • test-mxc6655-accel-claim passes, including the new selector cases
  • git diff --check passes
  • tested on CHUWI MiniBook X N150 with MINIBOOK_ORIENTATION_SENSOR=display

Allow selecting the base or display raw accelerometer for screen orientation without changing sensor discovery or calibrated hinge inputs. Keep the base sensor as the default and document the systemd override.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
return;

if (drv_data->mode != 1)
new_orient = MXC_ORIENT_RIGHT;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your fix makes this band-aid redundant too: it's meant to ensure the laptop never rotates unless it's in tablet mode, but I only added it because of unexpected / erratic rotations that I now suspect were happening because it was detecting orientation changes in the base.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I take it back: because we stop reading sensors when the laptop is closed, reopening can have an unexpected orientation if this isn't there.

@fstanis
fstanis commented Sep 17, 2026
Copy link
Copy Markdown
Owner

Thank you for the PR! I'm inclined to think we should make display the default here and undo the other changes I made in c775d13, as all of them were the wrong solution for this problem.

@fstanis
fstanis commented Sep 20, 2026
Copy link
Copy Markdown
Owner

I spent a little bit investigating how the Windows driver works. It assumes display is the first sensor that ACPI returns via the _CRS method - we only currently use GMTR which stores calibration settings. I'm working on a change to expose both via minibook_ec so that we can read this "properly", although I'm 99% sure it's always the first sensor, it's a small change and would be a stronger guarantee of correctness.

Long story short, happy to merge this, but I'd recommend just always using display and removing MINIBOOK_ORIENTATION_SENSOR since there's a better way. Thanks again for discovering this, I definitely missed it in my testing.

@fstanis
fstanis commented Nov 11, 2026
Copy link
Copy Markdown
Owner

Incorporated into #33 which makes sensor selection automatic.

@fstanis fstanis closed this Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iio-sensor-proxy: allow selecting the display accelerometer

2 participants

0