mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/4] readkey: add define for Ascii keys
Date: Tue, 14 Feb 2012 15:31:19 +0100	[thread overview]
Message-ID: <1329229881-26751-2-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1329229881-26751-1-git-send-email-plagnioj@jcrosoft.com>

this will simplify the usage of gpio keyboard

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/menu.c     |    6 +++---
 include/readkey.h |    4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/common/menu.c b/common/menu.c
index 5291fcb..fd21e52 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -296,7 +296,7 @@ int menu_show(struct menu *m)
 
 	do {
 		if (m->auto_select >= 0)
-			ch = '\n';
+			ch = KEY_ENTER;
 		else
 			ch = getc();
 
@@ -339,8 +339,8 @@ int menu_show(struct menu *m)
 				m->selected->action(m, m->selected);
 			print_menu_entry(m, m->selected, 1);
 			break;
-		case '\n':
-		case '\r':
+		case KEY_ENTER:
+		case KEY_RETURN:
 			clear();
 			gotoXY(1,1);
 			m->selected->action(m, m->selected);
diff --git a/include/readkey.h b/include/readkey.h
index aabb835..f134846 100644
--- a/include/readkey.h
+++ b/include/readkey.h
@@ -3,6 +3,10 @@
 
 #define CTL_CH(c)		((c) - 'a' + 1)
 
+/* Ascii keys */
+#define KEY_ENTER		'\n'
+#define KEY_RETURN		'\r'
+
 /* Misc. non-Ascii keys */
 #define KEY_UP			CTL_CH('p')	/* cursor key Up	*/
 #define KEY_DOWN		CTL_CH('n')	/* cursor key Down	*/
-- 
1.7.7


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-02-14 14:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-14 14:31 [PATCH 1/4] add gpio keyboard support Jean-Christophe PLAGNIOL-VILLARD
2012-02-14 14:31 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-02-14 14:31 ` [PATCH 3/4] at91: at91_register_uart return device Jean-Christophe PLAGNIOL-VILLARD
2012-02-14 14:31 ` [PATCH 4/4] usb-a926x: add DAB MMX Daughter board support Jean-Christophe PLAGNIOL-VILLARD
2012-02-15  9:31 ` [PATCH 1/4] add gpio keyboard support Sascha Hauer
2012-02-15 16:14   ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-16  7:51     ` Sascha Hauer
2012-02-16 10:20 ` [PATCH 1/4 v2] " Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1329229881-26751-2-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox