return -ENOSYS;
}
+ if (sensor[s].hrtimer_trigger_name[0] != '\0') {
+ snprintf(trigger_path, PATH_MAX, "%s%s%d/", IIO_DEVICES, "trigger", sensor[s].trigger_nr);
+ snprintf(hrtimer_sampling_path, PATH_MAX, "%s%s", trigger_path, "sampling_frequency");
+ /* Enforce frequency update when software trigger
+ * frequency and current sampling rate are different */
+ if (sysfs_read_float(hrtimer_sampling_path, &sr) != -1 && sr != cur_sampling_rate)
+ cur_sampling_rate = -1;
+ }
+
/* Check if we have contraints on allowed sampling rates */
sprintf(avail_sysfs_path, DEVICE_AVAIL_FREQ_PATH, dev_num);
ALOGI("Sensor %d (%s) sampling rate set to %g\n", s, sensor[s].friendly_name, arb_sampling_rate);
- if (sensor[s].hrtimer_trigger_name[0] != '\0') {
- snprintf(trigger_path, PATH_MAX, "%s%s%d/", IIO_DEVICES, "trigger", sensor[s].trigger_nr);
- snprintf (hrtimer_sampling_path, PATH_MAX, "%s%s", trigger_path, "sampling_frequency");
+ if (sensor[s].hrtimer_trigger_name[0] != '\0')
sysfs_write_float(hrtimer_sampling_path, arb_sampling_rate);
- }
if (trig_sensors_per_dev[dev_num])
enable_buffer(dev_num, 0);