HiFiBerryOS 64: Analogue input service fails to start
Wassup789 opened this issue · comments
Describe the bug
On HifiBerryOS 64, the analogue Input / alsaloop service does not start or function as expected. When an attempt to enable the service is started, it instantly goes to a failed state.
I have attached a PR that partially fixes this issue (see "Additional context"). However, the issue with the Python script running the audio loopback still persists.
This bug and the fixes were performed on a Raspberry Pi 5.
HiFiBerryOS version
20240410
HiFiBerry sound card
DAC+ ADC Pro
Steps to reproduce the behavior:
- Access the GUI
- Click on "SOURCES" tab
- Open the Analogue Input source
- Turn on the service
- Service should fail to start (internally)
Expected behavior
The analogue input / alsaloop service should start and audio loopback should begin as expected.
Additional context
Solving the issue with the alsaloop
service
Investigating the journalctl
logs, the issue seems to be the alsaloop
service failing to start.
Relevant log
Alsaloopwrapper thread exception: org.freedesktop.DBus.Error.AccessDenied: Connection ":1.155" is not allowed to own the service "org.mpris.MediaPlayer2.alsaloop" due to security policies in the configuration file
Which suggests that the D-Bus configuration file for the alsaloop
does not exist. I created the following file in /usr/share/dbus-1/system.d/alsaloop.conf
which resolves the alsaloop
service failing to start.
I have submitted a PR for this fix here: #539
New issue with alsaloop.py
Though the service starts, I encountered another error specifically with the alsaloop.py
script that crashes when the script begins audio loopback.
Relevant log
Traceback (most recent call last):
File "/opt/alsaloop/alsaloop.py", line 194, in <module>
output_device.write(data)
alsaaudio.ALSAAudioError: Broken pipe [default]
This appears to be a known issue with the pyalsaaudio package (see larsimmisch/pyalsaaudio#130), which suggests an issue with specifically v0.10.0.
I was able to confirm that the alsaloop.py
script (and consequently the full alsaloop
service) works when I downgraded the version of pyalsaaudio
to v0.9.2 (by cross-compiling the pyalsaaudio
package and directly loading the compiled binaries from the alsaloop.py
script).
This bug has been reverted, however, there have not been any releases that contain this fix (the latest version is still 0.10.0).
I am not sure what is the best fix for this as I was unable to figure out a way to get alsaloop.py
to work with v0.10.0 and it seems that the other services in this repository depend on the pyalsaaudio
package as well, but this should provide a good jump start.
I have implemented some changes that seem to work her. Unfortunately I don't have an analog audio source here to test this. I recommend to try with the net alpha release when it's available (hopefully next week)