OSDN Git Service

Merge branch 'lineage-16.0' of https://github.com/me176c-dev/android_hardware_iio...
[android-x86/hardware-intel-libsensors.git] / enumeration.c
index c43ec83..359fa90 100644 (file)
@@ -446,7 +446,7 @@ static void populate_descriptors (int s, int sensor_type)
        sensor_desc[s].minDelay = sensor_get_min_delay(s);
        sensor_desc[s].maxDelay = sensor_get_max_delay(s);
 
-       ALOGV("Sensor %d (%s) type(%d) minD(%d) maxD(%d) flags(%2.2x)\n",
+       ALOGV("Sensor %d (%s) type(%d) minD(%d) maxD(%zd) flags(%2.2zx)\n",
                s, sensor[s].friendly_name, sensor_desc[s].type,
                sensor_desc[s].minDelay, sensor_desc[s].maxDelay,
                sensor_desc[s].flags);
@@ -651,10 +651,10 @@ static int add_sensor (int dev_num, int catalog_index, int mode)
 
         /* Set default scaling - if num_channels is zero, we have one channel */
 
-       sensor[s].channel[0].opt_scale = 1;
+       sensor[s].channel[0].opt_scale = (sensor_type == SENSOR_TYPE_ACCELEROMETER) ? -1 : 1;
 
        for (c = 1; c < num_channels; c++)
-               sensor[s].channel[c].opt_scale = 1;
+               sensor[s].channel[c].opt_scale = sensor[s].channel[0].opt_scale;
 
        for (c = 0; c < num_channels; c++) {
                /* Check the presence of the channel's input_path */
@@ -689,7 +689,7 @@ static int add_sensor (int dev_num, int catalog_index, int mode)
                        ch_name = sensor_catalog[catalog_index].channel[c].name;
                        sprintf(suffix, "%s.opt_scale", ch_name);
                        if (!sensor_get_fl_prop(s, suffix, &opt_scale))
-                               sensor[s].channel[c].opt_scale = opt_scale;
+                               sensor[s].channel[c].opt_scale *= opt_scale;
                }
         } else {
                if (!sensor_get_fl_prop(s, "opt_scale", &opt_scale))