OSDN Git Service

Magnetometer: Convert Gauss to uT in the case of sensors exposing input path also.
authorAdriana Reus <adriana.reus@intel.com>
Wed, 20 May 2015 12:58:02 +0000 (15:58 +0300)
committerViorel Suman <viorel.suman@intel.com>
Wed, 20 May 2015 09:06:39 +0000 (12:06 +0300)
It seems the Gauss to uT conversion wasn't done in the case where we have input
paths for magnetometers.

Change-Id: I9c89004d18dff47ee0c2d75df744290c901dc226
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
transform.c

index 7aee50d..9738f71 100644 (file)
@@ -551,8 +551,11 @@ float acquire_immediate_float_value (int s, int c)
                sprintf(sysfs_path, BASE_PATH "%s", dev_num, input_path);
                ret = sysfs_read_float(sysfs_path, &val);
 
-               if (!ret)
+               if (!ret) {
+                       if (sensor[s].type == SENSOR_TYPE_MAGNETIC_FIELD)
+                               return CONVERT_GAUSS_TO_MICROTESLA (val * correction);
                        return val * correction;
+               }
        }
 
        if (!sensor[s].channel[c].raw_path_present)