Improvement: Add tvservice to the list of modes
coolinx opened this issue · 10 comments
Have been using this screen saver successfully on a Rpi zero to turn the connected DELL monitor to power save mode. Running Libre elec Kodi.
Now I've replaced the RPi zero for a RPI4 and I can't get the screen turned off (power save mode) in any of the available modes.
I can turn off the screen with the following on the command line:
/usr/bin/tvservice -o
And I can turn on the screen with:
/usr/bin/tvservice -p
Could you add this command to the list of modes please?
Do you need to have root privileges in order to run this?
What devices/platforms ship with /usr/bin/tvservice
?
This does not need special privileges as far as I can see. In fact, I've adapted the screensaver.py file and replaced one of the commands there in the 'off' if statement:
run_command(['/usr/bin/tvservice -o'], shell=True)
And this one in the 'on' if statement:
run_command(['/usr/bin/tvservice -p'], shell=True)
Works good on my setup, which is a default Kodi Libre Elec installation.
/usr/bin/tvservice
is shipped with Rasbian and I think all versions of Kodi for Raspberry Pi.
Perfect, I will release a new version. Do you know what devices it works with (apart from RPi)?
I have to make clear to users when they should pick this.
If this would work for almost every device, it should probably become the default method.
I should probably look for a better way to configure this too. Suggestions welcome :-)
(RPi4 has 2 HDMI outputs, so maybe that is something to look at as well?)
Update: It seems to be broadcom specific.
My experience using tvservice -o and -p on my RPi4 isn't all that good: Playback (HVEC stream tvheadend) isn't completely smooth after turning the screen off and on. I'm using LibreElec 9.1.501.
According to this thread the vcgencmd method should now be working in Buster again with the RPi4 though.
@coolinx Can you please verify the current devel branch?
I noticed that on RPiv3 the screen does not come back, so it doesn't work for RPiv3 out-of-the-box :-/
Update: On RPiv3 I can see the backlight of my screen come up, but the display stays black. The only thing I can do is to reboot the device from SSH.
I have been adding some unit tests to ensure the code works fine on Python 2 and Python 3.
Based on your feedback I will probably release this as v0.10.1 and push it to the Kodi repository.
I would like to redesign the settings interface for a proper v1.0.0 release, and most likely the new interface would only offer options that can work on the system. So taking into account the platform and capabilities.
When running these commands from command line I get the same; screen wakes up but there is no picture. When I after reboot first run once tvservice -p, and then tvservice -o, it works.
When these commands are ran via the python script however, it works like a charm for me. There is no need for me to first run the -p command. Strange difference that I cannot explain.
I saw the comment from @grrdvnk and checked the link. Seems that the reason the vcgencmd command does not work is a bug in raspbian. So now that is resolved, I would say vcgencmd is the preffered way to turn on/off the screen.
It also indicates that the issue I experienced might not have been caused by using the RPI4, but rather the Buster version of Raspbian.
Ok, so I'd rather get the tvservice command out of the add-on then. Thanks for the feedback !
I can confirm vcgencmd is working fine on LibreELEC v9.2 BETA2.