Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: Screen blanking with powered USB dac
#4
(06-18-2021, 03:25 PM)Tim Curtis Wrote: The code that wakes the display when playback starts is in /var/www/command/watchdog.sh which runs every 6 seconds. See below.

Code:
    # Wake display on play
    CARD_NUM=$(sqlite3 $SQL_DB "SELECT value FROM cfg_mpd WHERE param='device'")
    HW_PARAMS=$(cat /proc/asound/card$CARD_NUM/pcm0p/sub0/hw_params)
    TIME_STAMP=$(date +'%Y%m%d %H%M%S')
    if [[ $HW_PARAMS = "closed" ]]; then
        LOG_MSG=" watchdog: Info: Audio output is (closed)"
        #echo $TIME_STAMP$LOG_MSG >> /var/log/moode.log
    else
        TIME_STAMP=$(date +'%Y%m%d %H%M%S')
        LOG_MSG=" watchdog: Info: Audio output is (in use)"
        WAKE_DISPLAY=$(sqlite3 $SQL_DB "SELECT value FROM cfg_system WHERE param='wake_display'")
        #echo $TIME_STAMP$LOG_MSG >> /var/log/moode.log
        if [[ $WAKE_DISPLAY = "1" ]]; then
            export DISPLAY=:0
            xset s reset > /dev/null 2>&1
        fi
    fi

USB DAC is connected but not playing

Code:
pi@rp1:~ $ HW_PARAMS=$(cat /proc/asound/card2/pcm0p/sub0/hw_params)
pi@rp1:~ $ echo $HW_PARAMS
closed
pi@rp1:~ $

USB DAC is disconnected or turned off

Code:
pi@rp1:~ $ HW_PARAMS=$(cat /proc/asound/card2/pcm0p/sub0/hw_params)
cat: /proc/asound/card2/pcm0p/sub0/hw_params: No such file or directory
pi@rp1:~ $ echo $HW_PARAMS

pi@rp1:~ $ 

As you can see the code block logic does not take into account USB DAC being disconnected and will fall into the "else" branch and wake the display.

I'll add to the TODO list to fix.

That's great. Thx a lot Tim. I will mark the thread as solved.
Regards
Jörg
Reply


Messages In This Thread
Screen blanking with powered USB dac - by Kikaha - 06-11-2021, 03:08 PM
RE: Screen blanking with powered USB dac - by Kikaha - 06-19-2021, 12:29 PM

Forum Jump: