Talk:ALSA
From ArmadeusWiki
Use audio devices as non-root user
- Create a group that will get permission on the audio device
- Add the non-root user to this group.
- Give permission to this group at boot time.
To do this, run the following command as root on your APF. Don't forget to adjust the u and g variables!
Warning: If you already have a script loading the ALSA module at boot time and called S60alsa, it will be overwritten by this script. |
u=guest # the non-root username g=audio # the group that will get permissions on the resources # Create the new group: addgroup $g # Add the non-root user to the group: l=`grep $g /etc/group` ug=`echo $l | awk -F : '{print $4}'` sed " /$l/ c\ $l`! [ $ug ] || echo ,`$u " /etc/group > /etc/group # Give permission to the group at boot time: cat <<eof >/etc/init.d/S60alsa #!/bin/sh # The spi_imx module does not seem to be required by the ALSA one. modprobe snd-imx-alsa-tsc2102 # wait for the creation of all nodes sleep 2 # give permissions of the sound device to the audio group chown root:audio /dev/snd/* eof chmod a+x /etc/init.d/S60alsa
After reboot, you should be able to play audio files as guest user.