summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--smart.c15
-rw-r--r--smart.h4
-rw-r--r--smart.vapi4
-rw-r--r--smartkitd.vala8
4 files changed, 16 insertions, 15 deletions
diff --git a/smart.c b/smart.c
index f0710c4..a90c3ab 100644
--- a/smart.c
+++ b/smart.c
@@ -711,11 +711,11 @@ static const SkSmartAttributeInfo const attribute_info[255] = {
[13] = { "read-soft-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE },
[187] = { "reported-uncorrect", SK_SMART_ATTRIBUTE_UNIT_SECTORS },
[189] = { "high-fly-writes", SK_SMART_ATTRIBUTE_UNIT_NONE },
- [190] = { "airflow-temperature-celsius", SK_SMART_ATTRIBUTE_UNIT_KELVIN },
+ [190] = { "airflow-temperature-celsius", SK_SMART_ATTRIBUTE_UNIT_MKELVIN },
[191] = { "g-sense-error-rate", SK_SMART_ATTRIBUTE_UNIT_NONE },
[192] = { "power-off-retract-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
[193] = { "load-cycle-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
- [194] = { "temperature-celsius-2", SK_SMART_ATTRIBUTE_UNIT_KELVIN },
+ [194] = { "temperature-celsius-2", SK_SMART_ATTRIBUTE_UNIT_MKELVIN },
[195] = { "hardware-ecc-recovered", SK_SMART_ATTRIBUTE_UNIT_NONE },
[196] = { "reallocated-event-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
[197] = { "current-pending-sector", SK_SMART_ATTRIBUTE_UNIT_SECTORS },
@@ -741,7 +741,7 @@ static const SkSmartAttributeInfo const attribute_info[255] = {
[227] = { "torq-amp-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
[228] = { "power-off-retract-count", SK_SMART_ATTRIBUTE_UNIT_NONE },
[230] = { "head-amplitude", SK_SMART_ATTRIBUTE_UNIT_UNKNOWN },
- [231] = { "temperature-celsius-1", SK_SMART_ATTRIBUTE_UNIT_KELVIN },
+ [231] = { "temperature-celsius-1", SK_SMART_ATTRIBUTE_UNIT_MKELVIN },
[240] = { "head-flying-hours", SK_SMART_ATTRIBUTE_UNIT_MSECONDS },
[250] = { "read-error-retry-rate", SK_SMART_ATTRIBUTE_UNIT_NONE }
};
@@ -768,7 +768,7 @@ static void make_pretty(SkSmartAttributeParsedData *a) {
else if (!strcmp(a->name, "airflow-temperature-celsius") ||
!strcmp(a->name, "temperature-celsius-1") ||
!strcmp(a->name, "temperature-celsius-2")) {
- a->pretty_value = (fourtyeight & 0xFFFF) + 273;
+ a->pretty_value = (fourtyeight & 0xFFFF)*1000 + 273150;
} else if (!strcmp(a->name, "power-on-minutes"))
a->pretty_value = fourtyeight * 60 * 1000;
else if (!strcmp(a->name, "power-on-seconds"))
@@ -779,7 +779,6 @@ static void make_pretty(SkSmartAttributeParsedData *a) {
a->pretty_value = fourtyeight * 60 * 60 * 1000;
else
a->pretty_value = fourtyeight;
-
}
static const SkSmartAttributeInfo *lookup_attribute(SkDisk *d, guint8 id) {
@@ -967,7 +966,7 @@ const char* sk_smart_attribute_unit_to_string(SkSmartAttributeUnit unit) {
[SK_SMART_ATTRIBUTE_UNIT_NONE] = "",
[SK_SMART_ATTRIBUTE_UNIT_MSECONDS] = "ms",
[SK_SMART_ATTRIBUTE_UNIT_SECTORS] = "sectors",
- [SK_SMART_ATTRIBUTE_UNIT_KELVIN] = "K"
+ [SK_SMART_ATTRIBUTE_UNIT_MKELVIN] = "mK"
};
if (unit >= _SK_SMART_ATTRIBUTE_UNIT_MAX)
@@ -1009,9 +1008,9 @@ static char *print_value(char *s, size_t len, const SkSmartAttributeParsedData *
break;
- case SK_SMART_ATTRIBUTE_UNIT_KELVIN:
+ case SK_SMART_ATTRIBUTE_UNIT_MKELVIN:
- g_snprintf(s, len, "%lli C", (long long) a->pretty_value - 273);
+ g_snprintf(s, len, "%0.1f C", ((double) a->pretty_value - 273150) / 1000);
break;
case SK_SMART_ATTRIBUTE_UNIT_SECTORS:
diff --git a/smart.h b/smart.h
index 3a8c315..feedfd5 100644
--- a/smart.h
+++ b/smart.h
@@ -100,9 +100,9 @@ unsigned sk_smart_self_test_polling_minutes(const SkSmartParsedData *d, SkSmartS
typedef enum SkSmartAttributeUnit {
SK_SMART_ATTRIBUTE_UNIT_UNKNOWN,
SK_SMART_ATTRIBUTE_UNIT_NONE,
- SK_SMART_ATTRIBUTE_UNIT_MSECONDS,
+ SK_SMART_ATTRIBUTE_UNIT_MSECONDS, /* milliseconds */
SK_SMART_ATTRIBUTE_UNIT_SECTORS,
- SK_SMART_ATTRIBUTE_UNIT_KELVIN,
+ SK_SMART_ATTRIBUTE_UNIT_MKELVIN, /* millikelvin */
_SK_SMART_ATTRIBUTE_UNIT_MAX
} SkSmartAttributeUnit;
diff --git a/smart.vapi b/smart.vapi
index 9ec1b27..c167098 100644
--- a/smart.vapi
+++ b/smart.vapi
@@ -81,7 +81,7 @@ namespace Smart {
[CCode (cname="SkSmartAttributeUnit", cprefix="SK_SMART_ATTRIBUTE_UNIT_")]
public enum SmartAttributeUnit {
- UNKNOWN, NONE, MSECONDS, SECTORS, KELVIN
+ UNKNOWN, NONE, MSECONDS, SECTORS, MKELVIN
}
[CCode (cname="sk_smart_attribute_unit_to_string")]
@@ -91,7 +91,7 @@ namespace Smart {
[CCode (cname="SkSmartAttributeParsedData")]
public struct SmartAttributeParsedData {
public uint8 id;
- public char *name;
+ public string name;
public SmartAttributeUnit pretty_unit;
public uint16 flags;
public uint8 threshold;
diff --git a/smartkitd.vala b/smartkitd.vala
index 5c2edf5..7e60403 100644
--- a/smartkitd.vala
+++ b/smartkitd.vala
@@ -84,6 +84,8 @@ public interface DiskAPI {
public abstract uint getShortTestPollingMinutes() throws Error;
public abstract uint getExtendedTestPollingMinutes() throws Error;
public abstract uint getConveyanceTestPollingMinutes() throws Error;
+
+/* public abstract DBus.ObjectPath[] getAttributes() throws Error; */
}
[DBus (name = "net.poettering.SmartKit.Manager")]
@@ -131,7 +133,7 @@ public class Attribute : GLib.Object, AttributeAPI {
public void set(SmartAttributeParsedData a) {
id = a.id;
- name = "%s".printf(a.name);
+ name = a.name;
pretty_unit = a.pretty_unit;
threshold = a.threshold;
threshold_valid = a.threshold_valid;
@@ -167,8 +169,8 @@ public class Attribute : GLib.Object, AttributeAPI {
return "none";
case SmartAttributeUnit.MSECONDS:
return "mseconds";
- case SmartAttributeUnit.KELVIN:
- return "kelvin";
+ case SmartAttributeUnit.MKELVIN:
+ return "mkelvin";
default:
throw new Error.UNKNOWN_UNIT("Unit unknown.");
}