From Newsgroup: comp.sys.raspberry-pi
R.Wieser wrote:
Although you did not mention it, I take it you picked up on that just >disabeling HDMI output doesn't cause my TV to switch back to its previous >input. Which means that that vcgencmd doesn't seem to be the sought-for >solution (and nullifies the need to test it).
I just asked ChatGPT if it knew an answer, and it did (not that I am
certain if it works):
Yes, it is possible for a Raspberry Pi to send a signal to a TV to
switch the HDMI input before shutting down. This can be done using CEC (Consumer Electronics Control), a feature available through HDMI that
allows devices to communicate with each other and exchange basic control commands.
Here’s how you can do it:
Check if the TV supports CEC: Not all TVs support CEC, and it may be
branded under different names like "Anynet+" (Samsung), "BRAVIA Sync"
(Sony), "Simplink" (LG), etc.
Install CEC tools: On the Raspberry Pi, you can install the cec-utils
package, which includes a tool called cec-client. This tool allows you
to send CEC commands.
bash
Code kopieren
sudo apt-get update
sudo apt-get install cec-utils
Send CEC commands: You can use cec-client to send various commands to
the TV. For example, to instruct the TV to switch to a different HDMI
input, you can use specific CEC commands.
Create a script: You can create a simple script that sends the CEC
command when the Raspberry Pi is about to shut down. For example:
bash
Code kopieren
#!/bin/bash
echo "as" | cec-client -s
The command echo "as" | cec-client -s tells the CEC client to switch the
active HDMI source.
Execute the script on shutdown: To automatically run the script when the Raspberry Pi shuts down, you can add it to the /etc/rc.local file or
create a Systemd service.
Keep in mind that the exact commands and setup may vary depending on
your TV model and the supported CEC functions. It's a good idea to refer
to your TV's manual for specific information about its CEC support.
-jw-
--
And now for something completely different...
--- Synchronet 3.19b-Win32 NewsLink 1.113