From bd3af9918ee3c076b1d8524a0693db727f053824 Mon Sep 17 00:00:00 2001 From: Penghui Cui Date: Fri, 24 Sep 2021 11:00:03 +0800 Subject: [PATCH] Add extention for get/set asset tag, fix bugs for overriding Change-Id: Ie56b9532acd762a137b150ee65c378a0ea1dcc22 --- pyghmi/ipmi/command.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index 6709db1c..19745ed3 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -1310,12 +1310,18 @@ class Command(object): :returns: The asset tag """ + self.oem_init() + if hasattr(self._oem, 'get_asset_tag'): + return self._oem.get_asset_tag() return self._chunkwise_dcmi_fetch(6) def set_asset_tag(self, tag): """Set the asset tag value """ + self.oem_init() + if hasattr(self._oem, 'set_asset_tag'): + return self._oem.set_asset_tag(tag) return self._chunkwise_dcmi_set(8, tag) def _chunkwise_dcmi_fetch(self, command): @@ -1343,6 +1349,9 @@ class Command(object): chunk = bytearray(chunk) cmddata = bytearray((0xdc, offset, len(chunk))) cmddata += chunk + # set offset, otherwise the last setting will override + # the previous setting + offset += len(chunk) self.xraw_command(netfn=0x2c, command=command, data=cmddata) def set_channel_access(self, channel=None,