2022-11-14 06:57 PM
root@stm32mp1:~# uname -a
Linux stm32mp1 5.15.24 #1 SMP PREEMPT Wed Feb 16 11:56:41 UTC 2022 armv7l armv7l armv7l GNU/Linux
root@stm32mp1:~# pacmd list-sinks-inputs
No PulseAudio daemon running, or not running as session daemon.
root@stm32mp1:~# alsamixer
ALSA lib ../../alsa-plugins-1.2.6/pulse/pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Access denied
cannot open mixer: Connection refused
root@stm32mp1:~#
root@stm32mp1:~# aplay /usr/local/demo/media/ST12266_269_full_technology-freaks_0160.ogg
ALSA lib ../../alsa-plugins-1.2.6/pulse/pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Access denied
aplay: main:831: audio open error: Connection refused
My board is STM32MP157F-DK2.
As expected I can't hear anything, but in SDK V3.X.X everything works fine.
Please fix the bug as soon as possible.
Solved! Go to Solution.
2022-11-15 06:15 AM
Hi @mteaching ,
Since error return is "access denied" I wonder it may be due to a change in V4.0 compared to V3.0 :
New "weston" user now required for "wayland", which avoids executing some application with root profile for security reasons
which mainly impacts Graphic and Audio frameworks usage.
No opportunity to validate at my end right now. Could you give a try ?
Olivier
2022-11-15 06:15 AM
Hi @mteaching ,
Since error return is "access denied" I wonder it may be due to a change in V4.0 compared to V3.0 :
New "weston" user now required for "wayland", which avoids executing some application with root profile for security reasons
which mainly impacts Graphic and Audio frameworks usage.
No opportunity to validate at my end right now. Could you give a try ?
Olivier
2022-11-15 05:27 PM
You're right.
root@stm32mp1:~# su weston
weston@stm32mp1:/home/root$ alsamixer
weston@stm32mp1:/home/root$ ls /home/weston/
moon.mp3 sun.wav typescript weston.log
weston@stm32mp1:/home/root$ gst-launch-1.0 playbin uri=file:///home/weston/sun.wav
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstPulseSinkClock
Got EOS from element "playbin0".
Execution ended after 0:00:02.212815334
Setting pipeline to NULL ...
Freeing pipeline ...
weston@stm32mp1:/home/root$ gst-launch-1.0 playbin uri=file:///home/weston/moon.mp3
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstPulseSinkClock
Redistribute latency...
Got EOS from element "playbin0".
Execution ended after 0:00:07.860385379
Setting pipeline to NULL ...
Freeing pipeline ...
After I switch to 'weston' user, everything works fine.
But I'm thinking that if I write a project in C that uses both Audio frameworks and files that need to be accessed by root users, is there an easy way for root users to access audio and graphics frameworks just like SDKV3.x.x? Like the command below, gst-launch-1.0 cannot play the audio under "/home/root/"
weston@stm32mp1:/home/root$ ls /home/root/
ls: cannot open directory '/home/root/': Permission denied
weston@stm32mp1:/home/root$ gst-launch-1.0 playbin uri=file:///home/root/moon.mp3
Setting pipeline to PAUSED ...
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstFileSrc:source: Could not open file "/home/root/moon.mp3" for reading.
Additional debug info:
../gstreamer-1.20.1/plugins/elements/gstfilesrc.c(557): gst_file_src_start (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstFileSrc:source:
system error: Permission denied
ERROR: pipeline doesn't want to preroll.
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstFileSrc:source: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
Additional debug info:
../gstreamer-1.20.1/libs/gst/base/gstbasesrc.c(3556): gst_base_src_start (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstFileSrc:source:
Failed to start
ERROR: pipeline doesn't want to preroll.
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstFileSrc:source: Could not open file "/home/root/moon.mp3" for reading.
Additional debug info:
../gstreamer-1.20.1/plugins/elements/gstfilesrc.c(557): gst_file_src_start (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstFileSrc:source:
system error: Permission denied
ERROR: pipeline doesn't want to preroll.
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstFileSrc:source: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
Additional debug info:
../gstreamer-1.20.1/libs/gst/base/gstbasesrc.c(3556): gst_base_src_start (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstFileSrc:source:
Failed to start
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...
weston@stm32mp1:/home/root$
I watched the weston demo that comes with the development board. But I didn't find the statement to switch to the user weston. May I ask how it calls the audio framework with the root user?