mraa.c: do not check return value of mraa_gpio_dir when used on muxes
authorBrendan Le Foll <brendan.le.foll@intel.com>
Mon, 15 Dec 2014 11:47:21 +0000 (11:47 +0000)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Mon, 15 Dec 2014 11:50:54 +0000 (11:50 +0000)
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 <brendan.le.foll@intel.com>
src/mraa.c

index 12180b2..8831bc2 100644 (file)
@@ -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;