Skip to content

Commit

Permalink
Merge pull request #2405 from Fourdee/rpi-headless
Browse files Browse the repository at this point in the history
RPi | Outsource headless mode to DietPi-Set_Hardware + minor enhancements
  • Loading branch information
Fourdee authored Jan 11, 2019
2 parents 3a13420 + 0169ccd commit cde0d8b
Show file tree
Hide file tree
Showing 4 changed files with 225 additions and 235 deletions.
61 changes: 22 additions & 39 deletions dietpi/dietpi-config
Original file line number Diff line number Diff line change
Expand Up @@ -914,25 +914,9 @@
#Return to This Menu
TARGETMENUID=2

# - Always enable HDMI output by default
G_CONFIG_INJECT 'CONFIG_HDMI_OUTPUT=' 'CONFIG_HDMI_OUTPUT=1' /DietPi/dietpi.txt
if [[ $G_WHIP_RETURNED_VALUE == 'Headless' ]]; then

# - Always set default depth to 16
sed -i 's/^[[:blank:]]*framebuffer_depth=/c\#framebuffer_depth=16' /DietPi/config.txt

# - Always disable composite by default
sed -i '/sdtv_mode=/c\#sdtv_mode=0' /DietPi/config.txt

# - Always disable OpenGL by default:
/DietPi/dietpi/func/dietpi-set_hardware rpi-opengl disable

if [[ $G_WHIP_RETURNED_VALUE == 'vc4-'* ]]; then

/DietPi/dietpi/func/dietpi-set_hardware rpi-opengl $G_WHIP_RETURNED_VALUE

elif [[ $G_WHIP_RETURNED_VALUE == 'Headless' ]]; then

G_WHIP_MSG 'Using the Headless option will:
G_WHIP_YESNO 'Using the Headless option will:
- Disable HDMI and composite output
- Disable the framebuffer
- Lower energy consumption by 0.1+ Watts
Expand All @@ -942,34 +926,33 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, comment o
- hdmi_ignore_hotplug=1
- hdmi_ignore_composite=1\n
More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p105008
and here: https://github.com/raspberrypi/userland/issues/447#issuecomment-404399670'

G_CONFIG_INJECT 'CONFIG_HDMI_OUTPUT=' 'CONFIG_HDMI_OUTPUT=0' /DietPi/dietpi.txt
# - Framebuffer dimensions should not play a role here, but
# if NOT set, they appear as "0" by asking "vcgencmd get_config (max_)?framebuffer_(width|height)"
# otherwise vcgencmd shows the set value. So we simply comment it.
sed -i 's/^[[:blank:]]*framebuffer_width=/c\#framebuffer_width=0' /DietPi/config.txt
sed -i 's/^[[:blank:]]*framebuffer_height=/c\#framebuffer_height=0' /DietPi/config.txt
sed -i 's/^[[:blank:]]*max_framebuffer_width=/c\#max_framebuffer_width=0' /DietPi/config.txt
sed -i 's/^[[:blank:]]*max_framebuffer_height=/c\#max_framebuffer_height=0' /DietPi/config.txt
# - framebuffer_depth defaults to a set value of 16, even with HDMI disabled, so we manually reduce it to min 8
G_CONFIG_INJECT 'framebuffer_depth=' 'framebuffer_depth=8' /DietPi/config.txt
# - Splash cannot be seen anyway, without video output
G_CONFIG_INJECT 'disable_splash=' 'disable_splash=1' /DietPi/config.txt
# - hdmi_blanking should not play a role, however mode 1 should be generally preferred, which on idle disables HDMI output completely instead of just blanking the screen
G_CONFIG_INJECT 'hdmi_blanking=' 'hdmi_blanking=1' /DietPi/config.txt
# - Disable HDMI hotplug, which requires it to be generally responsive/active
G_CONFIG_INJECT 'hdmi_ignore_hotplug=' 'hdmi_ignore_hotplug=1' /DietPi/config.txt
# - Disable composite hotplug, which then allows to completely disable the video pipeline + framebuffer
G_CONFIG_INJECT 'hdmi_ignore_composite=' 'hdmi_ignore_composite=1' /DietPi/config.txt
and here: https://github.com/raspberrypi/userland/issues/447#issuecomment-404399670' || { REBOOT_REQUIRED=0; return; }

/DietPi/dietpi/func/dietpi-set_hardware rpi-headless 1

else

/DietPi/dietpi/func/dietpi-set_hardware rpi-headless 0

fi

# - Always disable composite by default
[[ $G_WHIP_RETURNED_VALUE == 'sdtv_mode'* ]] || sed -i '/sdtv_mode=/c\#sdtv_mode=0' /DietPi/config.txt

# - Always disable OpenGL by default
[[ $G_WHIP_RETURNED_VALUE == 'vc4-'* ]] || /DietPi/dietpi/func/dietpi-set_hardware rpi-opengl disable

if [[ $G_WHIP_RETURNED_VALUE == 'vc4-'* ]]; then

/DietPi/dietpi/func/dietpi-set_hardware rpi-opengl $G_WHIP_RETURNED_VALUE

elif [[ $G_WHIP_RETURNED_VALUE != 'Headless' ]]; then

case "$G_WHIP_RETURNED_VALUE" in

'sdtv_mode'*)

sed -i "/sdtv_mode=/c $G_WHIP_RETURNED_VALUE" /DietPi/config.txt
sed -i "/sdtv_mode=/c\\$G_WHIP_RETURNED_VALUE" /DietPi/config.txt
framebuffer_x=720
framebuffer_y=576

Expand Down
Loading

0 comments on commit cde0d8b

Please sign in to comment.