[H700] Fix screen rotation and enable independent HDMI/internal settings#32
Open
fedekrum wants to merge 1 commit intoknulli-cfw:knulli-mainfrom
Open
[H700] Fix screen rotation and enable independent HDMI/internal settings#32fedekrum wants to merge 1 commit intoknulli-cfw:knulli-mainfrom
fedekrum wants to merge 1 commit intoknulli-cfw:knulli-mainfrom
Conversation
Author
🛠️ Manual installation (no compilation needed)For anyone who wants to test this before it gets merged. Tested on RG40XX-H with Knulli alpha # 1. SSH into the device (default password: linux)
ssh root@<DEVICE_IP>
# 2. Remount filesystem as read-write
mount -o remount,rw /
# 3. Back up the original script
cp /usr/bin/knulli-resolution /usr/bin/knulli-resolution.bak
# 4. Download the patched script directly from this PR
curl -sL https://raw.githubusercontent.com/fedekrum/knulli-linux/h700-rotation-support/board/allwinner/h700/fsoverlay/usr/bin/knulli-resolution \
-o /usr/bin/knulli-resolution
# 5. Ensure it is executable
chmod 755 /usr/bin/knulli-resolution
# 6. Save overlay so the change persists across reboots
knulli-save-overlay
# 7. Reboot
rebootHow to useChange SCREEN ROTATION in ES System Settings as usual. The sync function handles per-output values automatically:
|
The emulationstation-standalone launcher already supports per-output rotation keys (display.rotate.hdmi, display.rotate.internal), but the EmulationStation UI only writes to the global display.rotate key. This left per-output keys always empty, making independent HDMI/internal rotation impossible from the UI. This patch bridges that gap with a sync function that transparently manages per-output rotation values at the shell level: - On output change (HDMI plug/unplug): restores display.rotate from the saved value for the newly active output. - On same output: persists the current display.rotate value to the active output key. Additionally fills three empty case blocks that are prerequisites for rotation to work on the H700: - currentOutput: returns hdmi or internal (required by the launcher to look up per-output rotation keys) - currentResolution: swaps WxH when rotation is 90/270 degrees so themes render with correct aspect ratio in portrait mode - supportSystemRotation: returns exit 1 to force software rotation via --screenrotate (hardware rotation causes artifacts on H700 HDMI) Tested on RG40XX-H with Knulli alpha 20260209.
386acf9 to
a1438c4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enable independent display rotation for HDMI and internal outputs on Allwinner H700 devices (RG40XX-H, RG35XX-H/Plus, etc.), controllable directly from the EmulationStation System Settings menu without editing config files.
Use case: A user wants their HDMI output rotated 90° for a vertical arcade monitor, while keeping the internal screen at 0° (landscape).
Problem
The EmulationStation UI only writes to the global
display.rotatekey inknulli.conf. However, theemulationstation-standalonelauncher already supports per-output rotation keys (display.rotate.hdmi,display.rotate.internal) — it checksdisplay.rotate.{output}first, then falls back todisplay.rotate.The issue is that these per-output keys are never populated because:
display.rotate(global)currentOutputwas empty, so the launcher could never determine the active outputSolution
Bridge the gap at the shell level with a
sync_rotation_per_output()function that transparently manages per-output rotation values:display.rotatefrom the saved value for the newly active outputdisplay.rotatevalue to the active output key (display.rotate.hdmiordisplay.rotate.internal)This approach requires zero changes to EmulationStation — all logic is contained in the H700
knulli-resolutionscript.Changes (minimal, surgical edits)
LAST_STATE_FILEvariablesync_rotation_per_output()functionsetOutput: call sync functioncurrentOutput: returnhdmiorinternalsupportSystemRotation: returnexit 1currentResolution: swap WxH for portraitfbsetoutput captured in variableOnly 2 original lines are modified. Everything else is new code or fills previously empty case blocks.
Configuration
Per-output rotation is managed automatically. Users simply change "SCREEN ROTATION" in ES System Settings as usual. The sync function handles the rest:
Technical Details
supportSystemRotationreturnsexit 1to force software rotation via--screenrotate. Hardware rotation on the H700 (viafb0/rotate) causes image artifacts on HDMI.currentResolutionswaps width/height when rotation is 90° or 270° so ES themes render with correct aspect ratio in portrait mode./var/run/last_hdmi_state(volatile, cleared on reboot).Testing
Tested on RG40XX-H running Knulli alpha
20260209: