Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-intel-libsensors: Commit

hardware/intel/libsensors


Commit MetaInfo

Revisiond16b0eeb147394e4acc6f335edc08691ae440466 (tree)
Time2018-02-14 22:34:38
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

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.

Change Summary

Incremental Difference

--- a/enumeration.c
+++ b/enumeration.c
@@ -651,10 +651,10 @@ static int add_sensor (int dev_num, int catalog_index, int mode)
651651
652652 /* Set default scaling - if num_channels is zero, we have one channel */
653653
654- sensor[s].channel[0].opt_scale = 1;
654+ sensor[s].channel[0].opt_scale = (sensor_type == SENSOR_TYPE_ACCELEROMETER) ? -1 : 1;
655655
656656 for (c = 1; c < num_channels; c++)
657- sensor[s].channel[c].opt_scale = 1;
657+ sensor[s].channel[c].opt_scale = sensor[s].channel[0].opt_scale;
658658
659659 for (c = 0; c < num_channels; c++) {
660660 /* 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)
689689 ch_name = sensor_catalog[catalog_index].channel[c].name;
690690 sprintf(suffix, "%s.opt_scale", ch_name);
691691 if (!sensor_get_fl_prop(s, suffix, &opt_scale))
692- sensor[s].channel[c].opt_scale = opt_scale;
692+ sensor[s].channel[c].opt_scale *= opt_scale;
693693 }
694694 } else {
695695 if (!sensor_get_fl_prop(s, "opt_scale", &opt_scale))
Show on old repository browser