From 093802f9cc7ebaa0bfe8d862766e7e08026576f0 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Tue, 20 Dec 2016 22:44:10 -0500 Subject: switch to a hidden disambiguator. --- src/survive.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/survive.c') diff --git a/src/survive.c b/src/survive.c index b12c4cc..73df29d 100644 --- a/src/survive.c +++ b/src/survive.c @@ -8,6 +8,7 @@ #include #include #include +#include "disambiguator.h" static int jsoneq(const char *json, jsmntok_t *tok, const char *s) { if (tok->type == JSMN_STRING && (int) strlen(s) == tok->end - tok->start && @@ -146,12 +147,15 @@ struct SurviveContext * survive_init() ctx->headset.ctx = ctx; memcpy( ctx->headset.codename, "HMD", 4 ); + ctx->headset.d = calloc( 1, sizeof( struct disambiguator ) ); ctx->watchman[0].ctx = ctx; memcpy( ctx->watchman[0].codename, "WM0", 4 ); + ctx->watchman[0].d = calloc( 1, sizeof( struct disambiguator ) ); ctx->watchman[1].ctx = ctx; memcpy( ctx->watchman[1].codename, "WM1", 4 ); + ctx->watchman[1].d = calloc( 1, sizeof( struct disambiguator ) ); //USB must happen last. if( r = survive_usb_init( ctx ) ) -- cgit v1.2.3 From 170219fe413602508b31c39df23c8938adc6c35f Mon Sep 17 00:00:00 2001 From: cnlohr Date: Tue, 20 Dec 2016 23:36:55 -0500 Subject: get the new disambiguator closer, but it's still not perfect. --- src/survive.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/survive.c') diff --git a/src/survive.c b/src/survive.c index 73df29d..7ad2ae9 100644 --- a/src/survive.c +++ b/src/survive.c @@ -92,12 +92,12 @@ static int LoadConfig( struct SurviveContext * ctx, struct SurviveObject * so, i int i; int r = jsmn_parse(&p, ct0conf, len, t, sizeof(t)/sizeof(t[0])); if (r < 0) { - SV_ERROR("Failed to parse JSON in HMD configuration: %d\n", r); - return 0; + SV_INFO("Failed to parse JSON in HMD configuration: %d\n", r); + return -1; } if (r < 1 || t[0].type != JSMN_OBJECT) { - SV_ERROR("Object expected in HMD configuration\n"); - return 0; + SV_INFO("Object expected in HMD configuration\n"); + return -2; } for (i = 1; i < r; i++) { @@ -166,8 +166,8 @@ struct SurviveContext * survive_init() //Next, pull out the config stuff. if( LoadConfig( ctx, &ctx->headset, 1, 0, 0 ) ) goto fail_gracefully; - if( LoadConfig( ctx, &ctx->watchman[0], 2, 0, 1 ) ) goto fail_gracefully; - if( LoadConfig( ctx, &ctx->watchman[1], 3, 0, 1 ) ) goto fail_gracefully; + if( LoadConfig( ctx, &ctx->watchman[0], 2, 0, 1 ) ) { SV_INFO( "Watchman 0 config issue." ); } + if( LoadConfig( ctx, &ctx->watchman[1], 3, 0, 1 ) ) { SV_INFO( "Watchman 1 config issue." ); } /* int i; -- cgit v1.2.3