OSDN Git Service

hrtimer sampling frequency must be integral number
authorViorel Suman <viorel.suman@intel.com>
Tue, 16 Jun 2015 14:36:30 +0000 (17:36 +0300)
committerViorel Suman <viorel.suman@intel.com>
Tue, 16 Jun 2015 14:40:00 +0000 (17:40 +0300)
hrtimer sampling frequency must be an integral number,
so round to smallest integral value not less than the
passed frequency.

Change-Id: I0e7ca644dee3f679b1e26f422e3d87eedf7c7482
Signed-off-by: Viorel Suman <viorel.suman@intel.com>
control.c

index 2fd5b0d..bb67530 100644 (file)
--- a/control.c
+++ b/control.c
@@ -889,7 +889,7 @@ static int sensor_set_rate (int s, float requested_rate)
        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')
-               sysfs_write_float(hrtimer_sampling_path, arb_sampling_rate);
+               sysfs_write_float(hrtimer_sampling_path, ceilf(arb_sampling_rate));
 
        if (trig_sensors_per_dev[dev_num])
                enable_buffer(dev_num, 0);