fix(minui): add TrimUI Smart Pro input mapping on MinUI#253
Conversation
…nFixes rommapp#252\n\n- Detect DeviceTrimui in DetectDevice() instead of falling through to DeviceGeneric\n- Add trimui.json input mapping based on muOS trimui-smart-pro.json\n- Apply OrientationRotate90 for DeviceTrimui (same Allwinner A133 SoC as Zero28)\n- Cache DetectDevice() result in initFramework to avoid redundant calls\n- Extract devicetreeCompatiblePath as package-level var for testability\n- Add unit tests for detectDeviceByEnv, DetectDevice, and GetInputMappingBytes\n- Update install-minui.md docs with TrimUI Smart Pro support note
The TrimUI Brick shares the tg5040 platform with the Smart Pro/Pro S in MinUI but has a portrait panel (480x800) that does not need rotation. Distinguish them via /sys/firmware/devicetree/base/model — if 'brick' is found in the model string, return DeviceTrimuiBrick (same input mapping, no rotation).
The TSP framebuffer is already 1280x720 landscape at the kernel level (confirmed via SSH/fbset). Applying OrientationRotate90 on top of that breaks the display. Remove DeviceTrimui from the rotation check.
The TSP SDL button indices appear swapped from the standard assignment. Match the gabagool default controller mapping where SDL A(0)→B and SDL B(1)→A.
🔬 Code Quality Review (Thermo-Nuclear)OverviewReviewed the 379-line changeset across 6 files. The implementation is correct and functionally complete, with solid test coverage of the TrimUI Smart Pro and Brick detection paths. Below are structural findings with a plan to address them in follow-up PRs. Finding 1 (Medium-High):
|
Greptile SummaryThis PR adds TrimUI MinUI device support and mapping coverage. The main changes are:
Confidence Score: 5/5This looks safe to merge after confirming the Brick input event layout.
cfw/minui/input_mappings.go and cfw/minui/input_mappings/trimui.json Important Files Changed
Reviews (1): Last reviewed commit: "fix(minui): swap A/B and X/Y in TSP inpu..." | Re-trigger Greptile |
| case DeviceTrimui, DeviceTrimuiBrick: | ||
| filename = "input_mappings/trimui.json" |
There was a problem hiding this comment.
Brick Shares Smart Pro Mapping
When DetectDevice() returns DeviceTrimuiBrick, this branch loads the Smart Pro mapping unconditionally. If the Brick reports its dpad or triggers through SDL hat or axis events instead of the Smart Pro controller-button layout, those inputs stay unmapped even though the docs now list Brick support.
The Brick has a 1024×768 IPS display (confirmed from product page specs), not a portrait panel. Update the install guide note and CHANGELOG entry.
Testing Status
Request for ReviewThis PR is now ready for review. Please test on your MinUI device if possible and report any issues. Key changes:
Test build available: https://github.com/jellydn/grout/releases/tag/v4.9.1.0-minui-tsp-fix CC @jellydn |
The Brick has a 1024x768 IPS display (confirmed from product page), not a 480x800 portrait panel. Fix both the variable doc and the DetectDevice() switch comment.
What
Fixes two issues on the TrimUI Smart Pro running MinUI (#252):
DetectDevice()fell through toDeviceGenericfortg5040, andGetInputMappingBytes()had noDeviceTrimuicase, so no input mapping was loaded.OrientationRotate90forDeviceTrimui, but this was incorrect. The TSP kernel framebuffer is already 1280x720 landscape (confirmed via SSH/fbset), so no rotation is needed.Why
On the TrimUI Smart Pro, MinUI sets
MINUI_DEVICE=tg5040. ThedetectDeviceByEnv()function correctly mapped this toDeviceTrimui, butDetectDevice()did not includeDeviceTrimuiin its switch statement — it fell through toDeviceGeneric. This meant no input mapping was loaded (buttons unmapped).The screen rotation issue was mistakenly attributed to needing
OrientationRotate90, but the TSP kernel already handles this — the framebuffer reports 1280x720 natively.How
Code fixes
cfw/minui/input_mappings.go: AddedDeviceTrimuito theDetectDevice()switch so it returns the correct device type. Added aDeviceTrimuicase toGetInputMappingBytes()to loadtrimui.json. Extracted devicetree paths into package-level variables for testability. AddedDeviceTrimuiBrickdevice type detected via device-tree model string.cfw/minui/input_mappings/trimui.json(new): SDL button mappings for the TrimUI Smart Pro, based on the proven muOStrimui-smart-pro.jsonmapping (same hardware, same SDL2 stack).app/setup.go: No screen rotation is applied forDeviceTrimui— the kernel framebuffer is already correctly oriented. Rotation is only applied forDeviceZero28(which actually needs it).Tests
cfw/minui/input_mappings_test.go(new): Unit tests fordetectDeviceByEnv(),DetectDevice(), andGetInputMappingBytes():DeviceTrimuiDocumentation
docs/getting-started/install-minui.md: Added note about TrimUI Smart Pro & Brick input mapping support.Test Build
A test build is available for easy testing on real hardware:
⬇ Download Grout-MinUI.zip (57 MB)
Grout-MinUI.zipGrout.pakdirectory intoSD_ROOT/Tools/tg5040/on your SD cardNotes
tg5040platform identifier in MinUI covers both the TrimUI Smart Pro and TrimUI Brick. The Brick is distinguished via device-tree model string.trimui-smart-pro.jsonsince both run SDL2 on identical hardware.Checklist