Thanks for the feedback.

infinitedigits This script is a total success for me

Great. It actually seems that there are minor changes needed to it, e.g.:

infinitedigits Once you have the config file, you need to change one line in the /lib/systemd/system/serialoscd.service to use it:

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

could you make a pull request to my repo to include this change?

2 years later

Please let me know if I need to move this question to a new post, though this post has helped me nearly get up and running.I have a Bela with latest 0.3.8 image and looking to get serialosc installed.

After some time getting apt-get update to work (couldn't find Release info or something) I finally installed the lib tools. Found somewhere that need to run echo "deb http://archive.debian.org/debian stretch main contrib non-free" > /etc/apt/sources.list.

I clone/build/install the libmonome.git however for serialosc. when configuring it seems to be successful (though fmemopen and reallocarray are checked as 'no' and windows.h is not found). When I run ./waf I get the following error
[ 1/23] Compiling src/common/util.c
gcc: error: unrecognized command line option '-std=c17'; did you mean '-std=c11'?

Waf: Leaving directory `/root/serialosc/build'
Build failed
-> task in 'serialosc-common' failed with exit status 1 (run with -v to display more information)

Any ideas?

It seems that this commit increased the C standard level from C99 to C17 for the purpose of supporting anonymous unions in accordance to the updated standard instead of using the compiler-specific __extension__ keyword. However, it looks like this improvement to the language took place in the transition from C99 to C11 (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm), so they could have as well specified C11 instead of C17. This was a pretty recent change and it doesn't look like any new code has been added since then that would rely on C17. For all of these reasons, I think it is safe to lower the requirement to C11 which is the latest C revision supported by gcc on the latest Bela version.

Apply this patch and you should be able to build:

diff --git a/wscript b/wscript
index 659328c..cdd25ab 100644
--- a/wscript
+++ b/wscript
@@ -281,9 +281,9 @@ def configure(conf):


        if conf.options.enable_debug:
-               conf.env.append_unique("CFLAGS", ["-std=c17",  "-Wall", "-g", "-Og"])
+               conf.env.append_unique("CFLAGS", ["-std=c11",  "-Wall", "-g", "-Og"])
        else:
-               conf.env.append_unique("CFLAGS", ["-std=c17", "-Wall", "-Werror", "-O2"])
+               conf.env.append_unique("CFLAGS", ["-std=c11", "-Wall", "-Werror", "-O2"])


        if conf.env.CC_NAME in ["gcc", "clang"]:

(i.e.: replace c17 with c11 in wscript). You'll have to rm -rf build and ./waf configure again after this for the changes to be picked up.

Thanks! Some success. I just changed wscript file directly from c17 to c11 and it now seems to build and install correctly.

I run the journalctl command and it reports following when plugging in

'Nov 12 05:47:49 bela serialoscd[17492]: serialosc [m1001113]: connected, server running on port 19852'
when unplugging it reports
'Nov 12 05:48:09 bela serialoscd[17492]: serialosc [m1001113]: couldn't write config :(
Nov 12 05:48:09 bela serialoscd[17492]: serialosc [m1001113]: disconnected, exiting'

Not being able to write config is a problem now as see I need to edit this file to fix port address. I see the ~/.config hidden folder but clearly no config is written there
if I run serialoscd it has made a serialosc folder under config but unplugging device does not generate the appropriate .conf file

Im sure there's miles to go still to get a monome max script running on the Bela but this is the first hurdle - thank you!

I was also trying to install this with the max/rnbo tutorial in the monome package, even after I update apt it could not find the serialosc package when typing sudo apt-get install serialosc.

Anyway, up and running now with serialosc starting at boot - a good start

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