Repository navigation
have iio-sensor-proxy detect panel orientation - #13
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the MiniBook-specific iio-sensor-proxy MXC6655 accelerometer driver to detect the DRM DSI connector’s panel orientation at startup and compensate its reported orientations so static rotation (VBT/kernel/i915 quirks) and dynamic rotation no longer stack. It also adds a diagnostic line to tools/check-status.sh and documents the combined static+dynamic behavior in the guides.
Changes:
- Add DRM (
libdrm) probing indrv-mxc6655-accel.cto compute and apply a static rotation compensation (panel_deg) to all reported orientations. - Extend
tools/check-status.shto report the current DRMpanel orientationviamodetest. - Add
libdrmas a build dependency for the iio-sensor-proxy fork and update documentation describing the behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/check-status.sh | Adds a panel rotation status line by parsing DRM panel orientation via modetest. |
| iio-sensor-proxy/meson.build | Introduces libdrm dependency used by the sensor proxy driver change. |
| iio-sensor-proxy/src/meson.build | Links libdrm into the iio-sensor-proxy executable dependencies. |
| iio-sensor-proxy/src/drv-mxc6655-accel.c | Reads DRM panel orientation at startup and de-rotates sensor output to avoid stacking with static rotation. |
| GUIDE.md | Documents how static rotation interacts with the proxy and how to verify via logs/check-status. |
| docs/iio-sensor-proxy.md | Documents the DRM panel orientation compensation behavior at startup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| gint drm_orient = read_panel_orientation (); | ||
| gint deg = panel_orient_degrees (drm_orient); | ||
|
|
||
| g_message ("MXC6655: DRM panel orientation %d, compensating sensor " | ||
| "output by %d°, laptop mode reports orientation %d", | ||
| drm_orient, deg, | ||
| compose_orientation (MXC_ORIENT_RIGHT, deg)); | ||
|
|
||
| return deg; | ||
| } |
| if [[ -z "${val}" ]]; then | ||
| print_warn "panel rotation" "no DRM panel orientation property (try sudo)" | ||
| return |
|
@fstanis thanks a lot! This is working in KDE and Niri on my Chuwi. All good in tablet and notebook modes |
|
Awesome, thank you for testing it! |
Regression test for fstanis#13: repeated ClaimAccelerometer must still emit a reading when want_polling is already TRUE.
Regression test for #13: repeated ClaimAccelerometer must still emit a reading when want_polling is already TRUE.
Since 'have iio-sensor-proxy detect panel orientation' (#13) the proxy reads the DRM "panel orientation" property of the DSI connector, and meson.build gained a dependency('libdrm'). The PKGBUILD was never updated, so `makepkg` in iio-sensor-proxy/packaging/arch now fails at configure time on a machine without libdrm installed: ERROR: Dependency "libdrm" not found, tried pkgconfig and cmake Add libdrm to depends and bump pkgrel so existing installs pick up the rebuilt package. Verified with `meson setup` + `meson compile`: Run-time dependency libdrm found: YES 2.4.134 [36/36] Linking target src/iio-sensor-proxy
iio-sensor-proxy has required libdrm since panel orientation detection landed in #13, but the apt list predates that and nothing in it pulls libdrm-dev in transitively, so on a clean install meson setup failed with: Dependency "libdrm" not found.
* Support GRUB and dracut in update-vbt-clock.sh The script assumed Limine and mkinitcpio. Detect Limine or GRUB for the kernel cmdline, and mkinitcpio, dracut or initramfs-tools for bundling the patched VBT, so it also works on Debian and Ubuntu. Locate i915_vbt by glob rather than hardcoding the PCI address, and make vbt_patch's CC overridable. * Add Ubuntu bootstrap script Installs the build dependencies, acpi_call, the four DKMS modules and the patched iio-sensor-proxy, then adds the kernel cmdline arguments. Pins the distro iio-sensor-proxy package so an upgrade cannot restore it and shadow the fork, and bundles the goodix config into the initramfs, without which the driver probes before the real root exists and falls back to its built-in config. Idempotent, and each stage can be run on its own. * Check the running refresh rate before blaming the panel Both docs said flickering or colour banding after a VBT patch means the panel does not support the rate. The panel has one timing descriptor, so patching replaces the old rate rather than adding one, and a saved display config still pinning the pre-patch rate makes the compositor fall back to a driver-synthesised mode. Programmed for one rate and scanned out at another produces identical symptoms, and immediately after patching the saved config is guaranteed stale, so it is the more likely cause of the two. * Correct the display rotation guidance Three fixes. The documented panel_orientation=right is not a value the DRM parser accepts (only normal, upside_down, left_side_up, right_side_up, verified against the tokens in the kernel image) and unrecognised values are ignored silently rather than reported. The section also said a compositor consuming orientation events needs nothing on the kernel side. That holds for the desktop but not for an encrypted root, whose passphrase prompt is drawn from the initramfs before any compositor exists. Note which layer covers which surface, and that on GNOME/Wayland the kernel rotation composes with the proxy rather than stacking. Finally, record that stock GRUB cannot rotate its menu at all, checked against 2.14, and what it would take. * Rotate text consoles via tmpfiles, not the kernel cmdline fbcon=rotate: is ignored under i915's fbdev emulation: it leaves fbcon/rotate at 0 and the console keeps the orientation DRM derives from panel_orientation, which can land a quarter or half turn out. Writing rotate_all at runtime does work, so set it from tmpfiles.d and drop the cmdline argument that only implied a fix. Expect to find the right value by trying all four rather than deriving it: they do not compose additively, and fbcon/rotate reports the current console rather than a global, so readings vary depending on which VT is active. * Treat the refresh-rate patch as an experiment, not a default A cold boot is not a sufficient test of a patched rate. The DSI link is brought up from scratch at boot but re-trained on resume, so a panel that is marginal at the requested clock can run for hours and then fail on the first suspend, with roughly half the scanlines missing and horizontal smearing on the rest. The failure is easy to misread. The driver logs nothing at all, and because it is not the stale-config problem, the mode really is the patched one, so that check passes and points the wrong way. Forcing a modeset does not clear it; only reverting does, and prolonged operation in that state can leave temporary image retention on the panel. Require a suspend cycle before considering a rate proven, and stop the bootstrap script signing off by recommending a rate it deliberately does not apply. * - Fix rotation docs: clarify panel_orientation prefix matching/failure states, note fbcon=rotate priority, and remove obsolete compositor proxy warnings. - Add initramfs-tools hook to bundle_goodix_firmware to fix missing firmware; unify script formatting, variables, and grep usage. - Fix vbt_patch Makefile to enforce clang default by evaluating CC origin instead of using ?=. * Rewrite GUIDE and fix CLAUDE.md * Install libdrm-dev in the Ubuntu bootstrap iio-sensor-proxy has required libdrm since panel orientation detection landed in #13, but the apt list predates that and nothing in it pulls libdrm-dev in transitively, so on a clean install meson setup failed with: Dependency "libdrm" not found. * Bundle the VBT under initramfs-tools and fall back to grub-mkconfig initramfs-tools only copies firmware a module declares in modinfo, and i915 doesn't declare "vbt", so the patched VBT never made it into the initramfs there. Write a hook for it like the goodix one, and remove it on revert. Ubuntu 26.04 was unaffected: its update-initramfs is a dracut shim. update-grub doesn't exist on Arch, so fall back to grub-mkconfig as bootstrap-arch.sh does. Docs updated for the current revert behaviour and supported setups. --------- Co-authored-by: Alun Davey <933275+4lun@users.noreply.github.com>
Fix per #10 (comment)