diff options
author | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2016-11-12 18:29:38 +0530 |
---|---|---|
committer | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2016-12-13 12:58:49 +0530 |
commit | bb8fe0b6e025aaff1b0f0360cf4ddb35f3d0912d (patch) | |
tree | 915b88f5a997032543d0802ab19e72a801d91eb0 /parse_led.py | |
parent | b21fda795e15fb7ba3e74d63518ff2a112d4c875 (diff) | |
download | phosphor-led-manager-bb8fe0b6e025aaff1b0f0360cf4ddb35f3d0912d.tar.gz phosphor-led-manager-bb8fe0b6e025aaff1b0f0360cf4ddb35f3d0912d.zip |
Add methods to driving the LEDs
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. Corresponding groups are
asserted / de-asserted based on user input.
Change-Id: I7e64bea13767b8d083dd946f4cf3aeb37e62ff17
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
Diffstat (limited to 'parse_led.py')
-rwxr-xr-x | parse_led.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/parse_led.py b/parse_led.py index 96bcd5e..7f212ea 100755 --- a/parse_led.py +++ b/parse_led.py @@ -1,21 +1,23 @@ #!/usr/bin/env python import yaml +import os if __name__ == '__main__': - with open('led.yaml', 'r') as f: + script_dir = os.path.dirname(os.path.realpath(__file__)) + with open(os.path.join(script_dir, 'led.yaml'), 'r') as f: ifile = yaml.safe_load(f) - with open('led-gen.hpp', 'w') as ofile: + with open(os.path.join(script_dir, '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') + ofile.write(' std::set<phosphor::led::Group::LedAction>>') + ofile.write(' phosphor::led::Group::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') + ofile.write(' {\"' + "/xyz/openbmc_project/ledmanager/groups/" + group + '\",{\n') for led_dict, list_dict in ledset.iteritems(): for name, value in list_dict.iteritems(): |