I have looked into this and I am unsure I can test this any further without having a monome myself. Try adding this printf statement so we know what path it's trying to open:

diff --git a/src/serialosc-device/config.c b/src/serialosc-device/config.c
index b6fda47..d3a05fd 100644
--- a/src/serialosc-device/config.c
+++ b/src/serialosc-device/config.c
@@ -135,6 +135,7 @@ sosc_config_write(const char *config_dir, const char *serial, sosc_state_t *stat
                path = path_for_serial(sosc_get_default_config_dir(), serial);
        }

+       printf("FOPEN PATH %s\n", path);
        if (!(f = fopen(path, "w"))) {
                s_free(path);
                return 1;

Rebuild, restart, replug

mmm, on disconnecting device I get this message

Nov 13 05:28:22 bela serialoscd[195]: serialosc [m0000606]: couldn't write config :(
Nov 13 05:28:22 bela serialoscd[195]:  [-] bad message, bailing out
Nov 13 05:28:22 bela serialoscd[195]: serialosc [m0000606]: disconnected, exiting

appear to not be printing out the path

OK try this change:

diff --git a/src/serialosc-device/server.c b/src/serialosc-device/server.c
index 1afdc7a..f1f8622 100644
--- a/src/serialosc-device/server.c
+++ b/src/serialosc-device/server.c
@@ -315,8 +315,8 @@ sosc_server_run(const char *config_dir, monome_t *monome)

        if (sosc_config_write(config_dir, monome_get_serial(state.monome), &state)) {
                fprintf(
-                       stderr, "serialosc [%s]: couldn't write config :(\n",
-                       monome_get_serial(state.monome));
+                       stderr, "serialosc [%s]: couldn't write config to %s :(\n",
+                       monome_get_serial(state.monome), config_dir);
        }

 err_svc_name:

Just tried quickly before heading to work, response back was
couldn't write config to (null) 🙁

Try this?

diff --git a/src/serialosc-device/config.c b/src/serialosc-device/config.c
index b6fda47..69e5401 100644
--- a/src/serialosc-device/config.c
+++ b/src/serialosc-device/config.c
@@ -124,6 +124,7 @@ sosc_config_write(const char *config_dir, const char *serial, sosc_state_t *stat
        const char *p;
        FILE *f;

+       printf("sosc_config_write(%s, %s, %p)\n", config_dir ? config_dir : "(null)", serial ? serial : "(null)", state);
        if (!serial)
                return 1;

@@ -135,6 +136,7 @@ sosc_config_write(const char *config_dir, const char *serial, sosc_state_t *stat
                path = path_for_serial(sosc_get_default_config_dir(), serial);
        }

+       printf("FOPEN PATH %s\n", path);
        if (!(f = fopen(path, "w"))) {
                s_free(path);
                return 1;

Honestly, I don't think there's anything Bela-specific here, I am wondering if it's an upstream issue or an issue with your device (does it work elsewhere?)

when connecting and disconnecting it report
root@bela:~# journalctl -f -n 50 -u serialoscd
-- Logs begin at Thu 2016-11-03 17:16:43 UTC. --
Nov 12 07:33:25 bela systemd[1]: Started serialosc daemon.
Nov 14 05:38:25 bela serialoscd[163]: serialosc [m0000606]: connected, server running on port 12088
Nov 14 05:38:31 bela serialoscd[163]: serialosc [m0000606]: couldn't write config to (null) 🙁
Nov 14 05:38:31 bela serialoscd[163]: [-] bad message, bailing out
Nov 14 05:38:31 bela serialoscd[163]: serialosc [m0000606]: disconnected, exiting

Sorry for the day long responses!, im working long hours at the moment...

hmm did you actually do make install after applying the latest patch? This error message looks identicla to the previous one.

Hi! I just check and did it again. same output

Could this related to any of the messages I get when I run ./waf configure ? When its doing its checking (for compiler etc) everything is reported as yes (in green) however checking for funopen and reallocarray are reported as no (orange) plus checking for header windows.h it reports not found (again, in orange).

Says that the configure was successfully finished so appears okay but did wonder

    jonnybela Could this related to any of the messages I get when I run ./waf configure ? When its doing its checking (for compiler etc) everything is reported as yes (in green) however checking for funopen and reallocarray are reported as no (orange) plus checking for header windows.h it reports not found (again, in orange).

    Says that the configure was successfully finished so appears okay but did wonder

    that's all good actually. waf tries to figure out what resources are available and if something is optional it will be fine if it's not present. It would fail if anything required was missing.

    jonnybela Hi! I just check and did it again. same output

    Did you restart the process as well? It doesn't quite make sense because sosc_config_write() is called before couldn't write config to is printed, so the fprintf that we add in there should be printed as well.

    Can you show the result of grep sosc_config_write src/serialosc-device/config.c just to make sure the printing is actually there?

    Or maybe change the printf in that file to fprintf(stderr, in case there's some magic made to remove stdout but keep stderr.

    root@bela:~/serialosc# grep sosc_config_write src/serialosc-device/config.c
    sosc_config_write(const char *config_dir, const char *serial, sosc_state_t *state)
    printf("sosc_config_write(%s, %s, %p)\n", config_dir ? config_dir : "(null)", serial ? serial : "(null)", state);
    root@bela:~/serialosc#

    How do I restart the process? I typically run systemctl (start/stop) serialoscd

      I get an err changing line to
      fprintf(stderr("FOPEN PATH %s\n",path));

      I don't know c but assume needed extra brackets in there

      or did you mean on this line?
      printf("sosc_config_write(%s, %s, %p)\n", config_dir ? config_dir : "(null)", serial ? serial : "(null)", state);

      change it to
      fprintf(stderr("sosc_config_write(%s, %s, %p)\n", config_dir ? config_dir : "(null)", serial ? serial : "(null)", state));

      Gotcha, now when i plugin, plug out
      Nov 15 17:12:40 bela serialoscd[195]: serialosc [m0000606]: connected, server running on port 10143
      Nov 15 17:12:44 bela serialoscd[195]: sosc_config_write((null), m0000606, 0xbea70c08)
      Nov 15 17:12:44 bela serialoscd[195]: FOPEN PATH (null)/.config/serialosc/m0000606.conf
      Nov 15 17:12:44 bela serialoscd[195]: serialosc [m0000606]: couldn't write config to (null) 🙁
      Nov 15 17:12:44 bela serialoscd[195]: serialosc [m0000606]: disconnected, exiting

      right, so it's not looking into /root/.config but in /.config. What do you get with grep ExecStart /lib/systemd/system/serialoscd.service ?

        Not quite sure what you mean

        typing grep ExecStart /lib/systemd/system/serialoscd.service
        only returns
        ExecStart=/usr/local/bin/serialoscd

        i.e .it doesn't return -c/.config/serialosc

        you need to edit /lib/systemd/system/serialoscd.service and replace

        ExecStart=/usr/local/bin/serialoscd

        with

        ExecStart=/usr/local/bin/serialoscd -c ~/.config/serialosc/

        then do systemctl daemon-reload; systemctl restart serialoscd and it should work