Created
August 1, 2021 16:28
-
-
Save Langerz82/1d466c09acd47cc241bbd135d38e2617 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# This file sets the hdmi output and frame buffer to the argument in pixel width. | |
# Allowed argument example ./hdmi.sh 720 <-- For width 720 pixels. | |
# set -x #echo on | |
bpp=32 | |
hz=60 | |
i=$1 | |
case $i in | |
480|720|1080|2160) | |
w=$(($i*16/9)) | |
di=$(($i*2)) | |
w1=$(($w-1)) | |
i1=$(($i-1)) | |
fbset -fb /dev/fb0 -g $w $i $w $di $bpp | |
fbset -fb /dev/fb1 -g 32 32 32 32 32 | |
mode=$(echo "${i}p${hz}hz") | |
echo $mode > /sys/class/display/mode | |
echo 0 > /sys/class/graphics/fb0/free_scale | |
echo 1 > /sys/class/graphics/fb0/freescale_mode | |
echo 0 0 $w1 $i1 > /sys/class/graphics/fb0/free_scale_axis | |
echo 0 0 $w1 $i1 > /sys/class/graphics/fb0/window_axis | |
echo 0 > /sys/class/graphics/fb1/free_scale | |
;; | |
esac | |
# Enable framebuffer device | |
echo 0 > /sys/class/graphics/fb0/blank | |
# Blank fb1 to prevent static noise | |
echo 1 > /sys/class/graphics/fb1/blank |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment