aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2010-04-13 23:46:02 -0400
committerMichal Marek <mmarek@suse.cz>2010-04-14 09:34:19 -0400
commit22c7eca61e51296643bb0a379fc726fda8f3b015 (patch)
treeee313b7cf959db1aa0e4fb33174fa8c4a1c8af3b
parent7b5d87215b38359ecadf7a69575b11e140a00484 (diff)
menuconfig: add support to show hidden options which have prompts
Usage: Press <Z> to show all config symbols which have prompts. Quote Tim Bird: | I've been bitten by this numerous times. I most often | use ftrace on ARM, but when I go back to x86, I almost | always go through a sequence of searching for the | function graph tracer in the menus, then realizing it's | completely missing until I disable CC_OPTIMIZE_FOR_SIZE. | | Is there any way to have the menu item appear, but be | unsettable unless the SIZE option is disabled? I'm | not a Kconfig guru... I myself found this useful too. For example, I need to test ftrace/tracing and want to be sure all the tracing features are enabled, so I enter the "Tracers" menu, and press <Z> to see if there is any config hidden. I also noticed gconfig and xconfig have a button "Show all options", but that's a bit too much, and I think normally what we are not interested in those configs which have no prompt thus can't be changed by users. Exmaple: --- Tracers -*- Kernel Function Tracer - - Kernel Function Graph Tracer [*] Interrupts-off Latency Tracer - - Preemption-off Latency Tracer [*] Sysprof Tracer Here you can see 2 tracers are not selectable, and then can find out how to make them selectable. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
-rw-r--r--scripts/kconfig/lkc_proto.h3
-rw-r--r--scripts/kconfig/lxdialog/menubox.c22
-rw-r--r--scripts/kconfig/mconf.c22
-rw-r--r--scripts/kconfig/menu.c10
4 files changed, 41 insertions, 16 deletions
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 41e652a8d1f6..7cadcad8233b 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -11,7 +11,8 @@ P(conf_set_changed_callback, void,(void (*fn)(void)));
11/* menu.c */ 11/* menu.c */
12P(rootmenu,struct menu,); 12P(rootmenu,struct menu,);
13 13
14P(menu_is_visible,bool,(struct menu *menu)); 14P(menu_is_visible, bool, (struct menu *menu));
15P(menu_has_prompt, bool, (struct menu *menu));
15P(menu_get_prompt,const char *,(struct menu *menu)); 16P(menu_get_prompt,const char *,(struct menu *menu));
16P(menu_get_root_menu,struct menu *,(struct menu *menu)); 17P(menu_get_root_menu,struct menu *,(struct menu *menu));
17P(menu_get_parent_menu,struct menu *,(struct menu *menu)); 18P(menu_get_parent_menu,struct menu *,(struct menu *menu));
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index fa9d633f293c..1d604738fa13 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -383,6 +383,10 @@ do_resize:
383 case 'n': 383 case 'n':
384 case 'm': 384 case 'm':
385 case '/': 385 case '/':
386 case 'h':
387 case '?':
388 case 'z':
389 case '\n':
386 /* save scroll info */ 390 /* save scroll info */
387 *s_scroll = scroll; 391 *s_scroll = scroll;
388 delwin(menu); 392 delwin(menu);
@@ -390,8 +394,10 @@ do_resize:
390 item_set(scroll + choice); 394 item_set(scroll + choice);
391 item_set_selected(1); 395 item_set_selected(1);
392 switch (key) { 396 switch (key) {
397 case 'h':
398 case '?':
399 return 2;
393 case 's': 400 case 's':
394 return 3;
395 case 'y': 401 case 'y':
396 return 3; 402 return 3;
397 case 'n': 403 case 'n':
@@ -402,18 +408,12 @@ do_resize:
402 return 6; 408 return 6;
403 case '/': 409 case '/':
404 return 7; 410 return 7;
411 case 'z':
412 return 8;
413 case '\n':
414 return button;
405 } 415 }
406 return 0; 416 return 0;
407 case 'h':
408 case '?':
409 button = 2;
410 case '\n':
411 *s_scroll = scroll;
412 delwin(menu);
413 delwin(dialog);
414 item_set(scroll + choice);
415 item_set_selected(1);
416 return button;
417 case 'e': 417 case 'e':
418 case 'x': 418 case 'x':
419 key = KEY_ESC; 419 key = KEY_ESC;
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index a4a75190457c..2c83d3234d30 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -67,13 +67,15 @@ static const char mconf_readme[] = N_(
67" there is a delayed response which you may find annoying.\n" 67" there is a delayed response which you may find annoying.\n"
68"\n" 68"\n"
69" Also, the <TAB> and cursor keys will cycle between <Select>,\n" 69" Also, the <TAB> and cursor keys will cycle between <Select>,\n"
70" <Exit> and <Help>\n" 70" <Exit> and <Help>.\n"
71"\n" 71"\n"
72"o To get help with an item, use the cursor keys to highlight <Help>\n" 72"o To get help with an item, use the cursor keys to highlight <Help>\n"
73" and Press <ENTER>.\n" 73" and press <ENTER>.\n"
74"\n" 74"\n"
75" Shortcut: Press <H> or <?>.\n" 75" Shortcut: Press <H> or <?>.\n"
76"\n" 76"\n"
77"o To show hidden options, press <Z>.\n"
78"\n"
77"\n" 79"\n"
78"Radiolists (Choice lists)\n" 80"Radiolists (Choice lists)\n"
79"-----------\n" 81"-----------\n"
@@ -272,6 +274,7 @@ static int indent;
272static struct menu *current_menu; 274static struct menu *current_menu;
273static int child_count; 275static int child_count;
274static int single_menu_mode; 276static int single_menu_mode;
277static int show_all_options;
275 278
276static void conf(struct menu *menu); 279static void conf(struct menu *menu);
277static void conf_choice(struct menu *menu); 280static void conf_choice(struct menu *menu);
@@ -346,8 +349,16 @@ static void build_conf(struct menu *menu)
346 int type, tmp, doint = 2; 349 int type, tmp, doint = 2;
347 tristate val; 350 tristate val;
348 char ch; 351 char ch;
349 352 bool visible;
350 if (!menu_is_visible(menu)) 353
354 /*
355 * note: menu_is_visible() has side effect that it will
356 * recalc the value of the symbol.
357 */
358 visible = menu_is_visible(menu);
359 if (show_all_options && !menu_has_prompt(menu))
360 return;
361 else if (!show_all_options && !visible)
351 return; 362 return;
352 363
353 sym = menu->sym; 364 sym = menu->sym;
@@ -606,6 +617,9 @@ static void conf(struct menu *menu)
606 case 7: 617 case 7:
607 search_conf(); 618 search_conf();
608 break; 619 break;
620 case 8:
621 show_all_options = !show_all_options;
622 break;
609 } 623 }
610 } 624 }
611} 625}
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 62e3f15ede0f..203632cc30bd 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -390,6 +390,13 @@ void menu_finalize(struct menu *parent)
390 } 390 }
391} 391}
392 392
393bool menu_has_prompt(struct menu *menu)
394{
395 if (!menu->prompt)
396 return false;
397 return true;
398}
399
393bool menu_is_visible(struct menu *menu) 400bool menu_is_visible(struct menu *menu)
394{ 401{
395 struct menu *child; 402 struct menu *child;
@@ -398,6 +405,7 @@ bool menu_is_visible(struct menu *menu)
398 405
399 if (!menu->prompt) 406 if (!menu->prompt)
400 return false; 407 return false;
408
401 sym = menu->sym; 409 sym = menu->sym;
402 if (sym) { 410 if (sym) {
403 sym_calc_value(sym); 411 sym_calc_value(sym);
@@ -407,12 +415,14 @@ bool menu_is_visible(struct menu *menu)
407 415
408 if (visible != no) 416 if (visible != no)
409 return true; 417 return true;
418
410 if (!sym || sym_get_tristate_value(menu->sym) == no) 419 if (!sym || sym_get_tristate_value(menu->sym) == no)
411 return false; 420 return false;
412 421
413 for (child = menu->list; child; child = child->next) 422 for (child = menu->list; child; child = child->next)
414 if (menu_is_visible(child)) 423 if (menu_is_visible(child))
415 return true; 424 return true;
425
416 return false; 426 return false;
417} 427}
418 428