diff --git a/include/mraa_internal_types.h b/include/mraa_internal_types.h index 8c5e747..6f097fd 100644 --- a/include/mraa_internal_types.h +++ b/include/mraa_internal_types.h @@ -56,6 +56,7 @@ struct _gpio { */ struct _i2c { /*@{*/ + int busnum; /**< the bus number of the /dev/i2c-* device */ int fh; /**< the file handle to the /dev/i2c-* device */ int addr; /**< the address of the i2c slave */ /*@}*/ diff --git a/src/i2c/i2c.c b/src/i2c/i2c.c index 1dc5f67..b44e41f 100644 --- a/src/i2c/i2c.c +++ b/src/i2c/i2c.c @@ -119,6 +119,7 @@ mraa_i2c_init_raw(unsigned int bus) } char filepath[32]; + dev->busnum = bus; snprintf(filepath, 32, "/dev/i2c-%u", bus); if ((dev->fh = open(filepath, O_RDWR)) < 1) { syslog(LOG_ERR, "i2c: Failed to open requested i2c port %s", filepath);