Skip to contentSkip to conversation

common, menu: do not trigger timeout again, if a line is read

PATCH New Heiko Schocher 3 participants 5 messages Jan 17, 2012 – Jan 18, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common, menu: do not trigger timeout again, if a line is read

---
 common/menu.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
common/menu.c +3 -1
index 754a9f9..aa16c9a 100644
@@ -236,8 +236,10 @@ static inline int menu_interactive_choice(struct menu *m, void **choice)
 		if (readret >= 0) {
 			choice_item = menu_item_by_key(m, cbuf);
 
-			if (!choice_item)
+			if (!choice_item) {
 				printf("%s not found\n", cbuf);
+				m->timeout = 0;
+			}
 		} else {
 			puts("^C\n");
 			return -EINTR;
Signature · 1 line
1.7.7.4
#1 lore raw

PATCH 1/1 common, menu: do not trigger timeout again, if a line is read

Dear Heiko,

Quoted 2 lines · Heiko Schocher
Quoted 23 lines
---
 common/menu.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
common/menu.c +3 -1
index 754a9f9..aa16c9a 100644
@@ -236,8 +236,10 @@ static inline int menu_interactive_choice(struct menu *m, void **choice)
 		if (readret >= 0) {
 			choice_item = menu_item_by_key(m, cbuf);
 
-			if (!choice_item)
+			if (!choice_item) {
 				printf("%s not found\n", cbuf);
+				m->timeout = 0;
+			}
 		} else {
 			puts("^C\n");
 			return -EINTR;
Signature · 1 line
1.7.7.4
#2 lore raw

PATCH 1/1 common, menu: do not trigger timeout again, if a line is read

In reply to Heiko Schocher

common/menu.c static inline int menu_interactive_choice(struct menu *m, void **choice) · line 245

Quoted 12 lines · On Tuesday 17 January 2012 03:24:29 Heiko Schocher wrote:
common/menu.c +3 -1
 			choice_item = menu_item_by_key(m, cbuf);
 
-			if (!choice_item)
+			if (!choice_item) {
 				printf("%s not found\n", cbuf);
+				m->timeout = 0;
+			}
 		} else {
 			puts("^C\n");
 			return -EINTR;

the summary says "do not timeout again if a line is read", but this C code seems like "do not timeout again if an item was selected but not found". but maybe i'm reading the menu code incorrectly ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120117/425e91f8/attachment.pgp>

#3 lore raw

PATCH 1/1 common, menu: do not trigger timeout again, if a line is read

Hello Mike,

Quoted 5 lines · Mike Frysinger
Quoted 4 lines · On Tuesday 17 January 2012 03:24:29 Heiko Schocher wrote:
common/menu.c +0 -0
 			choice_item = menu_item_by_key(m, cbuf);
Quoted 12 lines

common/menu.c static inline int menu_interactive_choice(struct menu *m, void **choice) · line 245

Quoted 8 lines
common/menu.c +3 -1
-			if (!choice_item)
+			if (!choice_item) {
 				printf("%s not found\n", cbuf);
+				m->timeout = 0;
+			}
 		} else {
 			puts("^C\n");
 			return -EINTR;

the summary says "do not timeout again if a line is read", but this C code seems like "do not timeout again if an item was selected but not found". but maybe i'm reading the menu code incorrectly ?

No, you are reading C code right, fix this, thanks!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#4 lore raw

PATCH v2 1/1 common, menu: do not timeout again if an item was selected but not found

In reply to Heiko Schocher

---
- changes for v2:
- add Acked-by from Jason Hobbs <[email protected]>
- add comment from Mike Frysinger:
- respell summary text

---
 common/menu.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
common/menu.c +3 -1
index 754a9f9..aa16c9a 100644
@@ -236,8 +236,10 @@ static inline int menu_interactive_choice(struct menu *m, void **choice)
 		if (readret >= 0) {
 			choice_item = menu_item_by_key(m, cbuf);
 
-			if (!choice_item)
+			if (!choice_item) {
 				printf("%s not found\n", cbuf);
+				m->timeout = 0;
+			}
 		} else {
 			puts("^C\n");
 			return -EINTR;
Signature · 1 line
1.7.7.5