summaryrefslogtreecommitdiffstats
path: root/parse_led.py
diff options
context:
space:
mode:
authorVishwanatha Subbanna <vishwa@linux.vnet.ibm.com>2016-10-17 17:46:37 +0530
committerVishwanatha Subbanna <vishwa@linux.vnet.ibm.com>2016-11-21 23:06:00 +0530
commitb21fda795e15fb7ba3e74d63518ff2a112d4c875 (patch)
treeb4aeb74af1ee8ae06244b8af5e8381c879f63c6d /parse_led.py
parentcbad1b9813b5005fe6a2af706d777464cab5b845 (diff)
downloadphosphor-led-manager-b21fda795e15fb7ba3e74d63518ff2a112d4c875.tar.gz
phosphor-led-manager-b21fda795e15fb7ba3e74d63518ff2a112d4c875.zip
Add LED grouping support
This enables creating custom groups and participating LEDs so that it can later be generated from MRW. For each of the group, a dbus object is created which will announce LED actions. Fixes openbmc/openbmc#550 Change-Id: I7a56d08755288dcfce45ee4c6d6b6c5e5aa454f7 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
Diffstat (limited to 'parse_led.py')
-rwxr-xr-xparse_led.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/parse_led.py b/parse_led.py
new file mode 100755
index 0000000..96bcd5e
--- /dev/null
+++ b/parse_led.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+import yaml
+
+if __name__ == '__main__':
+ with open('led.yaml', 'r') as f:
+ ifile = yaml.safe_load(f)
+
+ with open('led-gen.hpp', 'w') as ofile:
+ ofile.write('/* !!! WARNING: This is a GENERATED Code..')
+ ofile.write('Please do NOT Edit !!! */\n\n')
+
+ ofile.write('const std::map<std::string,')
+ ofile.write(' std::set<phosphor::led::Manager::LedAction>>')
+ ofile.write(' phosphor::led::Manager::cv_LedMap = {\n\n')
+ for group in ifile.iterkeys():
+ # Value of this group is a std::set<string, led structure>
+ ledset = ifile[group]
+ ofile.write(' {\"' + group + '\",{\n')
+
+ for led_dict, list_dict in ledset.iteritems():
+ for name, value in list_dict.iteritems():
+ if group and led_dict and name and value:
+ ofile.write(' {\"' + led_dict + '\",')
+ ofile.write(value.upper() + '},\n')
+ ofile.write(' }},\n')
+ ofile.write('};\n')
+
OpenPOWER on IntegriCloud