I hope some experts can assist with solving my problem
My application runs on a stand-alone embedded system and doesn't require to be logged on to operate. My application starts at boot time and is a standalone app running on an isolated embedded system. It monitors data on a COM port and needs to play a wav file under certain circumstances, triggered by data from the COM port.
I am running Crunchbang O/S
1 - When the system boots my application starts under root, but there is no audio
2 - If I login to a terminal session there is still no audio
3 - If I restart the application under my logged-in account there
is audio
4 - If I log out, there is no audio again
5 - If I log in to the terminal again, audio works again
My app runs as UID of root
This is the error message produced when my app calls aplay when I am logged out:
"sending: /usr/bin/aplay"
Code:
Invalid MIT-MAGIC-COOKIE-1 keyxcb_connection_has_error() returned true
Invalid MIT-MAGIC-COOKIE-1 keyxcb_connection_has_error() returned true
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
aplay: main:682: audio open error: Connection refused
This is the message when my app calls aplay and I am logged in
"sending: /usr/bin/aplay"
Code:
Playing WAVE '/usr/mms/cfg/audio_files/12-1-10-1' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
When I am logged on, ps -Af shows these
possibly related processes
Code:
1000 4441 1 0 11:04 ? 00:00:00 pnmixer
1000 4460 1 0 11:04 ? 00:00:00 xfce4-volumed
1000 4461 1 0 11:04 ? 00:00:00 xfce4-power-manager
1000 4488 1 0 11:04 ? 00:00:00 /usr/bin/pulseaudio --start
1000 4584 1 0 11:05 ? 00:00:00 /usr/lib/gvfs/gvfs-gdu-volume-monitor
1000 4586 1 0 11:05 ? 00:00:00 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
1000 4588 1 0 11:05 ? 00:00:00 /usr/lib/gvfs/gvfs-afc-volume-monitor
None of these processes are there when I am logged out
I think I need pulse audio (and maybe other sound related programs) to start as root when the system is booted, rather than when a user logs in. I read articles advising against this, but my app is a standalone app running on an isolated embedded system, so I have weighed up the risks.
Does this sound feasible, and can anybody advise how I get pulseaudio (and other required audio processes) to start at boot-time on Crunchbang?
I am
very new to Linux.
Thank you all
VideoTrack