0

In times past, I used tvservice to turn the monitor on/off in a script. Now I understand vcgencmd is the current method. I'm running RPi OS 12.4 on a 4GB RPi 5.

I installed lib-rasbperrypibin. vcgencmd and the man page refers to the display_power subcommand:

 display_power 0|1|-1
       display_power 0|1|-1 display
              Show current display power state, or set the  display  power  state.   vc‐
              gencmd  display_power  0  will turn off power to the current display.  vc‐
              gencmd display_power 1 will turn on power to the display. If no  parameter
              is  set, this will display the current power state. The final parameter is
              an optional display ID, as returned by tvservice -l or from the table  be‐
              low, which allows a specific display to be turned on or off.

But the vcgencmd command doesn't seem to know about the display_power:

# vcgencmd display_power 0
vc_gencmd_read_response returned -1
error=1 error_msg="Command not registered"
# vcgencmd display_power 0 2
vc_gencmd_read_response returned -1
error=1 error_msg="Command not registered"
# vcgencmd display_power
vc_gencmd_read_response returned -1
error=1 error_msg="Command not registered"
# vcgencmd commands
commands="commands, set_logging, bootloader_config, bootloader_version, cache_flush, codec_enabled, get_mem, get_rsts, measure_clock, measure_temp, measure_volts, get_hvs_asserts, get_config, get_throttled, pmicrd, pmicwr, read_ring_osc, version, readmr, otp_dump, pmic_read_adc, power_monitor"

So what is the OS 12 way to turn the monitor on/off?

Note I'm not using X Window in this environment. The specific application is a digital photo frame-type system (using fbi) where I want to power off the monitor at night when everyone is in bed.

  • This works on a Pi 4 even with no display attached. However, while your list of commands doesn't include display_power, mine does not include power_monitor. Try that. Also, have a look in /sys/class/graphics, one of the writable node in there might work. – goldilocks Jan 12 '24 at 19:39
  • VideoCore is no longer used to control display with new video drivers. – Milliways Jan 12 '24 at 21:01
  • @goldilocks I think power_monitor is about power management? Unfortunately, there's nothing about it on the man page. It's looking for arguments "tracename" "start/stop", "VDD_CORE_V", and "VDD_CORE_A". – raindog308 Jan 12 '24 at 21:51
  • Ah, that makes more sense. Oh well. Very possibly something in /sys will work; I don't have a Pi 5 yet so can't say exactly what. If you don't know what it is: https://en.wikipedia.org/wiki/Sysfs apt install tree then sudo tree /sys > sysfs.txt may provide you with help in your poking around. – goldilocks Jan 13 '24 at 15:10

1 Answers1

0

If vcgencmd doesn't work, you might try installing cec-utils & try that:

sudo apt update
sudo apt install libcec3 cec-utils
echo 'standby 0' | cec-client -s -d 1    # turns OFF
echo 'on 0' | cec-client -s -d 1         # turns ON

REFERENCES: (obtained via search engine raspberry pi HDMI interface):

Seamus
  • 21,900
  • 3
  • 33
  • 70