Private
Public Access
2
0

beaglebone.c: fix beaglebone i2c bus 2 not existing

Signed-off-by: Michael Kellner mkellner@intlweb.com
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Michael Kellner
2016-03-17 06:36:47 +00:00
committed by Brendan Le Foll
parent 905abdec7c
commit d3a220479d

View File

@@ -277,6 +277,7 @@ mraa_beaglebone_i2c_init_pre(unsigned int bus)
char* capepath = NULL;
sprintf(devpath, "/dev/i2c-%u", plat->i2c_bus[bus].bus_id);
if (!mraa_file_exist(devpath)) {
syslog(LOG_INFO, "i2c: %s doesn't exist ", devpath);
capepath = mraa_file_unglob(SYSFS_DEVICES_CAPEMGR_SLOTS);
if (capepath == NULL) {
syslog(LOG_ERR, "i2c: Could not find CapeManager");
@@ -418,7 +419,7 @@ mraa_beaglebone()
else
i2c0_enabled = 0;
if (mraa_file_exist("/sys/class/i2c-dev/i2c-1"))
if (mraa_file_exist("/sys/class/i2c-dev/i2c-2"))
i2c1_enabled = 1;
else
i2c1_enabled = 0;
@@ -1127,7 +1128,7 @@ mraa_beaglebone()
b->pins[64].i2c.mux_total = 0;
b->pins[64].spi.mux_total = 0;
if (i2c0_enabled == 1) {
if (i2c1_enabled == 1) {
strncpy(b->pins[65].name, "I2C2SCL", MRAA_PIN_NAME_SIZE);
b->pins[65].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
b->pins[65].i2c.mux_total = 0;
@@ -1140,7 +1141,7 @@ mraa_beaglebone()
b->pins[65].gpio.mux_total = 0;
b->pins[65].i2c.mux_total = 0;
if (i2c0_enabled == 1) {
if (i2c1_enabled == 1) {
strncpy(b->pins[66].name, "I2C2SDA", MRAA_PIN_NAME_SIZE);
b->pins[66].capabilites = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 1, 0, 0 };
b->pins[66].i2c.mux_total = 0;
@@ -1380,7 +1381,7 @@ mraa_beaglebone()
b->i2c_bus[0].sda = 46 + 18;
b->i2c_bus[0].scl = 46 + 17;
b->i2c_bus[1].bus_id = 1;
b->i2c_bus[1].bus_id = 2;
b->i2c_bus[1].sda = 46 + 20;
b->i2c_bus[1].scl = 46 + 19;