aboutsummaryrefslogtreecommitdiff
path: root/src/survive.c
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2016-12-20 23:39:58 -0500
committercnlohr <lohr85@gmail.com>2016-12-20 23:39:58 -0500
commit2bce90b5a5095c2327bbbba1d0cc4fdb38426ce0 (patch)
treea3a955f85472f8888e2837eff821e2dc1f2219e8 /src/survive.c
parent0fb1ec7b12f5c0dbe8e82d7d029e900751fc6c6a (diff)
parent170219fe413602508b31c39df23c8938adc6c35f (diff)
downloadlibsurvive-2bce90b5a5095c2327bbbba1d0cc4fdb38426ce0.tar.gz
libsurvive-2bce90b5a5095c2327bbbba1d0cc4fdb38426ce0.tar.bz2
Merge branch 'jpicht-disambiguate'
Diffstat (limited to 'src/survive.c')
-rw-r--r--src/survive.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/survive.c b/src/survive.c
index b12c4cc..7ad2ae9 100644
--- a/src/survive.c
+++ b/src/survive.c
@@ -8,6 +8,7 @@
#include <jsmn.h>
#include <string.h>
#include <zlib.h>
+#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 &&
@@ -91,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++) {
@@ -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 ) )
@@ -162,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;