Re: [U-Boot] [PATCH v4 2/4] New command bootmenu: ANSI terminal boot menu support

2013-03-28 Thread Pali Rohár
On Friday 29 March 2013 00:13:30 Anatolij Gustschin wrote:
> Hi,
> 
> On Thu, 28 Mar 2013 20:18:48 +0100
> Pali Rohár  wrote:
> ...
> 
> > Hi, can you include also two next patches from this series?
> > 
> > http://patchwork.ozlabs.org/patch/217492/
> > http://patchwork.ozlabs.org/patch/225868/
> 
> These patches are in my queue, I didn't forgot about them :-)
> 
> Regarding the "clear" command Wolfgang had some reservations
> since we already have "cls" command for LCDs. Wolfgang
> suggested to unify with the existing command in a backward
> compatible way. I'm going to submit a patch which tries to do
> this.
> 
> The v3 4/4 patch can be applied as is, I think.
> 
> Thanks,
> 
> Anatolij


Ok, thanks!

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 2/4] New command bootmenu: ANSI terminal boot menu support

2013-03-28 Thread Anatolij Gustschin
Hi,

On Thu, 28 Mar 2013 20:18:48 +0100
Pali Rohár  wrote:
...
> 
> Hi, can you include also two next patches from this series?
> 
> http://patchwork.ozlabs.org/patch/217492/
> http://patchwork.ozlabs.org/patch/225868/

These patches are in my queue, I didn't forgot about them :-)

Regarding the "clear" command Wolfgang had some reservations since
we already have "cls" command for LCDs. Wolfgang suggested to
unify with the existing command in a backward compatible way.
I'm going to submit a patch which tries to do this.

The v3 4/4 patch can be applied as is, I think.

Thanks,

Anatolij
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 2/4] New command bootmenu: ANSI terminal boot menu support

2013-03-28 Thread Pali Rohár
On Thursday 28 March 2013 16:32:47 Anatolij Gustschin wrote:
> On Sun, 24 Mar 2013 01:53:08 +0100
> 
> Anatolij Gustschin  wrote:
> > From: Pali Rohár 
> > 
> > The "bootmenu" command uses U-Boot menu interfaces and
> > provides a simple mechanism for creating menus with several
> > boot items. When running this command the menu will be
> > assembled as defined by a set of environment variables
> > which contain a title and command key-value pairs. The "Up"
> > and "Down" keys are used for navigation through the items.
> > Current active menu item is highlighted and can be selected
> > using the "Enter" key.
> > 
> > The command interprets and generates various ANSI escape
> > sequencies, so for proper menu rendering and item selection
> > the used terminal should support them.
> > 
> > Signed-off-by: Pali Rohár 
> > [agust: various fixes and documentation updates]
> > Signed-off-by: Anatolij Gustschin 
> 
> applied to staging/ag...@denx.de. Thanks.
> 
> Anatolij

Hi, can you include also two next patches from this series?

http://patchwork.ozlabs.org/patch/217492/
http://patchwork.ozlabs.org/patch/225868/

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 2/4] New command bootmenu: ANSI terminal boot menu support

2013-03-28 Thread Anatolij Gustschin
On Sun, 24 Mar 2013 01:53:08 +0100
Anatolij Gustschin  wrote:

> From: Pali Rohár 
> 
> The "bootmenu" command uses U-Boot menu interfaces and provides
> a simple mechanism for creating menus with several boot items.
> When running this command the menu will be assembled as defined
> by a set of environment variables which contain a title and
> command key-value pairs. The "Up" and "Down" keys are used for
> navigation through the items. Current active menu item is
> highlighted and can be selected using the "Enter" key.
> 
> The command interprets and generates various ANSI escape
> sequencies, so for proper menu rendering and item selection
> the used terminal should support them.
> 
> Signed-off-by: Pali Rohár 
> [agust: various fixes and documentation updates]
> Signed-off-by: Anatolij Gustschin 
> ---
> Changes in v4:
> - coding style fixes
> - highlight only the menu entry title, not the whole line
> - don't return empty strings in bootmenu_choice_entry()
>   to avoid useless searching for menu keys in the menu
>   item list. Empty key strings won't be found anyway, so
>   for down and up keys just return NULL in this function 
>   to indicate that no item selection happened yet
> - print error message if invalid bootmenu environment 
>   variable without title/command separator found
> - if number of menu items is equal to MAX_COUNT, the 
>   U-Boot console selection entry won't be generated.
>   Fix it so that documented and real behaviour match
> - include entry key initialisation fix for proper
>   menu behaviour when running in sandbox (without it
>   the item selection by up/down keys didn't work
>   in sandbox)
> - use puts() instead of printf() where appropriate
> - always use 1 for prompt argument for menu_create()
>   so that the bootmenu command works as documented when 
>   using a negative delay value
> - call bootmenu_destroy() in the case if menu_create() 
>   fails (avoid memory leaks)
> - don't display the title of selected item before
>   running the commands (but do it only if debugging 
>   is enabled)
> - don't change the argument of menu_display_statusline(),
>   use exported menu_default_choice() instead and obtain
>   the needed bootmenu data pointer in the custom
>   menu_display_statusline() function
> - use lower case in menu header 
> - update documentation in readme file for the command
> 
> Changes in v3:
>   - Do not use hardcoded numbers, added MAX_COUNT and MAX_ENV_SIZE
>   - Use unsigned short int for menu number
>   - Use enum bootmenu_key for key selection
>   - Separate loop code from function bootmenu_choice_entry to bootmenu_loop 
> and bootmenu_autoboot_loop
>   - Updated README, added example
>   - Use switches, added braces, fix style problems
> 
> Changes in v2:
>   - Added commit message
>   - Removed bootmenu from include/config_cmd_all.h
>   - Moved ANSI escape codes from include/common.h to include/ansi.h
>   - Fixed style and indentation problems
>   - Use mdelay instead udelay
>   - Removed autoboot delay message when some key is pressed
> 
>  common/Makefile   |1 +
>  common/cmd_bootmenu.c |  517 
> +
>  doc/README.bootmenu   |  115 +++
>  include/ansi.h|   42 
>  4 files changed, 675 insertions(+), 0 deletions(-)
>  create mode 100644 common/cmd_bootmenu.c
>  create mode 100644 doc/README.bootmenu
>  create mode 100644 include/ansi.h


applied to staging/ag...@denx.de. Thanks.

Anatolij
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 2/4] New command bootmenu: ANSI terminal boot menu support

2013-03-28 Thread Anatolij Gustschin
Hi,

On Tue, 26 Mar 2013 16:19:35 +0100
Pali Rohár  wrote:
...
> I tested them on Nokia N900 and in qemu (hw n900). Working fine.

Thanks for testing!

Anatolij
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 2/4] New command bootmenu: ANSI terminal boot menu support

2013-03-26 Thread Pali Rohár
On Monday 25 March 2013 20:29:23 Anatolij Gustschin wrote:
> Hi,
> 
> On Sun, 24 Mar 2013 01:53:08 +0100
> 
> Anatolij Gustschin  wrote:
> > From: Pali Rohár 
> > 
> > The "bootmenu" command uses U-Boot menu interfaces and
> > provides a simple mechanism for creating menus with several
> > boot items.
> 
> Could you please test v4 patches. I've tested them in sandbox
> and on a frame buffer device (cfb_console) and didn't see any
> issues. I'm going to apply these patches in a few days.
> 
> Thanks,
> 
> Anatolij

Hi,

I tested them on Nokia N900 and in qemu (hw n900). Working fine.

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 2/4] New command bootmenu: ANSI terminal boot menu support

2013-03-25 Thread Anatolij Gustschin
Hi,

On Sun, 24 Mar 2013 01:53:08 +0100
Anatolij Gustschin  wrote:

> From: Pali Rohár 
> 
> The "bootmenu" command uses U-Boot menu interfaces and provides
> a simple mechanism for creating menus with several boot items.

Could you please test v4 patches. I've tested them in sandbox and
on a frame buffer device (cfb_console) and didn't see any issues.
I'm going to apply these patches in a few days.

Thanks,

Anatolij
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 2/4] New command bootmenu: ANSI terminal boot menu support

2013-03-23 Thread Anatolij Gustschin
From: Pali Rohár 

The "bootmenu" command uses U-Boot menu interfaces and provides
a simple mechanism for creating menus with several boot items.
When running this command the menu will be assembled as defined
by a set of environment variables which contain a title and
command key-value pairs. The "Up" and "Down" keys are used for
navigation through the items. Current active menu item is
highlighted and can be selected using the "Enter" key.

The command interprets and generates various ANSI escape
sequencies, so for proper menu rendering and item selection
the used terminal should support them.

Signed-off-by: Pali Rohár 
[agust: various fixes and documentation updates]
Signed-off-by: Anatolij Gustschin 
---
Changes in v4:
- coding style fixes
- highlight only the menu entry title, not the whole line
- don't return empty strings in bootmenu_choice_entry()
  to avoid useless searching for menu keys in the menu
  item list. Empty key strings won't be found anyway, so
  for down and up keys just return NULL in this function 
  to indicate that no item selection happened yet
- print error message if invalid bootmenu environment 
  variable without title/command separator found
- if number of menu items is equal to MAX_COUNT, the 
  U-Boot console selection entry won't be generated.
  Fix it so that documented and real behaviour match
- include entry key initialisation fix for proper
  menu behaviour when running in sandbox (without it
  the item selection by up/down keys didn't work
  in sandbox)
- use puts() instead of printf() where appropriate
- always use 1 for prompt argument for menu_create()
  so that the bootmenu command works as documented when 
  using a negative delay value
- call bootmenu_destroy() in the case if menu_create() 
  fails (avoid memory leaks)
- don't display the title of selected item before
  running the commands (but do it only if debugging 
  is enabled)
- don't change the argument of menu_display_statusline(),
  use exported menu_default_choice() instead and obtain
  the needed bootmenu data pointer in the custom
  menu_display_statusline() function
- use lower case in menu header 
- update documentation in readme file for the command

Changes in v3:
  - Do not use hardcoded numbers, added MAX_COUNT and MAX_ENV_SIZE
  - Use unsigned short int for menu number
  - Use enum bootmenu_key for key selection
  - Separate loop code from function bootmenu_choice_entry to bootmenu_loop and 
bootmenu_autoboot_loop
  - Updated README, added example
  - Use switches, added braces, fix style problems

Changes in v2:
  - Added commit message
  - Removed bootmenu from include/config_cmd_all.h
  - Moved ANSI escape codes from include/common.h to include/ansi.h
  - Fixed style and indentation problems
  - Use mdelay instead udelay
  - Removed autoboot delay message when some key is pressed

 common/Makefile   |1 +
 common/cmd_bootmenu.c |  517 +
 doc/README.bootmenu   |  115 +++
 include/ansi.h|   42 
 4 files changed, 675 insertions(+), 0 deletions(-)
 create mode 100644 common/cmd_bootmenu.c
 create mode 100644 doc/README.bootmenu
 create mode 100644 include/ansi.h

diff --git a/common/Makefile b/common/Makefile
index 1abf4ea..f631311 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -75,6 +75,7 @@ COBJS-$(CONFIG_CMD_SOURCE) += cmd_source.o
 COBJS-$(CONFIG_CMD_BDI) += cmd_bdinfo.o
 COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o
 COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o
+COBJS-$(CONFIG_CMD_BOOTMENU) += cmd_bootmenu.o
 COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o
 COBJS-$(CONFIG_CMD_BOOTSTAGE) += cmd_bootstage.o
 COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o
diff --git a/common/cmd_bootmenu.c b/common/cmd_bootmenu.c
new file mode 100644
index 000..a3cbffa
--- /dev/null
+++ b/common/cmd_bootmenu.c
@@ -0,0 +1,517 @@
+/*
+ * (C) Copyright 2011-2013 Pali Rohár 
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* maximum bootmenu entries */
+#define MAX_COUNT  99
+
+/* maximal size of bootmenu env
+ *  9 = strlen("bootmenu_")
+ *  2 = strlen(MAX_COUNT)
+ *  1 = NULL term
+ *