i2c: disallow non allowed i2c buses
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
9a60d2ee63
commit
f9e6a6efd4
@@ -185,7 +185,7 @@ mraa_setup_i2c(int bus)
|
||||
if (plat == NULL)
|
||||
return -3;
|
||||
|
||||
if (plat->i2c_bus_count >! 0) {
|
||||
if (plat->i2c_bus_count == 0) {
|
||||
fprintf(stderr, "No i2c buses defined in platform");
|
||||
return -1;
|
||||
}
|
||||
@@ -194,6 +194,11 @@ mraa_setup_i2c(int bus)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (plat->i2c_bus[bus].bus_id == -1) {
|
||||
fprintf(stderr, "Platform not currently allowed for mraa use\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int pos = plat->i2c_bus[bus].sda;
|
||||
if (plat->pins[pos].i2c.mux_total > 0)
|
||||
if (mraa_setup_mux_mapped(plat->pins[pos].i2c) != MRAA_SUCCESS)
|
||||
|
||||
Reference in New Issue
Block a user