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.
display_power, mine does not includepower_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/syswill 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/Sysfsapt install treethensudo tree /sys > sysfs.txtmay provide you with help in your poking around. – goldilocks Jan 13 '24 at 15:10