Skip i2c addresses in the range 0 to 12
EEPROM's will not present in the address range 0-12. With reference to
http://smbus.org/specs/SMBus_3_1_20180319.pdf appendix C which talks
about the reserved addresses for SMBus, the addresses in the range 0-12
can be skipped.
Changing the ioctl command I2C_SLAVE_FORCE to I2C_SLAVE to skip the
addresses which are busy.
Test:
No change before and after.
Signed-off-by: Rajashekar Gade Reddy <raja.sekhar.reddy.gade@linux.intel.com>
Change-Id: Idb65a8a5ec00b354a7111898cd9bfb2cb34c463d
diff --git a/src/FruDevice.cpp b/src/FruDevice.cpp
index 3ae71b1..8eb34a0 100644
--- a/src/FruDevice.cpp
+++ b/src/FruDevice.cpp
@@ -529,15 +529,22 @@
rootFailures = &(failedAddresses[rootBus]);
}
+ constexpr int startSkipSlaveAddr = 0;
+ constexpr int endSkipSlaveAddr = 12;
+
for (int ii = first; ii <= last; ii++)
{
if (skipList.find(ii) != skipList.end())
{
continue;
}
-
+ // skipping since no device is present in this range
+ if (ii >= startSkipSlaveAddr && ii <= endSkipSlaveAddr)
+ {
+ continue;
+ }
// Set slave address
- if (ioctl(file, I2C_SLAVE_FORCE, ii) < 0)
+ if (ioctl(file, I2C_SLAVE, ii) < 0)
{
std::cerr << "device at bus " << bus << " register " << ii
<< " busy\n";