From d16b0eeb147394e4acc6f335edc08691ae440466 Mon Sep 17 00:00:00 2001 From: Chih-Wei Huang Date: Wed, 14 Feb 2018 21:34:38 +0800 Subject: [PATCH] Reverse the default orientation of accelerometer More people reported the orientation of accelerometer is reversed. Though we can adjust that by properties, it's easier to just change the default orientation. --- enumeration.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/enumeration.c b/enumeration.c index f4f2afe..359fa90 100644 --- a/enumeration.c +++ b/enumeration.c @@ -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)) -- 2.11.0