LEDS: Handle action priority property
If a particular LED is asserted with different actions as part of
multiple groups, the resulting action needs to be overridden by the
action priority set for that LED.
Change-Id: I82c7da636c53f16fbc1bd85254b46e0625e3909d
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
diff --git a/gen_led_groups.pl b/gen_led_groups.pl
index 9b8922b..ef9e95c 100755
--- a/gen_led_groups.pl
+++ b/gen_led_groups.pl
@@ -139,6 +139,17 @@
next;
}
+ # By default, Blink takes higher priority
+ my $priority = "'Blink'";
+
+ # Get the priority. Since rest everything is populated,
+ # default to Blink than err'ing out. Not checking for
+ # validity of this since it must be present.
+ if($targetObj->getAttribute($ledTarget, "LED_PRIORITY") eq "ON")
+ {
+ $priority = "'On'";
+ }
+
# Need this to populate the table incase the device is empty
my $instance = $targetObj->getInstanceName($ledTarget);
@@ -172,11 +183,13 @@
$hashGroup{$groupName}{$fru}{"Action"} = $action;
$hashGroup{$groupName}{$fru}{"Period"} = $period;
$hashGroup{$groupName}{$fru}{"DutyOn"} = $dutyCycle;
+ $hashGroup{$groupName}{$fru}{"Priority"} = $priority;
# Need to update the LampTest group.
$hashGroup{$lampTest}{$fru}{"Action"} = "'Blink'";
$hashGroup{$lampTest}{$fru}{"Period"} = 1000;
$hashGroup{$lampTest}{$fru}{"DutyOn"} = 50;
+ $hashGroup{$lampTest}{$fru}{"Priority"} = "'Blink'";
}
} # Walk CONTROL_GROUP
} # Has LED target
@@ -202,6 +215,7 @@
$hashGroup{$groupName}{$encFaults[$led]}{"Action"} = "'On'";
$hashGroup{$groupName}{$encFaults[$led]}{"Period"} = 0;
$hashGroup{$groupName}{$encFaults[$led]}{"DutyOn"} = 50;
+ $hashGroup{$groupName}{$encFaults[$led]}{"Priority"} = "'Blink'";
}
}
printDebug("\n======================================================================\n");