Display output issues with OSMC (no xrandr?)

Hi all, sorry to be yet another new user adding to the support requests, but had something of a conundrum for quite some time now and browsing various wikis and other threads hasn’t managed to yield any results yet. Tried my best to explain whole setup, but tl;dr is at the bottom for convenience.

Setup

So, my current situation is, I have a Raspberry Pi 2 running OSMC hooked up to my speakers and my main monitor (via HDMI) in my room. This is then linked with my Kodi controller app on my phone so I can control it from my sofa. My main PC then shares this monitor with the rPi. The idea is to have the monitor set to auto so it can switch between the two devices as and when required. The OSMC Pi ideally would remain on at all times so it can also act as an airplay speaker unit, and only use the screen when I want to watch something.

Problem

So, the problem arises due to several factors. Firstly, it is impossible to set input priority on the monitor, meaning once it has found an input to display, it will continue to display this unit manually changed using the OSD, or the input is powered off. As the Pi is on constantly, and the PC is only powered on when needed, the display will pretty much always end up stuck on the OSMC output. Only way I can get the display back to the PC without changing the monitor input manually is to send the Pi to sleep. As wake on LAN doesn’t work on the Pi, the only way to then turn it back on is to pull the plug and reseat (not ideal).

Solution

My idea to get around this issue therefore is to have a short script on the OSMC Pi that will allow me to toggle whether the display is being output or not, then trigger this script with my phone (essentially allowing me to turn the screen output on/off). Normally, I would do this through xrandr on Debian systems, however when I ssh into it and run an xrandr command I get -bash: xrandr: command not found (i.e. implying xrandr is not installed). Does this mean OSMC uses a different display manager? If yes, does it have a similar command set to xrandr that allows display manipulation?

TL;DR

Is there a specific command to run in the OSMC shell to get it to stop outputting through the HDMI ad visa versa? Ideally looking for a single line bash command.

Thanks in advance for any help!

OSMC on Pi doesn’t use X11.
HDMI can be controlled via tvservice.

Much obliged

Right, back again! Got the screen to successfully turn off using tvservice -o, however trying to use tvservice -p to turn it back on again just gives me a plain black screen (tvservice -s gives the same results both before and after). Only way to get out of my black screen is to reboot from there.

Is there something else I need to do to get things to reappear?

Thanks or your help.

Use “vcgencmd display_power 0” and “vcgencmd display_power 1”
And perhaps look at GitHub - asavah/script.pidisplaypower: Screensaver for Kodi running on raspberry pi that turns display power off by using vcgencmd display_power command.

If you end up with a blank screen when returning (which ever method of switching you use) you might find that restarting kodi resolves that sudo systemctl restart mediacenter

Hi all,

Thanks for all the input, got it working vcgencmd display_power 0 and vcgencmd display_power 1 respectively, display jumps back to where I was last.

Once again, thank you all for the help!