From 8dcca54f98078374d473d7d0940d88213738db1c Mon Sep 17 00:00:00 2001 From: michaeldu Date: Thu, 4 Feb 2016 17:57:15 +0800 Subject: [PATCH] Change DIMM serial to show 0 padded hexadecimal Other tools use DIMM serial numbers in hexadecimal. This makes sense as the underlying format is unspecified, so a hexadecimal value would make that more clear. Change-Id: I724d76ea8af7d20ee8ff0e294a9f96ffb571e80e --- pyghmi/ipmi/private/spd.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyghmi/ipmi/private/spd.py b/pyghmi/ipmi/private/spd.py index b86b37b2..4450ef32 100644 --- a/pyghmi/ipmi/private/spd.py +++ b/pyghmi/ipmi/private/spd.py @@ -735,8 +735,8 @@ class SPD(object): self.info['manufacturer'] = decode_manufacturer(spd[117], spd[118]) self.info['manufacture_location'] = spd[119] self.info['manufacture_date'] = decode_spd_date(spd[120], spd[121]) - self.info['serial'] = struct.unpack( - '>I', struct.pack('4B', *spd[122:126]))[0] + self.info['serial'] = hex(struct.unpack( + '>I', struct.pack('4B', *spd[122:126]))[0])[2:].rjust(8, '0') self.info['model'] = struct.pack('18B', *spd[128:146]) def _decode_ddr4(self): @@ -760,6 +760,6 @@ class SPD(object): self.info['manufacturer'] = decode_manufacturer(spd[320], spd[321]) self.info['manufacture_location'] = spd[322] self.info['manufacture_date'] = decode_spd_date(spd[323], spd[324]) - self.info['serial'] = struct.unpack( - '>I', struct.pack('4B', *spd[325:329]))[0] + self.info['serial'] = hex(struct.unpack( + '>I', struct.pack('4B', *spd[325:329]))[0])[2:].rjust(8, '0') self.info['model'] = struct.pack('18B', *spd[329:347])