Commit 8c8e6bf0 authored by Dimitris Lampridis's avatar Dimitris Lampridis

sw: add sys-info command to wrtd-config tool

parent 4712b309
......@@ -36,9 +36,40 @@ def __tstamp_to_str(tstamp):
int(ret['ns'] / 1e1) % 1000,
ret['frac'] >> (32 - 9))
def cmd_sys_info(wrtd, args):
print()
cmd_sys_time(wrtd, args)
print()
count = wrtd.get_attr_int32(wrtd.WRTD_GLOBAL_REP_CAP_ID,
wrtd.WRTD_ATTR_FW_COUNT)
print ('{0} Application{1} detected{2}'.format(count,
'' if (count == 1) else 's',
'.' if (count == 0) else ':'))
for i in range(count):
if args.verbose:
print ()
fw_name = wrtd.get_fw_name(i)
print ('# {0}'.format(fw_name))
if args.verbose:
print(" + Version Info")
print(" - Name.........: {0}".format(fw_name))
print(" - FW version...: {0}.{1}".format(
wrtd.get_attr_int32(fw_name, wrtd.WRTD_ATTR_FW_MAJOR_VERSION),
wrtd.get_attr_int32(fw_name, wrtd.WRTD_ATTR_FW_MINOR_VERSION)))
print(" - WRTD version.: {0}.{1}".format(
wrtd.get_attr_int32(fw_name, wrtd.WRTD_ATTR_FW_MAJOR_VERSION_REQUIRED),
wrtd.get_attr_int32(fw_name, wrtd.WRTD_ATTR_FW_MINOR_VERSION_REQUIRED)))
print()
cmd_list_alarms(wrtd, args)
print()
cmd_list_rules(wrtd, args)
print()
def cmd_sys_time(wrtd, args):
print(__tstamp_to_str(wrtd.get_attr_tstamp(wrtd.WRTD_GLOBAL_REP_CAP_ID,
wrtd.WRTD_ATTR_SYS_TIME)))
print('Current time = {0}'.format(__tstamp_to_str(
wrtd.get_attr_tstamp(wrtd.WRTD_GLOBAL_REP_CAP_ID,
wrtd.WRTD_ATTR_SYS_TIME))))
def cmd_set_log(wrtd, args):
wrtd.set_attr_bool(wrtd.WRTD_GLOBAL_REP_CAP_ID,
......@@ -248,6 +279,12 @@ def main():
help='(Use "<command> -h" to get more details)')
subparsers.required = True;
# sys-info
cmd_parser = subparsers.add_parser('sys-info', help='Show system information')
cmd_parser.add_argument('-v', '--verbose', action='store_true',
help='Show more details')
cmd_parser.set_defaults(func=cmd_sys_info)
# sys-time
cmd_parser = subparsers.add_parser('sys-time', help='Show current system time')
cmd_parser.set_defaults(func=cmd_sys_time)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment