/usr/local/include/xbian-config/scripts/videoflags
#! | 135 lines | 131 code | 4 blank | 0 comment | 0 complexity | 227be0b6b2905141d7caa587897dbce5 MD5 | raw file
Possible License(s): GPL-3.0, AGPL-1.0
- #!/bin/bash
- #
- #Copyright 2012 Hexagon <development@xbian.org>
- #
- #Resize SD function is based on the corresponding function in raspi-config
- #The overclocking function is copied from raspi-config
- #raspi-config is created by Alex Bradbury <asb@asbradbury.org>
- #
- #This file is part of XBian - XBMC on the Raspberry Pi.
- #
- #XBian is free software: you can redistribute it and/or modify it under the
- #terms of the GNU General Public License as published by the Free Software
- #Foundation, either version 3 of the License, or (at your option) any later
- #version.
- #
- #XBian is distributed in the hope that it will be useful, but WITHOUT ANY
- #WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- #FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- #details.
- #
- #You should have received a copy of the GNU General Public License along
- #with XBian. If not, see <http://www.gnu.org/licenses/>
- function videoflags() {
- FHDMI=$(grep hdmi_force_hotplug=1 /boot/config.txt);
- IHDMI=$(grep hdmi_ignore_hotplug=1 /boot/config.txt);
- ICECI=$(grep hdmi_ignore_cec_init=1 /boot/config.txt);
- DCEC=$(grep hdmi_ignore_cec=1 /boot/config.txt);
- DOSC=$(grep disable_overscan=1 /boot/config.txt);
- if [ -z $FHDMI ]; then FHDMI="off"; else FHDMI="on"; fi
- if [ -z $IHDMI ]; then IHDMI="off"; else IHDMI="on"; fi
- if [ -z $ICECI ]; then ICECI="off"; else ICECI="on"; fi
- if [ -z $DCEC ]; then DCEC="off"; else DCEC="on"; fi
- if [ -z $DOSC ]; then DOSC="off"; else DOSC="on"; fi
- RESULT=$(dialog --title "$1" --checklist "\n Various Raspberry Pi video output options" 13 80 10 \
- 1 "Force HDMI output when no tv is identified" $FHDMI \
- 2 "Ignore HDMI output even if a tv is connected" $IHDMI \
- 3 "Ignore CEC init, preventing wakeup of tv at reboot" $ICECI \
- 4 "Disable CEC" $DCEC \
- 5 "Disable overscan" $DOSC 3>&1 1>&2 2>&3 )
- MESSAGE="\n";
- if [ $? -eq 0 ]; then
- if [[ $RESULT =~ "1" ]]; then
- if [[ $FHDMI != "on" ]]; then
- set_config_var hdmi_force_hotplug 1 /boot/config.txt >/dev/null
- MESSAGE+=" Force HDMI hotplug successfully: enabled\n"
- ASKFORREBOOT=1
- else
- MESSAGE+=" Force HDMI hotplug is still: enabled\n"
- fi
- else
- if [[ $FHDMI != "off" ]]; then
- remove_config_var "hdmi_force_hotplug" /boot/config.txt >/dev/null
- MESSAGE+=" Force HDMI hotplug successfully: disabled\n"
- ASKFORREBOOT=1
- else
- MESSAGE+=" Force HDMI hotplug is still: disabled\n"
- fi
- fi
- if [[ $RESULT =~ "2" ]]; then
- if [[ $IHDMI != "on" ]]; then
- set_config_var hdmi_ignore_hotplug 1 /boot/config.txt >/dev/null
- MESSAGE+=" Ignore HDMI hotplug successfully: enabled\n"
- ASKFORREBOOT=1
- else
- MESSAGE+=" Ignore HDMI hotplug is still: enabled\n"
- fi
- else
- if [[ $IHDMI != "off" ]]; then
- remove_config_var "hdmi_ignore_hotplug" /boot/config.txt >/dev/null
- MESSAGE+=" Ignore HDMI hotplug successfully: disabled\n"
- ASKFORREBOOT=1
- else
- MESSAGE+=" Ignore HDMI hotplug is still: disabled\n"
- fi
- fi
- if [[ $RESULT =~ "3" ]]; then
- if [[ $ICECI != "on" ]]; then
- set_config_var hdmi_ignore_cec_init 1 /boot/config.txt >/dev/null
- MESSAGE+=" Ignore CEC init successfully: enabled\n"
- ASKFORREBOOT=1
- else
- MESSAGE+=" Ignore CEC init is still: enabled\n"
- fi
- else
- if [[ $ICECI != "off" ]]; then
- remove_config_var "hdmi_ignore_cec_init" /boot/config.txt >/dev/null
- MESSAGE+=" Ignore CEC init successfully: disabled\n"
- ASKFORREBOOT=1
- else
- MESSAGE+=" Ignore CEC init is still: disabled\n"
- fi
- fi
- if [[ $RESULT =~ "4" ]]; then
- if [[ $DCEC != "on" ]]; then
- set_config_var hdmi_ignore_cec 1 /boot/config.txt >/dev/null
- MESSAGE+=" CEC is now: disabled\n"
- ASKFORREBOOT=1
- else
- MESSAGE+=" CEC is still: disabled\n"
- fi
- else
- if [[ $DCEC != "off" ]]; then
- remove_config_var "hdmi_ignore_cec" /boot/config.txt >/dev/null
- MESSAGE+=" CEC is now: enabled\n"
- ASKFORREBOOT=1
- else
- MESSAGE+=" CEC is still: enabled\n"
- fi
- fi
- if [[ $RESULT =~ "5" ]]; then
- if [[ $DOSC != "on" ]]; then
- set_config_var disable_overscan 1 /boot/config.txt >/dev/null
- MESSAGE+=" Overscan is now: disabled\n"
- ASKFORREBOOT=1
- else
- MESSAGE+=" Overscan is still: disabled\n"
- fi
- else
- if [[ $DOSC != "off" ]]; then
- remove_config_var "disable_overscan" /boot/config.txt >/dev/null
- MESSAGE+=" Overscan is now: enabled\n"
- ASKFORREBOOT=1
- else
- MESSAGE+=" Overscan is still: enabled\n"
- fi
- fi
- showdialog "$1" \
- "Close" \
- "$MESSAGE"
- fi
- }