From b4e597ff83140f5c3e20773a9c21bf8fe57f4405 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 8 Jul 2022 10:25:29 -0400 Subject: [PATCH] Migrate V2 and newer systems to new meters New proprietary commands are going to be used with a bit more capability. For now, migrate existing DC energy over to new command Change-Id: I30a003c4d45f4a0d591c80c55f1c267333f1123c --- pyghmi/ipmi/oem/lenovo/energy.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pyghmi/ipmi/oem/lenovo/energy.py b/pyghmi/ipmi/oem/lenovo/energy.py index 5957a031..93b627da 100644 --- a/pyghmi/ipmi/oem/lenovo/energy.py +++ b/pyghmi/ipmi/oem/lenovo/energy.py @@ -27,6 +27,15 @@ class EnergyManager(object): # We start with a 'find firmware instance' to test the water and # get the handle (which has always been the same, but just in case self.iana = bytearray(b'\x66\x4a\x00') + self._usefapm = False + try: + rsp = ipmicmd.xraw_command(netfn=0x3a, command=0x32, data=[4, 2, 0, 0, 0]) + self.supportedmeters = ('DC Energy',) + self._usefapm = True + return + except pygexc.IpmiException: + pass + try: rsp = ipmicmd.xraw_command(netfn=0x2e, command=0x82, data=self.iana + b'\x00\x00\x01') @@ -47,6 +56,12 @@ class EnergyManager(object): else: self.supportedmeters = ('DC Energy',) + def get_fapm_energy(self, ipmicmd): + rsp = ipmicmd.xraw_command(netfn=0x3a, command=0x32, data=[4, 2, 0, 0, 0]) + j, mj = struct.unpack('