X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=transform.c;h=38c24d24acd230427d3053115133d2f2da8a29de;hb=392a6b41be22b2f8106ef4b1bda6557239a31b5a;hp=7aee50d2c59042489b576ac5b10fbba8e120babf;hpb=3531d198cfa2bba5cdd7ad9863ecfbf7fdb95a18;p=android-x86%2Fhardware-intel-libsensors.git diff --git a/transform.c b/transform.c index 7aee50d..38c24d2 100644 --- a/transform.c +++ b/transform.c @@ -1,6 +1,18 @@ /* - * Copyright (C) 2014-2015 Intel Corporation. - */ +// Copyright (c) 2015 Intel Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +*/ #include #include @@ -41,8 +53,6 @@ #define CONVERT_M_Y (-CONVERT_M) #define CONVERT_M_Z (CONVERT_M) -#define CONVERT_GAUSS_TO_MICROTESLA(x) ((x) * 100) - /* Conversion of orientation data to degree units */ #define CONVERT_O (1.0 / 64) #define CONVERT_O_A (CONVERT_O) @@ -551,8 +561,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)