OSDN Git Service

GMINL-12124: Fix timestamps on SX9500 capacitive proximity sensor
authorPatrick Porlan <patrick.porlan@intel.com>
Thu, 25 Jun 2015 14:42:34 +0000 (16:42 +0200)
committerPatrick Porlan <patrick.porlan@intel.com>
Thu, 25 Jun 2015 14:42:34 +0000 (16:42 +0200)
Those were being left as real-time instead of being offset to
reflect time since boot, as required by Android.

Change-Id: I549f0270b508ecf94c1e69a42c8325088cfc24bb
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
control.c

index bb67530..4220410 100644 (file)
--- a/control.c
+++ b/control.c
@@ -1300,6 +1300,7 @@ static int integrate_device_report_from_event(int dev_num, int fd)
        int len, s;
        int64_t ts;
        struct iio_event_data event;
+       int64_t boot_to_rt_delta = get_timestamp_boot() - get_timestamp_realtime();
 
        /* There's an incoming report on the specified iio device char dev fd */
        if (fd == -1) {
@@ -1316,9 +1317,9 @@ static int integrate_device_report_from_event(int dev_num, int fd)
                return -1;
        }
 
-       ts = event.timestamp;
+       ts = event.timestamp + boot_to_rt_delta;
 
-       ALOGV("Read event %lld from fd %d of iio device %d\n", event.id, fd, dev_num);
+       ALOGV("Read event %lld from fd %d of iio device %d - ts %lld\n", event.id, fd, dev_num, ts);
 
        /* Map device report to sensor reports */
        for (s = 0; s < MAX_SENSORS; s++)