In my qt program I include the headers for i2c/smbus (as I did for other projects, also with yocto but different SoC vendor).
Kernel 4.14.24
extern "C"
{
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <i2c/smbus.h> << FAIL: i2c/smbus.h: No such file or directory
#include <fcntl.h>
#include <sys/ioctl.h>
}
In the conf/local.conf file I added the i2c-tools
IMAGE_INSTALL_append = " i2c-tools "
Built the toolchain and checked the rootfs for i2c/smbus.h. No luck.
i2cdetect/get/set works (did before adding the i2c-tools too).
Functionalities implemented by /dev/i2c-0:
I2C yes
SMBus Quick Command yes
SMBus Send Byte yes
SMBus Receive Byte yes
SMBus Write Byte yes
SMBus Read Byte yes
SMBus Write Word yes
SMBus Read Word yes
SMBus Process Call yes
SMBus Block Write yes
SMBus Block Read yes
SMBus Block Process Call no
SMBus PEC yes
I2C Block Write yes
I2C Block Read yes
I don't see the smbus.h in the rootfs: /usr/include/i2c/ There is a i2c-core-smbus.c where the functions i2c_smbus_......() are located but no h-file.
edit: added Kernel version.
The comment from @0andriy is correct, you need the
libi2c-dev
package.