From e38794620822122fe66c3252cfe083c644dd4c42 Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Wed, 2 Nov 2016 17:20:31 +0000 Subject: [PATCH] jsonplatform.c: Disable i2c bus in case of bus count being high but busses are undefined Signed-off-by: Brendan Le Foll --- src/json/jsonplatform.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/json/jsonplatform.c b/src/json/jsonplatform.c index bfc74c6..25a96ce 100644 --- a/src/json/jsonplatform.c +++ b/src/json/jsonplatform.c @@ -282,6 +282,9 @@ mraa_init_json_platform_i2c(json_object* jobj_i2c, mraa_board_t* board, int inde mraa_result_t ret = MRAA_SUCCESS; json_object* jobj_temp = NULL; + // disable bus if we error out + board->i2c_bus[pos].bus_id = -1; + // Get the I2C bus array index ret = mraa_init_json_platform_get_index(jobj_i2c, I2C_KEY, INDEX_KEY, index, &pos, board->i2c_bus_count - 1); if (ret != MRAA_SUCCESS) {