diff options
author | Minh-Quang Nguyen <minh-quang.nguyen@nutaq.com> | 2017-01-16 10:02:00 -0500 |
---|---|---|
committer | Minh-Quang Nguyen <minh-quang.nguyen@nutaq.com> | 2017-01-16 10:08:39 -0500 |
commit | edc0165e65bf33e1b4b4c41e171c337e25b19ca8 (patch) | |
tree | 38ea6d019b149fcfcf474b49a45d7267c12be0b6 | |
parent | 606911a63fe3f04264fc0ce3788ab9148e626170 (diff) |
LC15: Implement VTY command for debuging LED pattern
Change-Id: Idb2152892c769086396335ed86fa9d4936f8980b
Change-Id: I682a101092e11d16e8252e75fb33e3515a004efa
-rw-r--r-- | src/osmo-bts-litecell15/misc/lc15bts_led.c | 7 | ||||
-rw-r--r-- | src/osmo-bts-litecell15/misc/lc15bts_mgr_vty.c | 19 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/osmo-bts-litecell15/misc/lc15bts_led.c b/src/osmo-bts-litecell15/misc/lc15bts_led.c index 5a3a93c7..d3e048fc 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_led.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_led.c @@ -219,6 +219,13 @@ static void led_set_pattern(char *pattern) void led_set(int pattern_id) { + if (pattern_id > BLINK_PATTERN_MAX_ITEM - 1) { + LOGP(DTEMP, LOGL_ERROR, "Invalid LED pattern : %d. LED pattern must be between %d..%d\n", + pattern_id, + BLINK_PATTERN_POWER_ON, + BLINK_PATTERN_MAX_ITEM - 1); + return; + } LOGP(DTEMP, LOGL_NOTICE, "blink pattern command : %d\n", pattern_id); led_set_pattern(blink_pattern_command[pattern_id]); } diff --git a/src/osmo-bts-litecell15/misc/lc15bts_mgr_vty.c b/src/osmo-bts-litecell15/misc/lc15bts_mgr_vty.c index 8af42c14..daa7c81e 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_mgr_vty.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_mgr_vty.c @@ -718,6 +718,22 @@ DEFUN(calibrate_clock, calibrate_clock_cmd, return CMD_SUCCESS; } +DEFUN(set_led_pattern, set_led_pattern_cmd, + "set led pattern <0-255>", + "Set LED pattern\n" + "Set LED pattern for debugging purpose only. This pattern will be overridden after 60 seconds by LED pattern of actual system state\n") +{ + int pattern_id = atoi(argv[0]); + + if ((pattern_id < 0) || (pattern_id > BLINK_PATTERN_MAX_ITEM)) { + vty_out(vty, "%%Invalid LED pattern ID. It must be in range of %d..%d %s", 0, BLINK_PATTERN_MAX_ITEM - 1, VTY_NEWLINE); + return CMD_WARNING; + } + + led_set(pattern_id); + return CMD_SUCCESS; +} + static void register_limit(int limit, uint32_t unit) { switch (unit) { @@ -851,6 +867,9 @@ int lc15bts_mgr_vty_init(void) register_action(ACT_CRIT_NODE); vty_install_default(ACT_CRIT_NODE); + /* install LED pattern command for debugging purpose */ + install_element_ve(&set_led_pattern_cmd); + return 0; } |