mirror of
https://opendev.org/x/pyghmi
synced 2025-01-15 20:27:45 +00:00
Force non-numeric for compact sensor records
In the IPMI spec, compact sensors have the numeric format reserved and mandate an implementation set it to '3'. This mandate seems to have been ignored by some implementations. Force the value to be 3 for all compact sensor records and assume the reserved bits may never be used in a compact sensor. Change-Id: I88f5d7b533869809f213ab0c5379b276af50cd23
This commit is contained in:
parent
94433a2ab5
commit
7a3096e07b
@ -327,10 +327,19 @@ class SDREntry(object):
|
||||
# 1: generic threshold based
|
||||
# 0x6f: discrete sensor-specific from table 42-3, sensor offsets
|
||||
# all others per table 42-2, generic discrete
|
||||
self.numeric_format = (entry[15] & 0b11000000) >> 6
|
||||
# the spec technically reserves numeric_format for compact sensor
|
||||
# numeric, but common treatment won't break currently
|
||||
# numeric format is one of:
|
||||
# 0 - unsigned, 1 - 1s complement, 2 - 2s complement, 3 - ignore number
|
||||
# compact records are supposed to always write it as '3', presumably
|
||||
# to allow for the concept of a compact record with a numeric format
|
||||
# even though numerics are not allowed today. Some implementations
|
||||
# violate the spec and do something other than 3 today. Tolerate
|
||||
# the violation under the assumption that things are not so hard up
|
||||
# that there will ever be a need for compact sensors supporting numeric
|
||||
# values
|
||||
if self.rectype == 2:
|
||||
self.numeric_format = 3
|
||||
else:
|
||||
self.numeric_format = (entry[15] & 0b11000000) >> 6
|
||||
self.sensor_rate = sensor_rates[(entry[15] & 0b111000) >> 3]
|
||||
self.unit_mod = ""
|
||||
if (entry[15] & 0b110) == 0b10: # unit1 by unit2
|
||||
|
Loading…
x
Reference in New Issue
Block a user