The terse flag should only be used with drivers that a) don't
expose a recognizable motion trigger (we currently look for the
any-motion substring), b) are not for sensor types that Android
defines as continuous, and c) are nonetheless on-change. As of
today the only remaining example of this that I can think of
are the XPS 12 ISH drivers, so I prefer not to use this flag
to decide whether or not to apply calibration. Checking whether
we're using the initial or motion trigger seems better, if not
fully satisfactory.
Change-Id: I24c6632497f758e1301da7927ec94bf17f6fe84d
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
*/
data->gyro.status = SENSOR_STATUS_ACCURACY_MEDIUM;
- if (!(sensor_info[s].quirks & QUIRK_TERSE_DRIVER))
- calibrate_gyro(data, &sensor_info[s]);
+ /*
+ * We're only trying to calibrate data from continuously
+ * firing gyroscope drivers, as motion based ones use
+ * movement thresholds that may lead us to incorrectly
+ * estimate bias.
+ */
+ if (sensor_info[s].selected_trigger !=
+ sensor_info[s].motion_trigger_name)
+ calibrate_gyro(data, &sensor_info[s]);
+
if (sensor_info[s].quirks & QUIRK_NOISY)
denoise_median(&sensor_info[s], data, 3);
break;