From: Patrick Porlan Date: Wed, 2 Jul 2014 12:18:11 +0000 (+0200) Subject: STPK-1429 Minor tweak to compass calibration data save point X-Git-Tag: android-x86-7.1-r1~67^2~6 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=dbf1cc45025387dd175a44b9df63afff7f33e889;p=android-x86%2Fhardware-intel-libsensors.git STPK-1429 Minor tweak to compass calibration data save point Was being saved each time the magnetometer reference count was decremented. Doing it when it reaches zero is probably enough. Issue: STPK-1429 Change-Id: Ia465821cbf1ec22c5645753b6289e368d7ef2bd8 Signed-off-by: Patrick Porlan --- diff --git a/control.c b/control.c index d9e1ea2..a7de562 100644 --- a/control.c +++ b/control.c @@ -234,9 +234,6 @@ int adjust_counters (int s, int enabled) ALOGI("Disabling sensor %d (iio device %d: %s)\n", s, dev_num, sensor_info[s].friendly_name); - if (sensor_type == SENSOR_TYPE_MAGNETIC_FIELD) - compass_store_data(&sensor_info[s]); - sensor_info[s].enable_count--; if (sensor_info[s].enable_count > 0) @@ -244,6 +241,9 @@ int adjust_counters (int s, int enabled) /* Sensor disabled, lower report available flag */ sensor_info[s].report_pending = 0; + + if (sensor_type == SENSOR_TYPE_MAGNETIC_FIELD) + compass_store_data(&sensor_info[s]); } /* We changed the state of a sensor - adjust per iio device counters */