intel_edison_fab_c.c: If i2c bus number is invalid use the default bus (6)
authorBrendan Le Foll <brendan.le.foll@intel.com>
Wed, 22 Oct 2014 19:51:13 +0000 (20:51 +0100)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Wed, 22 Oct 2014 19:51:13 +0000 (20:51 +0100)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
src/intel_edison_fab_c.c

index 84d734c..f40adbc 100644 (file)
@@ -129,8 +129,8 @@ mraa_intel_edison_i2c_init_pre(unsigned int bus)
 {
     if (miniboard == 0) {
         if(bus != 6) {
-            syslog(LOG_ERR, "Edison: You can't use that bus :/");
-            return MRAA_ERROR_INVALID_RESOURCE;
+            syslog(LOG_ERR, "Edison: You can't use that bus, switching to bus 6");
+            bus = 6;
         }
         mraa_gpio_write(tristate, 0);
         mraa_gpio_context io18_gpio = mraa_gpio_init_raw(14);
@@ -162,8 +162,8 @@ mraa_intel_edison_i2c_init_pre(unsigned int bus)
         mraa_gpio_write(tristate, 1);
     } else {
         if(bus != 6 && bus != 1) {
-            syslog(LOG_ERR, "Edison: You can't use that bus :/");
-            return MRAA_ERROR_INVALID_RESOURCE;
+            syslog(LOG_ERR, "Edison: You can't use that bus, switching to bus 6");
+            bus = 6;
         }
         int scl = plat->pins[plat->i2c_bus[bus].scl].gpio.pinmap;
         int sda = plat->pins[plat->i2c_bus[bus].sda].gpio.pinmap;