Introduction - the project System components Basic installation HDMI monitor and overscan Shutdown and wakeup MythTV backend setup MythTV frontend setup Kodi setup Conclusions and summary Epilogue - 3 years on Links |
HDMI monitor and overscanUp to now the system had been on a computer monitor, now it was connected to a Sony Bravia TV via the HDMI port. This TV overscans, ie 5-10% of the screen is lost on each edge (TVs tend to do this to get rid of the untidyness on the edges). A lot of modern TVs have a setting to turn overscan on and off. This one doesn't, and a lot of useful information was lost - including the desktop Applications menu. As well as that, the screen font was huge. The latter had a simple solution and must be a small bug. Go into Applications >> Settings >> Appearance (fonts tab). It will probably be set for 96dpi. Adjust to 95 then back to 96. Fonts are now normal size. Actually I then changed the font to 13pt from 10pt as it is easier to see when further away. The overscan wasn't so simple, tried to use xrandr but could find no useful adjustment - the 'underscan' property did not appear to exist (it seems different properties exist with different graphics adapters). However (and bear in mind this has nVidia graphics), the answer lies in nvidia-settings. Start this up from Applications >> System and be selecting the second entry down on the left, on the right in an overscan adjustment slider. Adjust as necessary (71 in my case). This only works for the current session so save the setting (do not enter a file name). The effect of this is to create /etc/X11/xorg.conf, and that will have a MetaMode entry with the overscan settings, therefore on each initialisation of X with that monitor, the setting will be applied. That was half the battle, Kodi was the other half. The problem with Kodi is that when running full screen (which is how one usually wants it), it takes over the screen and ignores the X settings entirely. You can get round that by using the 'video calibration ...' in Kodi setup, but worse still, when you exit Kodi, it has screwed up all the existing X settings. (Of course one can run it windowed and there will be no problem, but it doesn't look as good). I could find no way to reapply the X settings from xorg.conf. Trying to restart the display manager lightdm just produced a crash. However the answer lies again in nvidia-settings. If started with no parameters, it starts the GUI, but it can be run from the command line to set parameters on the fly. The answer therefore was run Kodi from a script that sets the relevant parameters. This was called mythtv-runkodi, placed in /usr/local/bin and made executable (sudo chmod +x /usr/local/bin/mythtv-runkodi). The script is: #!/bin/bash
sudo mythtv-kodiiss &
nvidia-settings -a CurrentMetaMode="DFP-1: 1920x1080+0+0 {ViewPortIn=1920x1080, ViewPortOut=1778x1000+71+39}"
kodi
nvidia-settings -a CurrentMetaMode="DFP-1: 1920x1080+0+0 {ViewPortOut=1778x1000+71+39}"
Ignore the line with mythtv-kodiiss for now, the next line sets a viewportin and viewportout before starting Kodi (by doing this you then do not have to use the Kodi video calibration), then it runs Kodi. When Kodi exits it sets the right parameters for the desktop again (these are the same settings as now in xorg.conf). The Alacarte menu editor was then used to change the entry in the menu that runs Kodi from kodi, to mythtv-runkodi. Non-nVidia graphicsNote that all this only works because it is nVidia graphics, and nvidia-settings is used to sort everything out. If you have ATI Radeon graphics, it is possible that if the card has a bespoke driver for your kernel version (mine didn't), the Catalyst control panel may have an overscan control (or it may not, it apparently depends on the Catalyst version). If not, then in theory xrandr can be used to turn underscan on and off (the properties do exist with this graphics hardware). All I can say is that when I tried this on HD3200 inbuilt graphics on a Gigabyte motherboard, whilst the display flickered encouragingly when the underscan settings were changed, nothing actually changed in terms of overscan. So if anyone knows how to actually get xrandr to do this, I'd be delighted to hear. Screensaver and KodiYou probably do not want the X screen saver to kick in when running Kodi (it has its own). That is what the mythtv-kodiiss line does: it starts a script in the background (also placed in /usr/local/bin and made executable as are all scripts placed there), containing: #!/bin/bash
#inhibit screen saver while kodi running
# LOGFILE="/var/log/mythtv/kodi-iss.log"
# LOGFILE="/dev/stdout"
LOGFILE="/dev/null"
let "count = 0"
while [ $(pidof -x mythtv-runkodi) ] ; do
let "count = $count + 1"
echo "Kodi running ($count)" >> $LOGFILE
if [ $count -ge 25 ] ; then
let "count = 0"
if [ $(pidof -x xscreensaver) ] ; then
echo "Ping screen saver" >> $LOGFILE
xscreensaver-command -deactivate >> $LOGFILE
else
echo "No screensaver running" >> $LOGFILE
fi
fi
sleep 2
done
echo "Kodi not running - exiting" >> $LOGFILE
exit 0
What this simply does is check every 2 seconds if the Kodi script is still running. If not it just exits. If it is then every 25x through (50 seconds) it pokes the screen saver. So in other words it is started on running Kodi, makes sure the screen saver is kept quiet while Kodi is running, then exits on its own. The reason it is sudo'd is that sometimes it was made to write to a log in /var/log/mythtv, which requires root privileges. Next: Shutdown and wakeup |