X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=entry.c;h=3a4fa34e2b7d31b82d4067bc847ae0638905a84a;hb=a1f77941c182b0d017bb0b2519738803fc0ba1c0;hp=96925f70ca7b6a9ebb3389e31f64208353877179;hpb=493c5eb55b080599fab798ffe1601e763ac4b3b6;p=android-x86%2Fhardware-intel-libsensors.git diff --git a/entry.c b/entry.c index 96925f7..3a4fa34 100644 --- a/entry.c +++ b/entry.c @@ -7,6 +7,7 @@ #include "enumeration.h" #include "control.h" #include "description.h" +#include "utils.h" /* This is the IIO Sensors HAL module entry points file */ @@ -15,9 +16,15 @@ static int init_count; static int activate (__attribute__((unused)) struct sensors_poll_device_t* dev, int handle, int enabled) { + int64_t entry_ts; + int ret; + int elapsed_ms; + if (init_count == 0 || handle < 0 || handle >= sensor_count) return -EINVAL; + entry_ts = get_timestamp_boot(); + /* * The Intel sensor hub seems to have trouble enabling sensors before * a sampling rate has been configured, and setting the sampling rate @@ -38,7 +45,18 @@ static int activate (__attribute__((unused)) struct sensors_poll_device_t* dev, sensor[handle].quirks ^= QUIRK_INITIAL_RATE; } - return sensor_activate(handle, enabled, 0); + ret = sensor_activate(handle, enabled, 0); + + elapsed_ms = (int) ((get_timestamp_boot() - entry_ts) / 1000000); + + if (elapsed_ms) { + if (enabled) + ALOGI("Activation of sensor %s took %d ms\n", sensor[handle].friendly_name, elapsed_ms); + else + ALOGI("Deactivation of sensor %s took %d ms\n", sensor[handle].friendly_name, elapsed_ms); + } + + return ret; }