Systemd config for Raspa app

Hello,

I’m tinkering on an Elk app that is not a JUCE plugin, but an application that interfaces Raspa directly. I’ve gotten it running on an RasPi4 + HifiBerry DAC2 and Elk.

However, I’d like to have the app start when the device is booting. I noticed systemd is being used, so attempted to write a service file and enable, but it seems my app is starting too early, before the audio device/driver is ready. I see the following error message: Failed to open driver (Operation not permitted)., but can ssh into device and start the service every time.

What is the proper systemd service configuration to use? This is my current one (where I’ve called the app X):

[Unit]
Description=X service
Wants=custom-elk.target
After=custom-elk.target

[Service]
User=root
WorkingDirectory=/home/mind
ExecStart=/home/mind/X
Restart=always

[Install]
WantedBy=custom-elk.target

I realize the Wants=, After=, WantedBy= values may not be consistent, but I’ve been trying different combos but no succeeding. Thanks!

Update: The above does indeed seem to be a configuration that achieves what I want.
I think the systemd config got into a bad state as I was trying different alternatives. After 1) sudo systemctl disable X then 2) sudo systemctl enable X and 3) a reboot, it’s firing up as expected.

1 Like

That is very interesting, I might be interested in interfacing RASPA directly from an application as well. At some point I tried to write some custom drivers but I have 0 experience with that… Is this what you did? Will you make the code available?

Hi Frederic,

At some point I tried to write some custom drivers but I have 0 experience with that… Is this what you did?

No, I simply had an audio generating application (not a DAW plugin) that I wanted to run on an Elk OS powered RasPi4. I mainly looked at the example code in the Raspa apps and the Sushi CMake for inspiration.

It’s generally doing what I want but I’m getting intermittent hard crashes that I have a hard time debugging. I will open a separate question for that.