LEDS: Provide support to override the default Blink priority
In some cases, it is needed that the Solid-ON action over rules
Blink and this patch adds that support.
Change-Id: Ib0a88b11142ccef3e39ef0a7c6eb3a037c878bc2
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
diff --git a/ledlayout.hpp b/ledlayout.hpp
index 998feb5..ca63166 100644
--- a/ledlayout.hpp
+++ b/ledlayout.hpp
@@ -2,6 +2,7 @@
#include <map>
#include <set>
+
namespace phosphor
{
namespace led
@@ -30,13 +31,24 @@
Action action;
uint8_t dutyOn;
uint16_t period;
+ Action priority;
- // Needed for inserting elements into sets
+ // Order LEDs such that same LEDs are grouped next to
+ // each other and the same LEDs are in priority order
+ // with the highest priority coming first
bool operator<(const LedAction& right) const
{
if (name == right.name)
{
- return action < right.action;
+ if (action == right.action)
+ {
+ return false;
+ }
+ else if (action == priority)
+ {
+ return true;
+ }
+ return action > right.action;
}
return name < right.name;
}