6 Replies Latest reply on Feb 22, 2015 10:42 PM by mhahn

    How to run a program at startup (systemd) that uses libmraa?


      I have looked but did not find this question: When creating a programname.service file for systemd, to start a program that uses mraa, it appearently needs an "After=something".

      What is the "something"?


      I modified the blink-io.c example, and it blinks my LED.


      Next, make it start at boot.

      It had to have "sleep(5);" near the top of main(), or it would just hang and never blink.

      Even then I get the message "gpio: Failed to write to export":


      root@jason:/# systemctl status blinkmyled

      ● blinkmyled.service - Edison Mini board LED Blinker

         Loaded: loaded (/lib/systemd/system/blinkmyled.service; enabled)

         Active: active (running) since Thu 2015-02-19 23:48:27 UTC; 16s ago

      Main PID: 402 (blinkmyled)

         CGroup: /system.slice/blinkmyled.service

                 └─402 /usr/local/bin/blinkmyled


      Feb 19 23:48:27 jason systemd[1]: Started Edison Mini board LED Blinker.

      Feb 19 23:48:27 jason libmraa[402]: gpio: Failed to write to export

      Feb 19 23:48:32 jason blinkmyled[402]: MRAA Version: v0.6.0

      Feb 19 23:48:32 jason blinkmyled[402]: Starting Blinking on IO15



      So apparently it needs something else started before it is, but what? sysfs? but where does that start?

      Or is it a permission problem?  I tried "User=root", changed noting.