[alsa-devel] Reset to clean state after snd_ctl_add_integer_elem_set ?

Clemens Ladisch clemens at ladisch.de
Tue Jul 18 13:03:29 CEST 2017


Fulup Ar Foll wrote:
> I'm using snd_ctl_add_boolean_elem_set and snd_ctl_add_integer_elem_set
> to create some user kernel controls. While the operation work find I
> did not find any simple command to erase all those controls.
>
> Even "/usr/sbin/alsactl --init" does not remove those added controls.
> The only way I find is to prevent  /usr/sbin/alsactl to happen during
> reboot to really reset the ALSA driver to an initial state, which is
> really not pratical when developing/debugging.
>
> Question: is there a simple method to return to a clean and fresh state
> after snd_ctl_add_xxxx without rebooting the machine ?

There is no ownership information for user controls, so "alsactl store"
and "alsactl restore" always keep them.

To remove them, you can write a tool to call snd_ctl_elem_remove() on
all of them.  Alternatively, unload the driver module, and remove the
entries from the saved state file (probably /var/lib/alsa/asound.state).


Regards,
Clemens


More information about the Alsa-devel mailing list