diff options
author | Ondrej Čerman <ondrej.cerman@gmail.com> | 2019-10-23 20:48:54 +0200 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2019-10-24 07:52:15 -0700 |
commit | dc665743a4d62692c18c84d57554aa0e8df1a986 (patch) | |
tree | ff05ed92bf4eac863a3bc43b79d4ce7dced5152b /modules/devices | |
parent | 11d610f4a44599aedcd0022a516eb2326abdd46a (diff) |
Devices/storage: SMART attributes from udisks2
Diffstat (limited to 'modules/devices')
-rw-r--r-- | modules/devices/storage.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/modules/devices/storage.c b/modules/devices/storage.c index def39839..cedaed85 100644 --- a/modules/devices/storage.c +++ b/modules/devices/storage.c @@ -29,6 +29,7 @@ gboolean __scan_udisks2_devices(void) { GSList *node, *drives; udiskd *disk; udiskp *part; + udisksa *attrib; gchar *udisks2_storage_list = NULL, *features = NULL, *moreinfo = NULL; gchar *devid, *label, *size, *tmp = NULL, *media_comp = NULL; const gchar *url, *vendor_str, *media_label, *icon, *media_curr = NULL; @@ -199,6 +200,40 @@ gboolean __scan_udisks2_devices(void) { disk->smart_bad_sectors, disk->smart_poweron/(60*60*24), (disk->smart_poweron/60/60) % 24, disk->smart_temperature); + + if (disk->smart_attributes != NULL) { + moreinfo = h_strdup_cprintf(_("[S.M.A.R.T. Attributes]\n" + "Attribute=Normalized Value / Worst / Threshold\n"), + moreinfo); + + attrib = disk->smart_attributes; + + while (attrib != NULL){ + tmp = g_strdup(""); + if (attrib->value != -1) + tmp = h_strdup_cprintf("%3d", tmp, attrib->value); + else + tmp = h_strdup_cprintf("???", tmp); + + if (attrib->worst != -1) + tmp = h_strdup_cprintf(" / %3d", tmp, attrib->worst); + else + tmp = h_strdup_cprintf(" / ???", tmp); + + if (attrib->threshold != -1) + tmp = h_strdup_cprintf(" / %3d", tmp, attrib->threshold); + else + tmp = h_strdup_cprintf(" / ???", tmp); + + moreinfo = h_strdup_cprintf(_("(%d) %s=%s\n"), + moreinfo, + attrib->id, + attrib->identifier, + tmp); + g_free(tmp); + attrib = attrib->next; + } + } } if (disk->partition_table || disk->partitions) { moreinfo = h_strdup_cprintf(_("[Partition table]\n" |