nvmesensor: Use slave address from configuration json
Replace hardcoded slave address with address from the configuration
This patch is for non-compliant nvme devices (e.g.
configurations/nvme_p4000.json).
Tested: Manually by verifying the slave address in Entity Manager
configuration is used by the nvmesensor binary
Change-Id: I56b8187578c22a9be98ccd2c50a7b9838a087e52
Signed-off-by: Nnamdi Ajah <nnamdi@cloudflare.com>
diff --git a/src/NVMeSensor.cpp b/src/NVMeSensor.cpp
index e11fae7..d265a02 100644
--- a/src/NVMeSensor.cpp
+++ b/src/NVMeSensor.cpp
@@ -27,11 +27,11 @@
const std::string& sensorName,
std::vector<thresholds::Threshold>&& thresholdsIn,
const std::string& sensorConfiguration,
- const int busNumber) :
+ const int busNumber, const uint8_t slaveAddr) :
Sensor(escapeName(sensorName), std::move(thresholdsIn), sensorConfiguration,
NVMeSensor::sensorType, false, false, maxReading, minReading, conn,
PowerState::on),
- bus(busNumber), objServer(objectServer)
+ bus(busNumber), address(slaveAddr), objServer(objectServer)
{
if (bus < 0)
{