We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

stefanru
Posts: 23
Joined: Sun May 03, 2020 9:17 am

HDMI DPMS Not working on Desktop

Sun Feb 19, 2023 3:06 pm

Hi,

i have a Raspberry PI 400.
I installed Raspberry PI OS 64 Bit wth Desktop.
In my config.txt i have the standard:
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2

I added
hdmi_blanking=1

In cmdline.txt i added:
consoleblank=120

This works perfect on console TTY1 - TTY6.
After 120 seconds the console goes blank.
Monitor says that he will go to power safe mode and backlite switches off.
Monitor goes to deep sleep and uses < 2 Watt.
When i press a key the Monitor wakes up again with a short delay.
That's perfect.

On the Desktop i can not get this to work.
DISPLAY=:0 xset dpms 0 0 5
DISPLAY=:0 xset +dpms
or
xset dpms force off
just makes the screen black, i can even see the cursor still.
No sleeping of the monitor :-(

So i installed xscreensaver.
I tried all power settings in xscreensaver.
Xscreensaver blanks the monitor.
And the monitor backlight goes off.
But the monitor is not in deep sleep.
The monitor still uses >12 Watt.

So i am seraching a way to get the same behaviour on the dektop as on the console.
Monitor should go to deep sleep with using < 2 Watt.

I read a lot of forum posts and tried all commands mentioned but with non of the ommands i get this behaviour as it is working on console.
Since it works on console, the hardware is capable of doing this. There must be a way to get this also working for the desktop.
I do not need a screensaver, i just want the monitor going to deep sleep from desktop.

Xset Information:
pi@raspberrypi:~ $ xset -q
Keyboard Control:
auto repeat: on key click percent: 0 LED mask: 00000000
XKB indicators:
00: Caps Lock: off 01: Num Lock: off 02: Scroll Lock: off
03: Compose: off 04: Kana: off 05: Sleep: off
06: Suspend: off 07: Mute: off 08: Misc: off
09: Mail: off 10: Charging: off 11: Shift Lock: off
12: Group 2: off 13: Mouse Keys: off
auto repeat delay: 500 repeat rate: 33
auto repeating keys: 00ffffffdffffbbf
fadfffefffedffff
9fffffffffffffff
fff7ffffffffffff
bell percent: 50 bell pitch: 400 bell duration: 100
Pointer Control:
acceleration: 20/10 threshold: 10
Screen Saver:
prefer blanking: yes allow exposures: yes
timeout: 0 cycle: 0
Colors:
default colormap: 0x20 BlackPixel: 0x0 WhitePixel: 0xffffff
Font Path:
/usr/share/fonts/X11/Type1,built-ins
DPMS (Energy Star):
Standby: 0 Suspend: 0 Off: 60
DPMS is Enabled
Monitor is On
I hope someone can help me.

Thanks and best regards,
Stefan

aBUGSworstnightmare
Posts: 13267
Joined: Tue Jun 30, 2015 1:35 pm

Re: HDMI DPMS Not working on Desktop

Sun Feb 19, 2023 3:34 pm

Code: Select all

DISPLAY=:0 xrandr --output HDMI-1 --off
DISPLAY=:0 xrandr --output HDMI-1 --auto
first command should turn your display off,second bring it back on.

stefanru
Posts: 23
Joined: Sun May 03, 2020 9:17 am

Re: HDMI DPMS Not working on Desktop

Sun Feb 19, 2023 4:27 pm

Ok, thanks.
I tried this before but seems i did not wait long enough that my monitor switches into deep sleep.
So it worked Monitor used < 2 Watt.

But this introduces two new problems.
I can only wake my monitor up by executing the auto command.
On console it wakes up by a key press from deep sleep.
Is there a way to use it in the same way?
I want the monitor to deep sleep and wake up on key press as on console.
Woul like a solution like connsole automatic deep sleep after 120 seconds and auto wake up.

The next problem is when it wakes up from xrandr it is on a new resolution and framerate.
I have set in config.txt:
#Stefans 1080p 60Hz
hdmi_group:0=2
hdmi_mode:0=82

But after xrandr it wakes up in nativ 2560x1440 and 120Hz.

Can you help me?

Thanks and best regards,
Stefan

stefanru
Posts: 23
Joined: Sun May 03, 2020 9:17 am

Re: HDMI DPMS Not working on Desktop

Sun Feb 19, 2023 8:37 pm

Ok,

i think i got it working.
I found an old posting how to integrate scripts with xscreensaver.
viewtopic.php?t=56944
https://github.com/ramses0/xscreensaver-pi-hdmi

So i took this and adapted the script to my usecase, all credits go to simomcc and ramses0

Code: Select all

#!/bin/bash

usage() {
	PROG=`basename $0`
	echo "Usage: $PROG [duration_s]"
	echo "Disable RaspberryPi HDMI port after xscreensaver starts."
	echo "Example: $PROG 300"
	echo ""
	echo "Options:"
	echo "  -h, --help   This help text"
}

if [[ "-h" == "$1" || "--help" == "$1" ]] ; then
	usage
	exit
fi
DURATION_S=300
if [[ "" != "$1" && $1 =~ ^[0-9]+$ ]] ; then
	DURATION_S=$1
fi

TEMPFILE=`tempfile --prefix=hdmi. --suffix=.pid`
echo 0 > $TEMPFILE


interrupt_potential_sleeping_processes() {
    SLEEP_PID=0
    if [ -x $TEMPFILE ] ; then
        SLEEP_PID=`cat $TEMPFILE`
    fi
    if [ "0" != "$SLEEP_PID" ] ; then
        echo 0 > $TEMPFILE
        kill $SLEEP_PID
    fi
}


hdmi_off() {
    xrandr --output HDMI-1 --off
}


hdmi_on() {
    xrandr --output HDMI-1 --mode 1920x1080 --rate 60
}

# failsafe to make sure monitor stays on in case of quit
hdmi_on_exit() {
    interrupt_potential_sleeping_processes
    rm $TEMPFILE
    hdmi_on
    exit
}
trap 'hdmi_on_exit' SIGQUIT SIGINT

hdmi_on

# see fancy process substitution down below
while read line ; do
    if [[ $line =~ ^BLANK || $line =~ ^LOCK ]] ; then
        (
            sleep $DURATION_S
            hdmi_off
            echo 0 > $TEMPFILE
        ) &
        echo $! > $TEMPFILE
    fi
    if [[ $line =~ ^UNBLANK ]] ; then
        interrupt_potential_sleeping_processes
        hdmi_on
    fi
done < <( xscreensaver-command --watch )

hdmi_on_exit
I created the script in /usr/local/bin as xscreensaver-pi-hdmi and made it executable.

Now i added the script to the autostart of LXDE-pi which can be found here:
/etc/xdg/lxsession/LXDE-pi/autostart

I added this line at the end of the file:
@/usr/local/bin/xscreensaver-pi-hdmi 30

I set the xscreensaver to "Blank after 1" and "Cycle after 1".
I switched of all the "Power Management" settings of xscreensaver.
So it will start Screensavers after 1 minute.
The script will recognize this and switch off the monitor 30 seconds later.
Th script will also recognize when the screensafer unblanks, because of keypress or mousemovement and will switch on the monitor with my old resolution.
Thats perfect for me and behaves now like my console.

I am just wondering, why is there no build in solution. Why is this so hard?
For console to work it was about 30 minutes reading and setting the correct parameters. Ok for me.
For the Desktop it was for sure hours of reading and testing. Posting this here and again 2 hours of searching and programming.
That's really rough to have a proper screensaver which switches the monitor really into deep sleep.

I am happy with the solution.
If someone knows a out of the box solution i am also happy to know.
But it should be deep sleep.
All solutions i tried just ended up in another sleep mode, where the monitor still sucks > 10 Watt.
Only this solution and the console are managing < 2 Watt.

Thanks and best regards,
Stefan

csobel
Posts: 1
Joined: Mon Feb 27, 2023 11:03 am

Re: HDMI DPMS Not working on Desktop

Mon Feb 27, 2023 11:27 am

I had the same problem with the monitor not going into power save after upgrading some packages.
Before the upgrade the monitor switched into sleep correctly.

in file:
/etc/xdg/lxsession/LXDE-pi/autostart

i have following lines:
@xset s off
@xset dpms 120 120 120


The last OS image where the back light of the monitor did switch off correctly under desktop was:
raspios_armhf-2022-09-26
from https://downloads.raspberrypi.org/raspios_armhf/images/


Before reverting i checked the apt upgrade log from the day the problems started:

Code: Select all

cat /var/log/dpkg.log | grep upgrade
I suspect some of these package versions are causing the problem:

Code: Select all

2023-02-23 21:54:36 upgrade xserver-common:all 2:1.20.11-1+rpt1+deb11u4 2:1.20.11-1+rpt1+deb11u5
2023-02-23 21:54:37 upgrade xserver-xorg-core:armhf 2:1.20.11-1+rpt1+deb11u4 2:1.20.11-1+rpt1+deb11u5
2023-02-23 21:54:38 upgrade libgl1-mesa-dri:armhf 20.3.5-1+rpt4+rpi1 20.3.5-1+rpt5+rpi1
2023-02-23 21:54:42 upgrade libglx-mesa0:armhf 20.3.5-1+rpt4+rpi1 20.3.5-1+rpt5+rpi1
2023-02-23 21:54:43 upgrade libegl-mesa0:armhf 20.3.5-1+rpt4+rpi1 20.3.5-1+rpt5+rpi1
2023-02-23 21:54:43 upgrade libglapi-mesa:armhf 20.3.5-1+rpt4+rpi1 20.3.5-1+rpt5+rpi1
2023-02-23 21:54:43 upgrade libgbm1:armhf 20.3.5-1+rpt4+rpi1 20.3.5-1+rpt5+rpi1
2023-02-23 21:54:43 upgrade libnss3:armhf 2:3.61-1+deb11u2 2:3.61-1+deb11u3
2023-02-23 21:54:44 upgrade libraspberrypi-bin:armhf 1:2+git20220324~090146+c4fd1b8-1 1:2+git20220616~133208+6e8f786-1
2023-02-23 21:54:45 upgrade libraspberrypi-dev:armhf 1:2+git20220324~090146+c4fd1b8-1 1:2+git20220616~133208+6e8f786-1
2023-02-23 21:54:46 upgrade libraspberrypi0:armhf 1:2+git20220324~090146+c4fd1b8-1 1:2+git20220616~133208+6e8f786-1
2023-02-23 21:55:58 upgrade libgnutls30:armhf 3.7.1-5+deb11u2 3.7.1-5+deb11u3
2023-02-23 21:56:01 upgrade libssl1.1:armhf 1.1.1n-0+deb11u3+rpt1 1.1.1n-0+deb11u4+rpt1
2023-02-23 21:56:33 upgrade gldriver-test:all 0.11 0.12
2023-02-23 21:56:35 upgrade libde265-0:armhf 1.0.8-1+rpi1 1.0.11-0+deb11u1+rpi1
2023-02-23 21:56:35 upgrade libgles2-mesa:armhf 20.3.5-1+rpt4+rpi1 20.3.5-1+rpt5+rpi1
2023-02-23 21:56:35 upgrade libwebkit2gtk-4.0-37:armhf 2.38.2-1~deb11u1+rpi1 2.38.5-1~deb11u1+rpi1
2023-02-23 21:56:45 upgrade libjavascriptcoregtk-4.0-18:armhf 2.38.2-1~deb11u1+rpi1 2.38.5-1~deb11u1+rpi1
2023-02-23 21:56:48 upgrade libraspberrypi-doc:all 1:2+git20220324~090146+c4fd1b8-1 1:2+git20220616~133208+6e8f786-1
2023-02-23 21:56:48 upgrade libwidevinecdm0:armhf 4.10.2252.0-1 4.10.2252.0+1
2023-02-23 21:56:50 upgrade mesa-va-drivers:armhf 20.3.5-1+rpt4+rpi1 20.3.5-1+rpt5+rpi1
2023-02-23 21:56:52 upgrade mesa-vdpau-drivers:armhf 20.3.5-1+rpt4+rpi1 20.3.5-1+rpt5+rpi1
2023-02-23 21:57:15 upgrade raspinfo:all 20221220-1 20230123-1
2023-02-23 21:57:16 upgrade xwayland:armhf 2:1.20.11-1+rpt1+deb11u4 2:1.20.11-1+rpt1+deb11u5

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8403
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: HDMI DPMS Not working on Desktop

Mon Feb 27, 2023 12:48 pm

See here

Return to “Advanced users”