PageRenderTime 1017ms CodeModel.GetById 31ms RepoModel.GetById 2ms app.codeStats 0ms

/usr/local/include/xbian-config/scripts/videoflags

https://github.com/emcl/xbian
#! | 135 lines | 131 code | 4 blank | 0 comment | 0 complexity | 227be0b6b2905141d7caa587897dbce5 MD5 | raw file
Possible License(s): GPL-3.0, AGPL-1.0
  1. #!/bin/bash
  2. #
  3. #Copyright 2012 Hexagon <development@xbian.org>
  4. #
  5. #Resize SD function is based on the corresponding function in raspi-config
  6. #The overclocking function is copied from raspi-config
  7. #raspi-config is created by Alex Bradbury <asb@asbradbury.org>
  8. #
  9. #This file is part of XBian - XBMC on the Raspberry Pi.
  10. #
  11. #XBian is free software: you can redistribute it and/or modify it under the
  12. #terms of the GNU General Public License as published by the Free Software
  13. #Foundation, either version 3 of the License, or (at your option) any later
  14. #version.
  15. #
  16. #XBian is distributed in the hope that it will be useful, but WITHOUT ANY
  17. #WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  18. #FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  19. #details.
  20. #
  21. #You should have received a copy of the GNU General Public License along
  22. #with XBian. If not, see <http://www.gnu.org/licenses/>
  23. function videoflags() {
  24. FHDMI=$(grep hdmi_force_hotplug=1 /boot/config.txt);
  25. IHDMI=$(grep hdmi_ignore_hotplug=1 /boot/config.txt);
  26. ICECI=$(grep hdmi_ignore_cec_init=1 /boot/config.txt);
  27. DCEC=$(grep hdmi_ignore_cec=1 /boot/config.txt);
  28. DOSC=$(grep disable_overscan=1 /boot/config.txt);
  29. if [ -z $FHDMI ]; then FHDMI="off"; else FHDMI="on"; fi
  30. if [ -z $IHDMI ]; then IHDMI="off"; else IHDMI="on"; fi
  31. if [ -z $ICECI ]; then ICECI="off"; else ICECI="on"; fi
  32. if [ -z $DCEC ]; then DCEC="off"; else DCEC="on"; fi
  33. if [ -z $DOSC ]; then DOSC="off"; else DOSC="on"; fi
  34. RESULT=$(dialog --title "$1" --checklist "\n Various Raspberry Pi video output options" 13 80 10 \
  35. 1 "Force HDMI output when no tv is identified" $FHDMI \
  36. 2 "Ignore HDMI output even if a tv is connected" $IHDMI \
  37. 3 "Ignore CEC init, preventing wakeup of tv at reboot" $ICECI \
  38. 4 "Disable CEC" $DCEC \
  39. 5 "Disable overscan" $DOSC 3>&1 1>&2 2>&3 )
  40. MESSAGE="\n";
  41. if [ $? -eq 0 ]; then
  42. if [[ $RESULT =~ "1" ]]; then
  43. if [[ $FHDMI != "on" ]]; then
  44. set_config_var hdmi_force_hotplug 1 /boot/config.txt >/dev/null
  45. MESSAGE+=" Force HDMI hotplug successfully: enabled\n"
  46. ASKFORREBOOT=1
  47. else
  48. MESSAGE+=" Force HDMI hotplug is still: enabled\n"
  49. fi
  50. else
  51. if [[ $FHDMI != "off" ]]; then
  52. remove_config_var "hdmi_force_hotplug" /boot/config.txt >/dev/null
  53. MESSAGE+=" Force HDMI hotplug successfully: disabled\n"
  54. ASKFORREBOOT=1
  55. else
  56. MESSAGE+=" Force HDMI hotplug is still: disabled\n"
  57. fi
  58. fi
  59. if [[ $RESULT =~ "2" ]]; then
  60. if [[ $IHDMI != "on" ]]; then
  61. set_config_var hdmi_ignore_hotplug 1 /boot/config.txt >/dev/null
  62. MESSAGE+=" Ignore HDMI hotplug successfully: enabled\n"
  63. ASKFORREBOOT=1
  64. else
  65. MESSAGE+=" Ignore HDMI hotplug is still: enabled\n"
  66. fi
  67. else
  68. if [[ $IHDMI != "off" ]]; then
  69. remove_config_var "hdmi_ignore_hotplug" /boot/config.txt >/dev/null
  70. MESSAGE+=" Ignore HDMI hotplug successfully: disabled\n"
  71. ASKFORREBOOT=1
  72. else
  73. MESSAGE+=" Ignore HDMI hotplug is still: disabled\n"
  74. fi
  75. fi
  76. if [[ $RESULT =~ "3" ]]; then
  77. if [[ $ICECI != "on" ]]; then
  78. set_config_var hdmi_ignore_cec_init 1 /boot/config.txt >/dev/null
  79. MESSAGE+=" Ignore CEC init successfully: enabled\n"
  80. ASKFORREBOOT=1
  81. else
  82. MESSAGE+=" Ignore CEC init is still: enabled\n"
  83. fi
  84. else
  85. if [[ $ICECI != "off" ]]; then
  86. remove_config_var "hdmi_ignore_cec_init" /boot/config.txt >/dev/null
  87. MESSAGE+=" Ignore CEC init successfully: disabled\n"
  88. ASKFORREBOOT=1
  89. else
  90. MESSAGE+=" Ignore CEC init is still: disabled\n"
  91. fi
  92. fi
  93. if [[ $RESULT =~ "4" ]]; then
  94. if [[ $DCEC != "on" ]]; then
  95. set_config_var hdmi_ignore_cec 1 /boot/config.txt >/dev/null
  96. MESSAGE+=" CEC is now: disabled\n"
  97. ASKFORREBOOT=1
  98. else
  99. MESSAGE+=" CEC is still: disabled\n"
  100. fi
  101. else
  102. if [[ $DCEC != "off" ]]; then
  103. remove_config_var "hdmi_ignore_cec" /boot/config.txt >/dev/null
  104. MESSAGE+=" CEC is now: enabled\n"
  105. ASKFORREBOOT=1
  106. else
  107. MESSAGE+=" CEC is still: enabled\n"
  108. fi
  109. fi
  110. if [[ $RESULT =~ "5" ]]; then
  111. if [[ $DOSC != "on" ]]; then
  112. set_config_var disable_overscan 1 /boot/config.txt >/dev/null
  113. MESSAGE+=" Overscan is now: disabled\n"
  114. ASKFORREBOOT=1
  115. else
  116. MESSAGE+=" Overscan is still: disabled\n"
  117. fi
  118. else
  119. if [[ $DOSC != "off" ]]; then
  120. remove_config_var "disable_overscan" /boot/config.txt >/dev/null
  121. MESSAGE+=" Overscan is now: enabled\n"
  122. ASKFORREBOOT=1
  123. else
  124. MESSAGE+=" Overscan is still: enabled\n"
  125. fi
  126. fi
  127. showdialog "$1" \
  128. "Close" \
  129. "$MESSAGE"
  130. fi
  131. }