From: Patrick Porlan Date: Thu, 25 Jun 2015 14:42:34 +0000 (+0200) Subject: GMINL-12124: Fix timestamps on SX9500 capacitive proximity sensor X-Git-Tag: android-x86-7.1-r1~16^2~2^2 X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fhardware-intel-libsensors.git;a=commitdiff_plain;h=8e32e8713d189e29cee5816f7c873f8fb9dd4f4c;hp=be51c359b09e39e3cba53c04e8aabe34d209aa1f 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 --- 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++)