From 9fe0c0521fd74387c4ca00b9c1b768762273502f Mon Sep 17 00:00:00 2001 From: Sanjay Singh Rawat Date: Fri, 22 Feb 2013 17:57:18 +0530 Subject: Version 0.6.2 - include gpio debug module for android - fix compliation issue and set env variables needed for android Signed-off-by: Sanjay Singh Rawat --- Android.mk | 2 +- powerdebug.c | 10 ++++++++++ regulator.c | 8 ++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Android.mk b/Android.mk index e062c1c..36c73cd 100644 --- a/Android.mk +++ b/Android.mk @@ -29,6 +29,6 @@ LOCAL_C_INCLUDES += external/stlport/stlport/ \ LOCAL_SRC_FILES += \ powerdebug.c sensor.c clocks.c regulator.c \ - display.c tree.c utils.c mainloop.c + display.c tree.c utils.c mainloop.c gpio.c include $(BUILD_EXECUTABLE) diff --git a/powerdebug.c b/powerdebug.c index cc9e871..073fd42 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -216,6 +216,16 @@ int main(int argc, char **argv) struct powerdebug_options *options; int ret; +#ifdef __ANDROID__ + if (setenv("TERM", "xterm", 1) < 0) { + fprintf(stderr, "setenv failure"); + return 1; + } + if (setenv("TERMINFO", "/system/etc/terminfo", 1) < 0) { + fprintf(stderr, "setenv failure"); + return 1; + } +#endif options = powerdebug_init(); if (!options) { fprintf(stderr, "not enough memory to allocate options\n"); diff --git a/regulator.c b/regulator.c index 55bd3e9..0da924a 100644 --- a/regulator.c +++ b/regulator.c @@ -90,13 +90,17 @@ static int regulator_dump_cb(struct tree *tree, void *data) printf("\n%s:\n", tree->name); for (i = 0; i < nregdata; i++) { + int val; if (file_read_value(tree->path, regdata[i].name, regdata[i].ifmt, buffer)) continue; - printf(regdata[i].ofmt, regdata[i].derefme ? - *((int *)buffer) : buffer); + if (regdata[i].derefme) { + val = atoi(buffer); + printf(regdata[i].ofmt, val); + } else + printf(regdata[i].ofmt, buffer); } return 0; -- cgit v1.2.3