Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions bin/prod/rotate-screen
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PLACE=$2
ROTATIONS=(0 90 180 270)

# Valid places to update
PLACES=(FBCON XORG CMDLINE WESTON)
PLACES=(FBCON XORG CMDLINE WESTON PLYMOUTH)

EMMC=/dev/mmcblk2

Expand Down Expand Up @@ -92,6 +92,29 @@ update_fbcon() {
echo $ROT_FBCON > /sys/devices/virtual/graphics/fbcon/rotate
}

# Plymouth's DRM renderer ignores fbcon=rotate: entirely (that only
# affects the legacy fbcon text console) - it reads the kernel's DRM
# panel orientation instead, set via video=<connector>:panel_orientation=<value>
# on the kernel command line.
update_plymouth(){
mkdir -p /mnt/emmc
umount -q /mnt/emmc/ || true
mount "${EMMC}p1" /mnt/emmc

CONFIG_FILE="/mnt/emmc/armbianEnv.txt"
if [ ! -f "$CONFIG_FILE" ]; then
echo "Misssig file: ${CONFIG_FILE}"
else
if [[ $(grep 'panel_orientation=' "$CONFIG_FILE") ]]; then
sed -i -E "s/panel_orientation=[a-z_]+/panel_orientation=${ROT_PLYMOUTH}/" "$CONFIG_FILE"
else
sed -i "/extraargs=/ s/\$/ video=HDMI-A-1:panel_orientation=${ROT_PLYMOUTH}/" "$CONFIG_FILE"
fi
cat "$CONFIG_FILE"
fi
umount /mnt/emmc
}

if [ "$ROTATION" == "" ]; then
usage
exit 1
Expand All @@ -106,31 +129,38 @@ case "${ROTATION}" in
0)
ROT_XORG="normal"
ROT_FBCON="0"
ROT_PLYMOUTH=""
# Confirmed empirically on real hardware.
ROT_PLYMOUTH="normal"
ROT_WESTON_10="0"
ROT_WESTON_11="normal"
ROT_MATRIX="1 0 0 0 1 0 0 0 1"
;;
90)
ROT_XORG="right"
ROT_FBCON="1"
ROT_PLYMOUTH=""
# Not empirically confirmed - inferred by elimination
# from the four DRM panel-orientation values, given 0 and
# 270 are confirmed. Verify on hardware before trusting.
ROT_PLYMOUTH="right_side_up"
ROT_WESTON_10="270"
ROT_WESTON_11="rotate-270"
ROT_MATRIX="0 1 0 -1 0 1 0 0 1"
;;
180)
ROT_XORG="inverted"
ROT_FBCON="2"
ROT_PLYMOUTH=""
# Not empirically confirmed - inferred by elimination, see
# the note on the 90 case above.
ROT_PLYMOUTH="upside_down"
ROT_WESTON_10="180"
ROT_WESTON_11="rotate-180"
ROT_MATRIX="-1 0 1 0 -1 1 0 0 1"
;;
270)
ROT_XORG="left"
ROT_FBCON="3"
ROT_PLYMOUTH=""
# Confirmed empirically on real hardware.
ROT_PLYMOUTH="left_side_up"
ROT_WESTON_10="90"
ROT_WESTON_11="rotate-90"
ROT_MATRIX="0 -1 1 1 0 0 0 0 1"
Expand All @@ -156,6 +186,9 @@ case "${PLACE}" in
WESTON)
update_weston
;;
PLYMOUTH)
update_plymouth
;;
*)
echo "$PLACE not in " "${PLACES[@]}"
exit 1
Expand Down
4 changes: 4 additions & 0 deletions reflash/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,10 @@ func runInstallFinishedCommands(w http.ResponseWriter, r *http.Request) {
if err != nil {
sendResponse(w, err)
}
err = cmdRotateScreen(options.ScreenRotation, "PLYMOUTH")
if err != nil {
sendResponse(w, err)
}

settings := "# Settings from Reflash\n" +
"SSH_ENABLED_ON_BOOT=" + strconv.FormatBool(options.EnableSsh) + "\n" +
Expand Down
Loading