Add SMART override for some Samsung devices

* Addresses issue #163
This commit is contained in:
2Shirt 2021-03-26 00:57:08 -06:00
parent 1a38a6d6a3
commit ae42634a8e
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 25 additions and 9 deletions

View file

@ -45,6 +45,10 @@ KNOWN_DISK_MODELS = {
r'CT(250|500|1000|2000)MX500SSD(1|4)': {
197: {'Warning': 1, 'Error': 2, 'Note': '(MX500 thresholds)',},
},
r'MZ(7|N)LN(128|256|512|1T0)HA(HQ|JQ|LR)-000H(1|7)': {
# Source: https://www.smartmontools.org/ticket/920
201: {'Error': 99, 'PercentageLife': True, 'Note': '(PM871b thresholds)'},
},
}
KNOWN_RAM_VENDOR_IDS = {
# https://github.com/hewigovens/hewigovens.github.com/wiki/Memory-vendor-code

View file

@ -210,7 +210,10 @@ class Disk(BaseObj):
continue
# Check attribute
if err_thresh <= value['raw'] < max_thresh:
if known_attributes[attr].get('PercentageLife', False):
if 0 <= value['raw'] <= err_thresh:
attributes_ok = False
elif err_thresh <= value['raw'] < max_thresh:
attributes_ok = False
# Done
@ -259,14 +262,23 @@ class Disk(BaseObj):
label = f' {label.replace("_", " "):38}'
# Value color
for threshold, color in ATTRIBUTE_COLORS:
threshold_val = known_attributes[attr].get(threshold, None)
if threshold_val and value['raw'] >= threshold_val:
value_color = color
if threshold == 'Error':
note = '(failed)'
elif threshold == 'Maximum':
note = '(invalid?)'
if known_attributes[attr].get('PercentageLife', False):
# PercentageLife values
if 0 <= value['raw'] <= known_attributes[attr]['Error']:
value_color = 'RED'
note = '(failed, % life remaining)'
elif value['raw'] < 0 or value['raw'] > 100:
value_color = 'PURPLE'
note = '(invalid?)'
else:
for threshold, color in ATTRIBUTE_COLORS:
threshold_val = known_attributes[attr].get(threshold, None)
if threshold_val and value['raw'] >= threshold_val:
value_color = color
if threshold == 'Error':
note = '(failed)'
elif threshold == 'Maximum':
note = '(invalid?)'
# 199/C7 warning
if str(attr) == '199' and value['raw'] > 0: