Catalyst-Live system-files and auto connect request for streaming from IoT device

We are building an IoT device that can stream video and 2 way communication for audio using WebRTC protocol.

This requires a couple plugs: alsa, audio-playback, audio-record, and camera.

Also, We ran into an issue where several system files are needed for ALSA (read only). /user/share/alsa/alsa.conf and /etc/asound.conf

This request is to provide auto connect and system-files access to Catalyst-Live.

this should be solved through an alsa part instead of a system-files interface … see:

1 Like

@ogra Thanks for the response.

I am new to snaps but this solution seems to has several major drawbacks. I do not want to maintain a separate version of ALSA. This means any bug fixes or security patches will require a new snap to be released, correct?

Let me know if there is a better way than having to maintain my own version.

@ogra I have made the changes outlined in the document you provided and that solved the issue with the missing file.

My next question is about the /etc/asound.conf file. This is needed to configure which device to stream the audio to/from. It seems it’s not able to read this file. I cannot package this with the snap since this is something the user can change.

I’m getting the error: Invalid CTL default and Invalid PCM default

What am I missing?

i think “needed” is a broad statement, i guess it is rather rare nowadays that people touch it (vs simply using something like pavuctrl (given that the majority of desktops nowadays integrates with pulse and you can tweak everything there))
i dont think ubuntu at least has shipped /etc/asound.conf in the last decade …

nontheless you are indeed correct that people can configure alsa through it and i guess it would make sense to add read access to that file directly in

@jdstrand was there any particular security concern why read access to /etc/asound.conf was not added to the alsa interface ?

@ogra @jdstrand This may be because I am targeting Raspian OS. At the top of the /usr/share/alsa/alsa.conf, it is preloading the following config files:

# pre-load the configuration files

@hooks [
	{
		func load
		files [
			"/etc/alsa/conf.d"
			"/etc/asound.conf"
			"~/.asoundrc"
		]
		errors false
	}
]

# load card-specific configuration files (on request)

cards.@hooks [
	{
		func load
		files [
			{
				@func concat
				strings [
					{ @func datadir }
					"/cards/aliases.conf"
				]
			}
		]
	}
	{
		func load_for_all_cards
		files [
			{
				@func concat
				strings [
					{ @func datadir }
					"/cards/"
					{ @func private_string }
					".conf"
				]
			}
		]
		errors false
	}
]

I tried packaging the raspian /usr/share/alsa directory which is the @datadir listed in this config file but still get the errors Invalid CTL default and Invalid PCM default

In Raspian, if you have multiple sound devices, you can change the device in the UI and it will update the ~/.asoundrc with the appropriate device id.

Since I am running this as a snap daemon, the next best configuration file for the sound card is the /etc/asound.conf so that is why I was asking for system-files permission to this.

At this point, I am stuck and have no work-around. Any help is very much appreciated!

Looks like the solution originally provided only works for Ubuntu using PulseAudio. https://snapcraft-alsa.readthedocs.io/en/latest/snapcraft_usage.html

Is it possible to grant me system-files access for /usr/share/alsa directory and /etc/asound.conf since this solution will not work on Raspian OS?

I have tried to bypass the sandbox using devmode but these files are not accessible, so I am stuck.

Let me know if I’m SOL and need to find a different way to deliver my product.

Use of the alsa interface requires special configuration. Keep in mind, granting access via system-files to /usr/share/alsa would not help because /usr comes from the base snap, not the host’s filesystem. You should adjust your snap to configure alsa accordingly. I believe @daniel and/or the @advocacy team have additional information that might assist you in getting the alsa interface to work.

-1 for use of system-files.

Thanks for taking the time to respond.

I have tried the solution provided but it is only for Ubuntu using pulseaudio. I’m trying to deploy my app to Raspian. I have a C++ app that includes a WebRTC library that require libsdl2-2.0 that requires alsa. Requiring a special configuration and recompiled alsa library is quite a lot to ask.

Any other documentation, tutorials or examples that will help solve this is appreciated.