Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HiFiBerryOS 64: Analogue input service fails to start #540

Open
Wassup789 opened this issue Apr 22, 2024 · 1 comment
Open

HiFiBerryOS 64: Analogue input service fails to start #540

Wassup789 opened this issue Apr 22, 2024 · 1 comment

Comments

@Wassup789
Copy link

Wassup789 commented Apr 22, 2024

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:

  1. Access the GUI
  2. Click on "SOURCES" tab
  3. Open the Analogue Input source
  4. Turn on the service
  5. 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.

https://github.com/Wassup789/hifiberry-os/blob/a3deffddff52f890f978b3170eb128dbdba131d7/buildroot/package/hifiberry-alsaloop/dbus.conf

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.

@hifiberry
Copy link
Owner

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)

hifiberry added a commit that referenced this issue May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants