init.dスクリプトはalsaオーディオにアクセスできません。

init.dスクリプトはalsaオーディオにアクセスできません。

始めるために、単純なinit.dスクリプトを書いた。ハードウェア監視スクリプト。うまくいきますが、alsaオーディオサービスにアクセスできません。

#! /bin/sh

SCRIPT_PATH="/d/SharedPrograms/hwleds.py"

case $1 in
    start)
        say "starting service hwleds..."
        python $SCRIPT_PATH &
        exit $?
        ;;
    stop)
        pkill -f "python $SCRIPT_PATH"
        exit $?
        ;;
    restart)
        $0 stop
        sleep 1
        $0 start
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac

exit 1

sayコマンドとPythonスクリプトで発生するエラーは次のとおりです。

audio_open_alsa: failed to open audio device default. Operation not permitted

編集:Pythonスクリプトが対話型シェルを介してrootユーザーによって正常に起動されている場合は、起動プロセス中にサービスとして起動した場合にのみalsaにアクセスできますservice hwleds start

私の実際の状況/root/.asoundrc

defaults.pcm.card 0
defaults.pcm.device 3

ctl.equal {
  type equal;
}

pcm.plugequal {
  type equal;
  # Modify the line below if you don't
  # want to use sound card 0.
  slave.pcm "plughw:0,3";
  # or if you want to use with multiple applications output to dmix
  # slave.pcm "plug:dmix"
}

#pcm.equal {
  # Or if you want the equalizer to be your
  # default soundcard uncomment the following
  # line and comment the above line.
 pcm.!default {
  type plug;
  slave.pcm plugequal;
}

ベストアンサー1

Volumioでも同じ問題があります。削除して.alsaequal.bin解決しました。/var/lib/mpd/

おすすめ記事