Advertisement
Guest User

runcommand.sh

a guest
Aug 2nd, 2014
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.25 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # starttype==1: set video mode to VGA ONLY IF tvservice is in HDMI mode, and run command
  4. # starttype==2: keep existing video mode and run command
  5. # starttype==3: set video mode to VGA and run command
  6. # starttype==4: set video mode to 720p60 ONLY IF tvservice is in HDMI mode and run command
  7. # starttype==5: set video mode to 576p50 ONLY IF tvservice is in HDMI mode and run command
  8. # starttype==6: set video mode to 720p50 ONLY IF tvservice is in HDMI mode and run command
  9. # starttype==7: set video mode to sdtv PAL and run command
  10. # starttype==8: set video mode to sdtv NTSC and run command
  11.  
  12. export OPENMSX_SYSTEM_DATA=/usr/share/openmsx
  13.  
  14. starttype=$1
  15. shift
  16.  
  17. # set cpu governor profile performance
  18. echo "performance" | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  19.  
  20. if [[ $starttype -eq 1 && ! -z `tvservice -m CEA | egrep -w "mode 1"` ]] || [[ $starttype -eq 3 ]]; then
  21.     tvservice -e "CEA 1"
  22.     fbset -depth 8 && fbset -depth 16
  23. #   fbset -rgba 5,6,5
  24.     eval $@
  25.     tvservice -p
  26.     fbset -depth 8 && fbset -depth 16
  27. elif [[ $starttype -eq 2 ]]; then
  28.     eval $@
  29. elif [[ $starttype -eq 4 && ! -z `tvservice -m CEA | egrep -w "mode 4"` ]]; then
  30.     tvservice -e "CEA 4"
  31.     fbset -depth 8 && fbset -depth 16
  32. #   fbset -rgba 5,6,5
  33.     eval $@
  34.     tvservice -p
  35.     fbset -depth 8 && fbset -depth 16
  36. elif [[ $starttype -eq 5 && ! -z `tvservice -m CEA | egrep -w "mode 17"` ]]; then
  37.     tvservice -e "CEA 17"
  38.     fbset -depth 8 && fbset -depth 16
  39.     eval $@
  40.     tvservice -p
  41.     fbset -depth 8 && fbset -depth 16
  42. elif [[ $starttype -eq 6 && ! -z `tvservice -m CEA | egrep -w "mode 19"` ]]; then
  43.     tvservice -e "CEA 19"
  44.     fbset -depth 8 && fbset -depth 16
  45.     eval $@
  46.     tvservice -p
  47.     fbset -depth 8 && fbset -depth 16
  48. elif [[ $starttype -eq 7 ]]; then
  49.     tvservice -c "PAL 4:3"
  50.     fbset -depth 8 && fbset -depth 16
  51.     eval $@
  52.     tvservice -p
  53.     fbset -depth 8 && fbset -depth 16
  54. elif [[ $starttype -eq 8 ]]; then
  55.     tvservice -c "NTSC 4:3"
  56.     fbset -depth 8 && fbset -depth 16
  57.     eval $@
  58.     tvservice -p
  59.     fbset -depth 8 && fbset -depth 16
  60. else
  61.     eval $@
  62. fi
  63.  
  64. # set cpu governor profile ondemand
  65. echo "ondemand" | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  66.  
  67. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement