From 52a4f281fe8b87aeb79156c4dc3ca971c03c0cec Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 5 Jan 2021 16:16:03 -0500 Subject: [PATCH] Support newer SMMv2 API for PSU Newer SMM firmware supports 16 bit wide fields instead of 8, use struct to unpack them to align with the 8-bit wide fields from before. Change-Id: I485fa1bc03eb1fd6eaf7f0e800ed2a46ae5ad1ed --- pyghmi/ipmi/oem/lenovo/nextscale.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index 8f1dc60b..b9cb787a 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -86,11 +86,15 @@ def fpc_read_psu_fan(ipmicmd, number, sz): def fpc_get_psustatus(ipmicmd, number, sz): rsp = ipmicmd.xraw_command(netfn=0x32, command=0x91) mask = 1 << (number - 1) + rsp['data'] = bytearray(rsp['data']) + if len(rsp['data']) == 10: + tmpdata = rsp['data'] + rsp['data'] = list(struct.unpack('