From 8aa41d6e2fa3728a8260220b10de0527560fad60 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Thu, 26 Sep 2013 13:07:35 -0700 Subject: [PATCH] libsensors: Allow IIO max sample rate to be configured via properties Different hubs have different behavior. Really we want to probe this out of the hardware, but for HID sensors on I2C (as opposed to USB) userspace doesn't get access to the descriptor right now. Change-Id: I8bcd077509b43bba6025ca5f55ba9373db89cd8b For: AXIA-3287 Signed-off-by: Andy Ross Reviewed-on: https://otc-android.intel.com/gerrit/22151 Tested-by: jenkins autobuilder Reviewed-by: Russell Webb --- common/libsensors/SensorIIODev.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/libsensors/SensorIIODev.cpp b/common/libsensors/SensorIIODev.cpp index faf7fdd..dfc2638 100644 --- a/common/libsensors/SensorIIODev.cpp +++ b/common/libsensors/SensorIIODev.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include "SensorIIODev.h" #include "Helpers.h" @@ -65,6 +66,15 @@ int SensorIIODev::discover() int status; int ret; + // Allow overriding sample_delay_min_ms via properties using + // the IIO device name. e.g.: + // ro.sys.sensors_accel_3d_samp_min_ms = 16 + char sampmin[PROPERTY_VALUE_MAX]; + std::string pn = "ro.sys.sensors_" + device_name + "_samp_min_ms"; + property_get(pn.c_str(), sampmin, ""); + if(*sampmin) + sample_delay_min_ms = strtol(sampmin, NULL, 10); + ALOGD(">>%s discover", __func__); for (cnt = 0; cnt < retry_count; cnt++) { status = ParseIIODirectory(device_name); -- 2.11.0