hidl:sensors: Dump sensor information if verbose is turned on
authorAndreas Schneider <asn@cryptomilk.org>
Thu, 16 Jul 2020 15:07:39 +0000 (17:07 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 16 Jul 2020 15:09:02 +0000 (17:09 +0200)
This is useful for improving the sensors HAL.

Change-Id: I41430974b40e14095396aaf645b8b37d08b13710

hidl/sensors/Sensors.cpp

index d4e84b34219ff742323d99c27d319fe072c59b86..dc54bb5e8e4f0f8693ca12116d4612dda80182d3 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+//#define VERBOSE
+
 #include "Sensors.h"
 #include <sensors/convert.h>
 #include "multihal.h"
@@ -139,6 +141,15 @@ Return<void> Sensors::getSensorsList(getSensorsList_cb _hidl_cb) {
             dst->typeAsString = SENSOR_STRING_TYPE_PROXIMITY;
             dst->maxRange = 1;
         }
+
+#ifdef VERBOSE
+        LOG(INFO) << "SENSOR NAME:           " << dst->name;
+        LOG(INFO) << "       VENDOR:         " << dst->name;
+        LOG(INFO) << "       TYPE:           " << (uint32_t)dst->type;
+        LOG(INFO) << "       TYPE_AS_STRING: " << dst->typeAsString;
+        LOG(INFO) << "       FLAGS:          " << std::hex << dst->flags;
+        LOG(INFO) << "";
+#endif
     }
 
     _hidl_cb(out);