From 8e32e8713d189e29cee5816f7c873f8fb9dd4f4c Mon Sep 17 00:00:00 2001 From: Patrick Porlan Date: Thu, 25 Jun 2015 16:42:34 +0200 Subject: [PATCH] GMINL-12124: Fix timestamps on SX9500 capacitive proximity sensor 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 --- control.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/control.c b/control.c index bb67530..4220410 100644 --- 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++) -- 2.11.0