struct timespec target_time;
int64_t period;
- ALOGV("Entering data acquisition thread for sensor %d\n", s);
+ ALOGI("Entering data acquisition thread S%d (%s): rate(%f), minDelay(%ld), maxDelay(%ld)\n",
+ s, sensor_info[s].friendly_name, sensor_info[s].sampling_rate,
+ sensor_desc[s].minDelay, sensor_desc[s].maxDelay);
if (s < 0 || s >= sensor_count) {
ALOGE("Invalid sensor handle!\n");
free(sensor_info[s].history);
sensor_info[s].history = NULL;
sensor_info[s].history_size = 0;
+ if (sensor_info[s].history_sum) {
+ free(sensor_info[s].history_sum);
+ sensor_info[s].history_sum = NULL;
+ }
}
return 0;
* this may not be the case. Perhaps we'll get rid of this when
* we'll be reading the timestamp from the iio channel for all sensors
*/
- if (sensor_info[s].report_ts &&
- sensor_info[s].sampling_rate && !sensor_desc[s].flags) {
+ if (sensor_info[s].report_ts && sensor_info[s].sampling_rate &&
+ REPORTING_MODE(sensor_desc[s].flags) == SENSOR_FLAG_CONTINUOUS_MODE)
+ {
period = (int64_t) (1000000000LL / sensor_info[s].sampling_rate);
maxTs = sensor_info[s].report_ts + period;
sensor_info[s].report_ts = (ts < maxTs ? ts : maxTs);
if (!sensor_info[s].enable_count)
continue;
- /* If the sensor can generate duplicates, leave it alone */
- if (!(sensor_info[s].quirks & QUIRK_TERSE_DRIVER) &&
- sensor_info[s].selected_trigger !=
+ /* If the sensor is continuously firing, leave it alone */
+ if ( sensor_info[s].selected_trigger !=
sensor_info[s].motion_trigger_name)
continue;
*/
for (s=0; s<sensor_count; s++)
if (sensor_info[s].enable_count &&
- ((sensor_info[s].quirks & QUIRK_TERSE_DRIVER) ||
- sensor_info[s].selected_trigger ==
- sensor_info[s].motion_trigger_name) &&
- sensor_info[s].sampling_rate) {
+ sensor_info[s].selected_trigger ==
+ sensor_info[s].motion_trigger_name &&
+ sensor_info[s].sampling_rate) {
period = (int64_t) (1000000000.0 /
sensor_info[s].sampling_rate);