From 63501cd1fe3883b8cc29db527128c959fe2385ea Mon Sep 17 00:00:00 2001 From: George Kraft Date: Thu, 20 Sep 2012 13:18:46 -0500 Subject: CXMAN-36, CXMAN-76: Make "cxmanage info" display all versions This includes hb_spif, socman, a9boot, and u-boot. --- cxmanage/controller.py | 12 +++++++----- cxmanage/target.py | 15 +++++++++++++++ cxmanage_test/controller_test.py | 5 ++++- cxmanage_test/target_test.py | 9 ++++++--- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/cxmanage/controller.py b/cxmanage/controller.py index 701e9de..67c2a41 100644 --- a/cxmanage/controller.py +++ b/cxmanage/controller.py @@ -498,7 +498,7 @@ class Controller: def info_basic(self): """ Get basic SoC info from all targets """ if self.verbosity >= 1: - print "Getting SoC info..." + print "Getting info..." results, errors = self._run_command(False, "info_basic") # Print results @@ -508,10 +508,12 @@ class Controller: result = results[target.address] print "[ Info from %s ]" % target.address print result.header - print " Version: %s" % result.version - print " Build Number: %s" % result.build_number - print " Timestamp (%s): %s" % (result.timestamp, - time.ctime(int(result.timestamp))) + print "Firmware version : %s" % result.version + print "Socman version : %s" % result.soc_version + if hasattr(result, "a9boot_version"): + print "A9Boot version : %s" % result.a9boot_version + if hasattr(result, "uboot_version"): + print "U-Boot version : %s" % result.uboot_version print if self.verbosity >= 1 and len(errors) > 0: diff --git a/cxmanage/target.py b/cxmanage/target.py index d9a3619..081b05f 100644 --- a/cxmanage/target.py +++ b/cxmanage/target.py @@ -349,6 +349,21 @@ class Target: result = self.bmc.get_info_basic() if hasattr(result, "error"): raise CxmanageError(result.error) + + fwinfo = self.get_firmware_info() + + try: + a9boot_partition = self._get_partition(fwinfo, "A9_EXEC", "ACTIVE") + setattr(result, "a9boot_version", a9boot_partition.version) + except CxmanageError: + pass + + try: + uboot_partition = self._get_partition(fwinfo, "A9_UBOOT", "ACTIVE") + setattr(result, "uboot_version", uboot_partition.version) + except CxmanageError: + pass + return result def info_dump(self, tftp): diff --git a/cxmanage_test/controller_test.py b/cxmanage_test/controller_test.py index 5235cdc..773ca01 100644 --- a/cxmanage_test/controller_test.py +++ b/cxmanage_test/controller_test.py @@ -332,9 +332,12 @@ class DummyTarget: class Result: def __init__(self): self.header = "Calxeda SoC (0x0096CD)" - self.version = "0.0.0" + self.version = "v0.0.0" self.build_number = "00000000" self.timestamp = "0" + self.soc_version = "0.0.0" + self.a9boot_version = "0.0.0" + self.uboot_version = "0.0.0" return Result() def info_dump(self, tftp): diff --git a/cxmanage_test/target_test.py b/cxmanage_test/target_test.py index c7ca8c7..99aca5a 100644 --- a/cxmanage_test/target_test.py +++ b/cxmanage_test/target_test.py @@ -231,8 +231,10 @@ class TargetTest(unittest.TestCase): for target in self.targets: result = target.info_basic() - self.assertEqual(target.bmc.executed, ["info_basic"]) - for attr in ["header", "version", "build_number", "timestamp"]: + self.assertEqual(target.bmc.executed, ["info_basic", + "get_firmware_info"]) + for attr in ["header", "version", "build_number", "timestamp", + "soc_version"]: self.assertTrue(hasattr(result, attr)) class DummyBMC(LanBMC): @@ -382,7 +384,8 @@ class DummyBMC(LanBMC): class Result: def __init__(self): self.header = "Calxeda SoC (0x0096CD)" - self.version = "0.0.0" + self.version = "v0.0.0" + self.soc_version = "0.0.0" self.build_number = "00000000" self.timestamp = "0" return Result() -- cgit v1.2.1