#include <i2c/smbus.h> 文件未找到

问题描述

在我的 qt 程序中,我包含了 i2c/smbus 的头文件(就像我在其他项目中所做的一样,也与 yocto 但不同的 SoC 供应商)。

内核 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>
}

在 conf/local.conf 文件中我添加了 i2c-tools

IMAGE_INSTALL_append = " i2c-tools "

构建工具链并检查 i2c/smbus.h 的 rootfs。没运气。
i2cdetect/get/set 工作(在添加 i2c-tools 之前也是如此)。

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

我在 rootfs 中没有看到 smbus.h:/usr/include/i2c/ 有一个 i2c-core-smbus.c,其中函数 i2c_smbus_......() 位于但没有 h 文件。

编辑:添加了内核版本。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...