sudo tee /etc/udev/rules.d/69-hdmi-audio-check.rules <<EOF # Run the HDMI audio check script before the alsa-restore.service ACTION=="add", SUBSYSTEM=="sound", TAG+="systemd", ENV{SYSTEMD_WANTS}="check-hdmi-card.service", ENV{SYSTEMD_WANT_BEFORE}="alsa-restore.service" EOF
sudo tee /usr/lib/deepin-api/check-hdmi-card.sh <<EOF #!/bin/bash
# Check HDMI audio devices hdmi_found=false
for eld_file in /proc/asound/card*/eld#*; do if [ -e "$eld_file" ]; then echo "HDMI audio device information is available in $eld_file:" cat "$eld_file"
if [ "$monitor_present" = "1" ] && [ "$eld_valid" = "1" ]; then hdmi_found=true # Perform additional actions as needed here fi else echo "No HDMI audio device found in $eld_file." fi done
# Output the result if [ "$hdmi_found" = true ]; then echo "HDMI audio device is ready and connected to an HDMI monitor." else echo "No HDMI audio device found or not connected to an HDMI monitor." fi EOF