Add additional device bind case if occActive is out-of-sync
This happens with bmc reboot if the host is up. BMC comes back up and
initial fsi load binds the first proc occ-hwmon device. OCC controller
starts and see's its bound, so occActive goes true. FSI rescan occurs
since host is up, unloading the first proc occ-hwmon device... Now we
can't enable it again since occActive is still true.
Resolves openbmc/openbmc#2325
Change-Id: Iac838bc51d1110f502ca0c7c5da78dc5e1780c98
Signed-off-by: Edward A. James <eajames@us.ibm.com>
diff --git a/occ_status.cpp b/occ_status.cpp
index 5249fbe..36520b5 100644
--- a/occ_status.cpp
+++ b/occ_status.cpp
@@ -38,6 +38,27 @@
device.unBind();
}
}
+ else if (value && !device.bound())
+ {
+ // Existing error watch is on a dead file descriptor.
+ // TODO: openbmc/openbmc#2285
+ // removeErrorWatch();
+
+ /*
+ * In it's constructor, Status checks Device::bound() to see if OCC is
+ * active or not.
+ * Device::bound() checks for occX-dev0 directory.
+ * We will lose occX-dev0 directories during FSI rescan.
+ * So, if we start this application (and construct Status), and then
+ * later do FSI rescan, we will end up with occActive = true and device
+ * NOT bound. Lets correct that situation here.
+ */
+ device.bind();
+
+ // Add error watch again
+ // TODO: openbmc/openbmc#2285
+ // addErrorWatch();
+ }
return Base::Status::occActive(value);
}