From 71118af2335eda8fcb196d476b6b5176600063bc Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Mon, 15 Dec 2014 11:47:21 +0000 Subject: [PATCH] mraa.c: do not check return value of mraa_gpio_dir when used on muxes Doing so breaks galileo gen2 (gpio2) and others. Failing early is rather pointless in any case so we may as well attempt the write, muxes do not neccesarily have directions that work Fixes #68 Signed-off-by: Brendan Le Foll --- src/mraa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mraa.c b/src/mraa.c index 12180b2..8831bc2 100644 --- a/src/mraa.c +++ b/src/mraa.c @@ -132,10 +132,10 @@ mraa_setup_mux_mapped(mraa_pin_t meta) if (mux_i == NULL) { return MRAA_ERROR_INVALID_HANDLE; } - if (mraa_gpio_dir(mux_i, MRAA_GPIO_OUT) != MRAA_SUCCESS) { - mraa_gpio_close(mux_i); - return MRAA_ERROR_UNSPECIFIED; - } + // this function will sometimes fail, however this is not critical as + // long as the write succeeds - Test case galileo gen2 pin2 + mraa_gpio_dir(mux_i, MRAA_GPIO_OUT); + if (mraa_gpio_write(mux_i, meta.mux[mi].value) != MRAA_SUCCESS) { mraa_gpio_close(mux_i); return MRAA_ERROR_INVALID_RESOURCE;