diff options
author | Amit Arora <amit.arora@linaro.org> | 2010-12-02 16:22:29 +0530 |
---|---|---|
committer | Amit Arora <amit.arora@linaro.org> | 2010-12-02 16:22:29 +0530 |
commit | 422c52fa5209e8e97d45cc3718bc3c61ddf82f88 (patch) | |
tree | e39b4784bf4068060ca38c2f0ffcf2cb42abcad4 | |
parent | a06a7303746a2a014f8a8b2c8eea7271c924601b (diff) | |
download | powerdebug-422c52fa5209e8e97d45cc3718bc3c61ddf82f88.tar.gz |
By default show all data in dump mode
-rw-r--r-- | clocks.c | 4 | ||||
-rw-r--r-- | powerdebug.c | 40 | ||||
-rw-r--r-- | powerdebug.h | 1 | ||||
-rw-r--r-- | regulator.c | 5 | ||||
-rw-r--r-- | regulator.h | 12 | ||||
-rw-r--r-- | sensor.c | 5 |
6 files changed, 34 insertions, 33 deletions
@@ -267,15 +267,17 @@ void read_and_dump_clock_info_one(char *clk) printf("\nParents for \"%s\" Clock :\n\n", clk); read_clock_info(clk_dir_path); dump_all_parents(clk); + printf("\n\n"); } void read_and_dump_clock_info(int verbose) { (void)verbose; - printf("Clock Tree :\n"); + printf("\nClock Tree :\n"); printf("**********\n"); read_clock_info(clk_dir_path); dump_clock_info(clocks_info, 1, 1); + printf("\n\n"); } void read_clock_info(char *clkpath) diff --git a/powerdebug.c b/powerdebug.c index 3be47e1..0b405c0 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -28,16 +28,22 @@ char *win_names[TOTAL_FEATURE_WINS] = { "Clocks", "Sensors" }; -void usage(char **argv) +void usage(void) { - printf("Usage: %s [OPTIONS]\n", argv[0]); + printf("Usage: powerdebug [OPTIONS]\n"); + printf("\n"); + printf("powerdebug -d [ -r ] [ -s ] [ -c [ -p <clock-name> ] ] " + "[ -v ]\n"); + printf("powerdebug [ -r | -s | -c ]\n"); printf(" -r, --regulator Show regulator information\n"); printf(" -s, --sensor Show sensor information\n"); printf(" -c, --clock Show clock information\n"); - printf(" -p, --findparents Show all parents for a particular clock\n"); + printf(" -p, --findparents Show all parents for a particular" + " clock\n"); printf(" -t, --time Set ticktime in seconds (eg. 10.0)\n"); printf(" -d, --dump Dump information once (no refresh)\n"); - printf(" -v, --verbose Verbose mode (use with -r and/or -s)\n"); + printf(" -v, --verbose Verbose mode (use with -r and/or" + " -s)\n"); printf(" -V, --version Show Version\n"); printf(" -h, --help Help\n"); @@ -124,34 +130,30 @@ int main(int argc, char **argv) version(); break; case 'h': - usage(argv); + usage(); break; case '?': fprintf (stderr, "%s: Unknown option %c'.\n", argv[0], optopt); exit(1); default: - usage(argv); + usage(); break; } } -/* - if (!dump && (regulators || clocks || sensors)) { - fprintf(stderr, "Option supported only in dump mode (-d)\n"); - usage(argv); - } -*/ if (dump && !(regulators || clocks || sensors)) { - fprintf(stderr, "Dump mode (-d) supported only with -c, -r " - "or -s ..\n"); - usage(argv); + //fprintf(stderr, "Dump mode (-d) supported only with -c, -r " + // "or -s ..\n"); + //usage(); + // By Default lets show everything we have! + regulators = clocks = sensors = 1; } if (findparent && (!clocks || !dump)) { fprintf(stderr, "-p option passed without -c and -d." " Exiting...\n"); - usage(argv); + usage(); } if (!dump && selectedwindow == -1) @@ -172,7 +174,7 @@ int main(int argc, char **argv) } - if (selectedwindow == REGULATOR) { + if (regulators || selectedwindow == REGULATOR) { read_regulator_info(); if (!dump) { create_selectedwindow(); @@ -182,7 +184,7 @@ int main(int argc, char **argv) print_regulator_info(verbose); } - if (selectedwindow == CLOCK) { + if (clocks || selectedwindow == CLOCK) { int ret = 0; if (firsttime[CLOCK]) { ret = init_clock_details(); @@ -219,7 +221,7 @@ int main(int argc, char **argv) } } - if (selectedwindow == SENSOR) { + if (sensors || selectedwindow == SENSOR) { if (!dump) { create_selectedwindow(); print_sensor_header(); diff --git a/powerdebug.h b/powerdebug.h index bbd90fd..f351ff2 100644 --- a/powerdebug.h +++ b/powerdebug.h @@ -38,7 +38,6 @@ extern int numregulators; extern int dump; extern double ticktime; -extern void usage(char **argv); extern void version(void); extern void print_regulator_info(int verbose); diff --git a/regulator.c b/regulator.c index 56b0b06..5936e21 100644 --- a/regulator.c +++ b/regulator.c @@ -54,6 +54,9 @@ void print_regulator_info(int verbose) { int i; + printf("\nRegulator Information:\n"); + printf("*********************\n\n"); + for (i=0; i<numregulators; i++) { printf("Regulator %d:\n", i+1); print_string_val("name", regulators_info[i].name); @@ -103,6 +106,8 @@ void print_regulator_info(int verbose) printf("Could not find regulator information!"); printf(" Looks like /sys/class/regulator is empty.\n\n"); } + + printf("\n\n"); } void read_info_from_dirent(struct dirent *ritem, char *str, int idx) diff --git a/regulator.h b/regulator.h index 8e32b6d..c8aac5e 100644 --- a/regulator.h +++ b/regulator.h @@ -41,15 +41,3 @@ struct regulator_info { extern int numregulators; extern int dump; - -/*extern void usage(char **argv); -extern void print_regulator_info(int verbose); - -extern void init_curses(void); -extern void fini_curses(void); -extern void killall_windows(int all); -extern void show_header(void); -extern void create_windows(void); -extern void create_selectedwindow(void); -extern void show_regulator_info(int verbose); -*/ @@ -108,6 +108,9 @@ int read_and_print_sensor_info(int verbose) char device[PATH_MAX]; struct dirent *item, *subitem; + printf("\nSensor Information:\n"); + printf("******************\n"); + sprintf(filename, "%s", "/sys/class/hwmon"); dir = opendir(filename); if (!dir) @@ -162,5 +165,7 @@ int read_and_print_sensor_info(int verbose) printf(" Looks like /sys/class/hwmon is empty.\n"); } + printf("\n"); + return 0; } |