Remove the selectedwindow options.
There is no logic behind the default window selection. The last
option parsed set the default window. Instead of having a specific
boolean set, use the first bit found in the flags for selecting the
the windows.
eg. powerdebug -s -g
=> flags = SENSOR_OPTION | GPIO_OPTION;
=> flags = 0x2 | 0x8 = 0x0a
=> flags = b01010000
=> fsl(flags) = 2
=> default window = 1 << fsl(flags) - 1
=> default window = 1 << 2 - 1
=> default window = 1 << 1
=> default window = 2 = SENSOR_OPTION
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
diff --git a/display.h b/display.h
index 8882918..d8f87bf 100644
--- a/display.h
+++ b/display.h
@@ -29,6 +29,8 @@
int (*change)(int keyvalue);
};
+struct powerdebug_options;
+
extern int display_print_line(int window, int line, char *str,
int bold, void *data);
extern void display_message(int window, char *buf);
@@ -37,7 +39,7 @@
extern int display_reset_cursor(int window);
extern void *display_get_row_data(int window);
-extern int display_init(int wdefault);
+extern int display_init(struct powerdebug_options *opt);
extern int display_register(int win, struct display_ops *ops);
extern int display_column_name(const char *line);