微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决#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 举报,一经查实,本站将立刻删除。