From: Brendan Le Foll Date: Mon, 15 Dec 2014 11:47:21 +0000 (+0000) Subject: mraa.c: do not check return value of mraa_gpio_dir when used on muxes X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71118af2335eda8fcb196d476b6b5176600063bc;p=contrib%2Fmraa.git 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 --- 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;