Prevent updating power cap sysfs file when OCC not active
The power cap can be updated at any time, but occ-control should only
update the sysfs files when the OCCs are active.
Also prevent sending pass through commands when OCC is not
active.
Change-Id: I7e5d5ad0b897b55a00e4d07c62b917aa62b7f9ef
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/occ_pass_through.cpp b/occ_pass_through.cpp
index c826983..6291828 100644
--- a/occ_pass_through.cpp
+++ b/occ_pass_through.cpp
@@ -75,6 +75,16 @@
{
std::vector<uint8_t> response{};
+ if (!occActive)
+ {
+ log<level::ERR>(
+ fmt::format(
+ "PassThrough::send() - OCC{} not active, command not sent",
+ occInstance)
+ .c_str());
+ return response;
+ }
+
log<level::INFO>(
fmt::format("PassThrough::send() Sending 0x{:02X} command to OCC{}",
command.front(), occInstance)