简体   繁体   English

与 linux 中的 i2c 设备通话时遇到问题

[英]Trouble talking to i2c device in linux

I'm having trouble talking to an i2c device in linux.我在与 linux 中的 i2c 设备通信时遇到问题。 The device is connected to the SMBus which normally comes up as /dev/i2c-0.该设备连接到通常显示为 /dev/i2c-0 的 SMBus。 My driver's init function is getting called and the driver is registered via i2c_add_driver however the driver never gets probed.我的驱动程序的 init function 被调用,驱动程序通过 i2c_add_driver 注册,但驱动程序从未被探测。

In the initialization function for my hardware board I'm calling i2c_register_board_info(n, i2c_board_info, array_size).在我的硬件板的初始化 function 中,我调用 i2c_register_board_info(n, i2c_board_info, array_size)。 Here n should be 0 to register the device on the SMBus, however whatever I set n to causes the SMBus to instead come up as /dev/i2c-(n + 1).这里 n 应该是 0 以便在 SMBus 上注册设备,但是无论我将 n 设置为什么,都会导致 SMBus 显示为 /dev/i2c-(n + 1)。

Any ideas?有任何想法吗?

You should use i2c_add_numbered_adapter instead of i2c_add_adapter in your bus driver.您应该在总线驱动程序中使用i2c_add_numbered_adapter而不是i2c_add_adapter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM