If you leave this disabled, your utilities will be especially
primitive and will be unable to determine the current screen width.
-#fixme: delete, create suboptions for applets which use this
-config FEATURE_USE_TERMIOS
- bool "Use termios for one-stroke input"
- default y
- help
- This option allows utilities such as 'top' to accept keyboard
- commands. Without this option, they simply refresh display
- after a fixed period.
-
config SHOW_USAGE
bool "Show applet usage messages"
default y
CONFIG_MKSWAP=y
CONFIG_FEATURE_MKSWAP_UUID=y
CONFIG_MORE=y
-CONFIG_FEATURE_USE_TERMIOS=y
CONFIG_VOLUMEID=y
CONFIG_FEATURE_VOLUMEID_EXT=y
CONFIG_FEATURE_VOLUMEID_BTRFS=y
# CONFIG_MKSWAP is not set
# CONFIG_FEATURE_MKSWAP_UUID is not set
# CONFIG_MORE is not set
-# CONFIG_FEATURE_USE_TERMIOS is not set
CONFIG_VOLUMEID=y
# CONFIG_FEATURE_VOLUMEID_EXT is not set
# CONFIG_FEATURE_VOLUMEID_BTRFS is not set
CONFIG_MKSWAP=y
CONFIG_FEATURE_MKSWAP_UUID=y
CONFIG_MORE=y
-CONFIG_FEATURE_USE_TERMIOS=y
CONFIG_VOLUMEID=y
CONFIG_FEATURE_VOLUMEID_EXT=y
CONFIG_FEATURE_VOLUMEID_BTRFS=y
CONFIG_MD5_SMALL=1
# CONFIG_FEATURE_FAST_TOP is not set
# CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
# CONFIG_FEATURE_EDITING is not set
CONFIG_FEATURE_EDITING_MAX_LEN=0
# CONFIG_FEATURE_EDITING_VI is not set
CONFIG_SHA3_SMALL=1
# CONFIG_FEATURE_FAST_TOP is not set
# CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
CONFIG_FEATURE_EDITING=y
CONFIG_FEATURE_EDITING_MAX_LEN=1024
# CONFIG_FEATURE_EDITING_VI is not set
CONFIG_MD5_SMALL=1
# CONFIG_FEATURE_FAST_TOP is not set
# CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
# CONFIG_FEATURE_EDITING is not set
CONFIG_FEATURE_EDITING_MAX_LEN=0
# CONFIG_FEATURE_EDITING_VI is not set
CONFIG_SHA3_SMALL=1
# CONFIG_FEATURE_FAST_TOP is not set
# CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
# CONFIG_FEATURE_EDITING is not set
CONFIG_FEATURE_EDITING_MAX_LEN=0
# CONFIG_FEATURE_EDITING_VI is not set
CONFIG_MD5_SMALL=1
CONFIG_FEATURE_FAST_TOP=y
# CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
CONFIG_FEATURE_EDITING=y
CONFIG_FEATURE_EDITING_MAX_LEN=1024
# CONFIG_FEATURE_EDITING_VI is not set
CONFIG_MD5_SMALL=1
CONFIG_FEATURE_FAST_TOP=y
# CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
CONFIG_FEATURE_EDITING=y
CONFIG_FEATURE_EDITING_MAX_LEN=1024
# CONFIG_FEATURE_EDITING_VI is not set
//config: default y
//config: help
//config: Analyze power consumption on Intel-based laptops
+//config:
+//config:config FEATURE_POWERTOP_INTERACTIVE
+//config: bool "Accept keyboard commands"
+//config: default y
+//config: depends on POWERTOP
+//config: help
+//config: Without this, powertop will only refresh display every 10 seconds.
+//config: No keyboard commands will work, only ^C to terminate.
// XXX This should be configurable
#define ENABLE_FEATURE_POWERTOP_PROCIRQ 1
ullong last_usage[MAX_CSTATE_COUNT];
ullong start_duration[MAX_CSTATE_COUNT];
ullong last_duration[MAX_CSTATE_COUNT];
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_POWERTOP_INTERACTIVE
struct termios init_settings;
#endif
};
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
} while (0)
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_POWERTOP_INTERACTIVE
static void reset_term(void)
{
tcsetattr_stdin_TCSANOW(&G.init_settings);
ullong cur_usage[MAX_CSTATE_COUNT];
ullong cur_duration[MAX_CSTATE_COUNT];
char cstate_lines[MAX_CSTATE_COUNT + 2][64];
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_POWERTOP_INTERACTIVE
struct pollfd pfd[1];
pfd[0].fd = 0;
puts("Collecting data for "DEFAULT_SLEEP_STR" seconds");
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_POWERTOP_INTERACTIVE
/* Turn on unbuffered input; turn off echoing, ^C ^Z etc */
set_termios_to_raw(STDIN_FILENO, &G.init_settings, TERMIOS_CLEAR_ISIG);
bb_signals(BB_FATAL_SIGS, sig_handler);
int i;
G.cant_enable_timer_stats |= start_timer(); /* 1 on error */
-#if !ENABLE_FEATURE_USE_TERMIOS
+#if !ENABLE_FEATURE_POWERTOP_INTERACTIVE
sleep(DEFAULT_SLEEP);
#else
if (safe_poll(pfd, 1, DEFAULT_SLEEP * 1000) > 0) {
//config: The top program provides a dynamic real-time view of a running
//config: system.
//config:
+//config:config FEATURE_TOP_INTERACTIVE
+//config: bool "Accept keyboard commands"
+//config: default y
+//config: depends on TOP
+//config: help
+//config: Without this, top will only refresh display every 5 seconds.
+//config: No keyboard commands will work, only ^C to terminate.
+//config:
//config:config FEATURE_TOP_CPU_USAGE_PERCENTAGE
//config: bool "Show CPU per-process usage percentage"
//config: default y
smallint smp_cpu_info; /* one/many cpu info lines? */
#endif
unsigned lines; /* screen height */
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
struct termios initial_settings;
int scroll_ofs;
#define G_scroll_ofs G.scroll_ofs
jiffy_counts_t *cpu_jif, *cpu_prev_jif;
int num_cpus;
#endif
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
char kbd_input[KEYCODE_BUFFER_SIZE];
#endif
char line_buf[80];
#define OPT_BATCH_MODE (option_mask32 & OPT_b)
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
static int pid_sort(top_status_t *P, top_status_t *Q)
{
/* Buggy wrt pids with high bit set */
top = NULL;
}
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
static void reset_term(void)
{
if (!OPT_BATCH_MODE)
reset_term();
kill_myself_with_sig(sig);
}
-#endif /* FEATURE_USE_TERMIOS */
+#endif /* FEATURE_TOP_INTERACTIVE */
/*
* TOPMEM support
EXIT_MASK = (unsigned)-1,
};
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
static unsigned handle_input(unsigned scan_mask, unsigned interval)
{
if (option_mask32 & OPT_EOF) {
//usage: "\n""Read the status of all processes from /proc each SECONDS"
//usage: "\n""and display a screenful of them."
//usage: "\n"
-//usage: IF_FEATURE_USE_TERMIOS(
+//usage: IF_FEATURE_TOP_INTERACTIVE(
//usage: "Keys:"
//usage: "\n"" N/M"
//usage: IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE("/P")
if (OPT_BATCH_MODE) {
option_mask32 |= OPT_EOF;
}
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
else {
/* Turn on unbuffered input; turn off echoing, ^C ^Z etc */
set_termios_to_raw(STDIN_FILENO, &initial_settings, TERMIOS_CLEAR_ISIG);
clearmems();
if (iterations >= 0 && !--iterations)
break;
-#if !ENABLE_FEATURE_USE_TERMIOS
+#if !ENABLE_FEATURE_TOP_INTERACTIVE
sleep(interval);
#else
scan_mask = handle_input(scan_mask, interval);
} /* end of "while (not Q)" */
bb_putchar('\n');
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
reset_term();
#endif
if (ENABLE_FEATURE_CLEAN_UP) {