diff options
author | Ondrej Čerman <ondrej.cerman@gmail.com> | 2020-12-12 14:23:23 +0100 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2020-12-12 11:58:05 -0800 |
commit | 0893af788fb5b4ed05adb8efee0697eb6c63f866 (patch) | |
tree | 7bb8951cbd465db604285da9a2ccf89524dc0f3a /modules/devices | |
parent | 74a0db7398cec5f05d703c9b52337e3ba8988c76 (diff) |
devices/storage: added intepreted s.m.a.r.t. value
Diffstat (limited to 'modules/devices')
-rw-r--r-- | modules/devices/storage.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/modules/devices/storage.c b/modules/devices/storage.c index d9c8e043..ff1c24de 100644 --- a/modules/devices/storage.c +++ b/modules/devices/storage.c @@ -317,17 +317,40 @@ gboolean __scan_udisks2_devices(void) { if (disk->smart_attributes != NULL) { moreinfo = h_strdup_cprintf(_("[S.M.A.R.T. Attributes]\n" - "Attribute=Normalized Value / Worst / Threshold\n"), + "Attribute=Value / Normalized / Worst / Threshold\n"), moreinfo); attrib = disk->smart_attributes; while (attrib != NULL){ tmp = g_strdup(""); + + switch (attrib->interpreted_unit){ + case UDSK_INTPVAL_SKIP: + tmp = h_strdup_cprintf("-", tmp); + break; + case UDSK_INTPVAL_MILISECONDS: + tmp = h_strdup_cprintf("%ld ms", tmp, attrib->interpreted); + break; + case UDSK_INTPVAL_HOURS: + tmp = h_strdup_cprintf("%ld h", tmp, attrib->interpreted); + break; + case UDSK_INTPVAL_CELSIUS: + tmp = h_strdup_cprintf("%ld°C", tmp, attrib->interpreted); + break; + case UDSK_INTPVAL_SECTORS: + tmp = h_strdup_cprintf(ngettext("%ld sector", "%ld sectors", attrib->interpreted), tmp, attrib->interpreted); + break; + case UDSK_INTPVAL_DIMENSIONLESS: + default: + tmp = h_strdup_cprintf("%ld", tmp, attrib->interpreted); + break; + } + if (attrib->value != -1) - tmp = h_strdup_cprintf("%3d", tmp, attrib->value); + tmp = h_strdup_cprintf(" / %3d", tmp, attrib->value); else - tmp = h_strdup_cprintf("???", tmp); + tmp = h_strdup_cprintf(" / ???", tmp); if (attrib->worst != -1) tmp = h_strdup_cprintf(" / %3d", tmp, attrib->worst); |