Hi, I'm sorry to reply on such an old post but I'm facing a similar issue and I'm also using a sound-card from AudioInjector, the stereo sound-card.
I'm developing an intercom based of a RPi and for that I'm using twinkle sip phone. Let me start by saying that everything is functional as long as I don't use a systemd service in order to run my script at boot, doing so also returns either device busy, or just not accessible at all, see errors below.
IMPORTANT: This issue only happens when I force CLI boot mode, if I use GUI boot mode I have no issues but I have no interest in having GUI interface.
Quote:
Sep 03 07:38:18 raspberrypi python[1029]: Critical: Opening ALSA driver failed: snd_pcm_hw_params_set_channels(1) failed: Invalid argument
Sep 03 07:38:18 raspberrypi python[1029]: Critical: Opening ALSA driver failed: snd_pcm_hw_params_set_channels(1) failed: Invalid argument
Sep 03 07:38:18 raspberrypi python[1029]: Critical: Opening ALSA driver failed: snd_pcm_hw_params failed: Invalid argument
Sep 03 07:38:18 raspberrypi python[1029]: Warning: Cannot access the ring tone device (ALSA: default).
Sep 03 07:38:18 raspberrypi python[1029]: Cannot access the speaker (ALSA: default).
Sep 03 07:38:18 raspberrypi python[1029]: Cannot access the microphone (ALSA: plughw:0,0).
|
I also tried changing the device to use, in the case of sysdefault the error was slightly different:
Quote:
Sep 03 07:42:55 raspberrypi python[1197]: Critical: Opening ALSA driver failed: snd_pcm_hw_params failed: Invalid argument
Sep 03 07:42:55 raspberrypi python[1197]: Critical: Opening ALSA driver failed: snd_pcm_hw_params failed: Invalid argument
Sep 03 07:42:55 raspberrypi python[1197]: Critical: Opening ALSA driver failed: snd_pcm_hw_params failed: Invalid argument
Sep 03 07:42:55 raspberrypi python[1197]: Warning: Cannot access the ring tone device (ALSA: sysdefault:0).
Sep 03 07:42:55 raspberrypi python[1197]: Cannot access the speaker (ALSA: sysdefault:0).
Sep 03 07:42:55 raspberrypi python[1197]: Cannot access the microphone (ALSA: sysdefault:0).
|
There's another "small" detail I noticed, if I start the script myself, it won't work the first time, second time does. This has something to do with pulseaudio, even tho my sound-card is fully recognized and setup at boot if I, for example, run 'amixer' and only then run my script it works flawlessly as if something related with pulseaudio was not initiated at boot. I searched and saw no pulseaudio.service is this normal?
My service config:
Quote:
[Unit]
Description=BUTTON SIP CALL
After=sound.target network.target
Requires=sound.target
[Service]
ExecStart=/usr/bin/python -u intercom.py
WorkingDirectory=/home/pi/Desktop
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi
#Environment=DISPLAY=:0
[Install]
WantedBy=multi-user.target
|
Any help is greatly appreciated.