Re-enable OCC error watching
Driver and OCC application should now correctly report errors from the
OCC with no false positives.
Resolves openbmc/openbmc#2285
Change-Id: Ifc4668ab75f26529f071317ead6ab4f77c3a0e7c
Signed-off-by: Edward A. James <eajames@us.ibm.com>
diff --git a/occ_manager.cpp b/occ_manager.cpp
index 67e96a6..040676b 100644
--- a/occ_manager.cpp
+++ b/occ_manager.cpp
@@ -82,23 +82,6 @@
}
activeCount += status ? 1 : -1;
-
- // If all the OCCs are bound, then start error detection
- if (activeCount == statusObjects.size())
- {
- for (const auto& occ: statusObjects)
- {
- occ->addErrorWatch();
- }
- }
- else if (!status)
- {
- // If some OCCs are not bound yet, those will be a NO-OP
- for (const auto& occ: statusObjects)
- {
- occ->removeErrorWatch();
- }
- }
}
#ifdef I2C_OCC
diff --git a/occ_status.cpp b/occ_status.cpp
index 8867276..d491fe1 100644
--- a/occ_status.cpp
+++ b/occ_status.cpp
@@ -17,22 +17,25 @@
// Bind the device
device.bind();
+ // Start watching for errors
+ addErrorWatch();
+
// Call into Manager to let know that we have bound
- // TODO: openbmc/openbmc#2285
- /* if (this->callBack)
+ if (this->callBack)
{
this->callBack(value);
- }*/
+ }
}
else
{
// Call into Manager to let know that we will unbind.
- // Need to do this before doing un-bind since it will
- // result in slave error if Master is un-bound
- /*if (this->callBack)
+ if (this->callBack)
{
this->callBack(value);
- }*/
+ }
+
+ // Stop watching for errors
+ removeErrorWatch();
// Do the unbind.
device.unBind();
@@ -41,8 +44,7 @@
else if (value && !device.bound())
{
// Existing error watch is on a dead file descriptor.
- // TODO: openbmc/openbmc#2285
- // removeErrorWatch();
+ removeErrorWatch();
/*
* In it's constructor, Status checks Device::bound() to see if OCC is
@@ -56,8 +58,7 @@
device.bind();
// Add error watch again
- // TODO: openbmc/openbmc#2285
- // addErrorWatch();
+ addErrorWatch();
}
return Base::Status::occActive(value);
}