linux-kernel - 我是否需要从嵌入式平台上的 GPIO 设备“取消绑定”pca953x 驱动程序才能从设备中读取?
问题描述
我在从嵌入式设备(usrp n310)上的 GPIO 设备读取时遇到问题。i2cdetect
为我尝试访问的特定设备提供“UU”,表明这些设备已被芯片占用。/sys/bus/i2c/drivers显示链接到这些设备的驱动程序是 pca953x。以前,我能够从 zc706 平台上的 GPIO 设备 (tca6416) 读取和写入,但是,在比较/sys/bus/i2c/drivers时,我看不到任何与该芯片相关的驱动程序。我正在使用的代码如下
#include "i2c_dev.hpp"
int main()
{
int i2cfd;
__s32 num;
// Opening i2c adapter 6
printf("Opening bus adapter\n");
i2cfd = open("/dev/i2c-6", O_RDWR);
if ( i2cfd < 0 ) {
printf("Failed to open /dev/i2c-6: %s\n", strerror(errno));
return 1;
}
// Instatiating three objects of IO_Expander class
IO_Expander dba;
// Reading data from the IO Expander
printf("Setting slave address of device\n");
if (ioctl(i2cfd, I2C_SLAVE, 0x20) < 0) {
printf("Error setting slave address:%s\n", strerror(errno));
return 1;
}
printf("Reading data from the IO Expander for DB-A Object\n");
num = dba.read_data(i2cfd, 0x00);
if (num < 0) {
printf("Error reading data: %s\n", strerror(errno));
} else {
printf("The input value is %d\n", num);
}
printf("Leaving DB-A Object\n\n\n");
// Closing the adapter
close(i2cfd);
}
那么,由于这个 pca953x 驱动程序,我无法从 n310 平台上的 GPIO 设备读取吗?如果是这样,正确的方法是将 pca953x 驱动程序与设备“解除绑定”以便从中读取值吗?
解决方案
推荐阅读
- amazon-web-services - AWS Elastic Beanstalk CloudFormation 脚本:无法在没有设置凭证的情况下签署请求
- arrays - 错误运行时 9
- python - 如何在没有 Python re 库的情况下替换字符串中的字符
- etl - icCube - ETL - 创建文件转储,然后将其用作数据源
- ios - 如何在 UITableView 中的两个单元格之间添加间距?没有像分隔符高度之类的东西
- if-statement - ksh if 循环 vs [[ ]] && { cmd1 ; } || { cmd2 ; }
- javascript - TensorFlowJS 的简单线性回归
- java - Google OAuth2 - 指纹已被使用
- asp.net-core - SignalR Asp.Net Core 发送异步挂起
- gwt - IVY 未解决的依赖项 GWT 2.7.0