x86: edison: add check in init_pre uart hook
authorThomas Ingleby <thomas.c.ingleby@intel.com>
Mon, 29 Jun 2015 18:45:16 +0000 (19:45 +0100)
committerThomas Ingleby <thomas.c.ingleby@intel.com>
Mon, 29 Jun 2015 18:49:55 +0000 (19:49 +0100)
If none 0 index passed, will log error.
Related to #152

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
src/x86/intel_edison_fab_c.c

index 809c6c7..7945e83 100644 (file)
@@ -559,6 +559,10 @@ mraa_intel_edsion_mb_gpio_mode(mraa_gpio_context dev, gpio_mode_t mode)
 mraa_result_t
 mraa_intel_edison_uart_init_pre(int index)
 {
+    if (index != 0) {
+        syslog(LOG_ERR, "edison: Failed to write to drive mode");
+        return MRAA_ERROR_INVALID_RESOURCE;
+    }
     if (miniboard == 0) {
         mraa_gpio_write(tristate, 0);
         mraa_gpio_context io0_output = mraa_gpio_init_raw(248);