asb / raspi-config

Configuration tool for the Raspberry Pi. Now maintained at https://github.com/RPi-Distro/raspi-config
Other
263 stars 328 forks source link

Changing overscan in raspi-config breaks config.txt overscan settings, screws up EmulationStation in RetroPie #73

Open battaglia01 opened 6 years ago

battaglia01 commented 6 years ago

The EmulationStation software in RetroPie depends on the setting overscan_scale=1 being set in /boot/config.txt. If you use raspi-config to change the overscan settings, however, it comments this line out and there is no way to fix it other than changing the file again manually. The error is here at line 165 (164-169 shown)

  if [ "$1" -eq 0 ]; then # disable overscan
    sed $CONFIG -i -e "s/^overscan_/#overscan_/"
    set_config_var disable_overscan 1 $CONFIG
  else # enable overscan
    set_config_var disable_overscan 0 $CONFIG
  fi

It's that sed $CONFIG -i -e "s/^overscan_/#overscan_/" that does it. After setting disable overscan, it comments out everything beginning with overscan_ in the file, breaking overscan_scale, and then does not uncomment when you re-enable overscan. As a result, EmulationStation's overscan settings break.

The cleanest way to do this would be to tag the commented lines, for instance by changing them from overscan_* to ##raspi-config##overscan_. Having three hashtags indicates that this was commented from raspi-config. Then, when we re-enable, just search for all ##raspi-config##overscan_ instances and replace back to overscan_.

Another way would be to just drop the line entirely - if we're setting disable_overscan=1, does it really matter if we have other overscan settings also set in the file? Overscan is disabled, so wouldn't it just ignore those?

I'd be happy to write a quick PR for this as it's two lines of code, but I'm not sure if this is being maintained.