OSDN Git Service

STPK-1429 Fix temperature sensor readings
authorPatrick Porlan <patrick.porlan@intel.com>
Fri, 28 Mar 2014 13:25:18 +0000 (14:25 +0100)
committersuyyala <sridhar.uyyala@intel.com>
Mon, 28 Apr 2014 02:40:39 +0000 (19:40 -0700)
Raw levels were not being converted to standard units,
for poll-mode sensors only. This fixes the temperature
readings on the T100.

Change-Id: I95832b748d707d3d517ff618415f53f6f6d1f859
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
control.c
enumeration.c

index 2fe4751..811270d 100644 (file)
--- a/control.c
+++ b/control.c
@@ -476,7 +476,7 @@ static float acquire_immediate_value(int s, int c)
        if (ret == -1)
                return 0;
 
-       return val;
+       return (val + offset) * scale;
 }
 
 
index fc68760..335569c 100644 (file)
@@ -83,6 +83,8 @@ static void add_sensor (int dev_num, int catalog_index, int use_polling)
        sprintf(sysfs_path, COMMON_SCALE_PATH, dev_num, prefix);
        if (!sysfs_read_float(sysfs_path, &scale))
                 sensor_info[s].scale = scale;
+        else
+                sensor_info[s].scale = 1;
 
        /* Initialize Android-visible descriptor */
        sensor_desc[s].name             = sensor_get_name(s);