mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] Add Menu Framework
Date: Thu, 19 Aug 2010 10:29:22 +0200	[thread overview]
Message-ID: <20100819082922.GE27749@pengutronix.de> (raw)
In-Reply-To: <1282190002-6807-1-git-send-email-plagnioj@jcrosoft.com>

On Thu, Aug 19, 2010 at 05:53:22AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Introduce a menu framework that allow us to create list menu to simplify
> barebox and make it more user-frendly
> 
> This kind of menu is very usefull when you do not have a keyboard or a
> serial console attached to your board to allow you to interract with
> barebox

\o/ Cool! I really like it.

This is simple and still very flexible.

Some things which came up during testing:

- I get a data abort when trying to remove a menu without removing the
  entries first. example:

barebox@Phytec phyCORE-i.MX31:/ menu -a -m boot -d "Boot Menu"
barebox@Phytec phyCORE-i.MX31:/ menu -e -a -m boot -c boot -d "Boot"
barebox@Phytec phyCORE-i.MX31:/ menu -r -m boot
data abort
pc : [<87f05058>]    lr : [<87f05098>]
sp : 87affe20  ip : 87f20794  fp : 00000004
r10: 00000002  r9 : 00000000  r8 : 00200200
r7 : 00100100  r6 : 87b0daf8  r5 : 87b0db18  r4 : 001000f0
r3 : 87b0db18  r2 : 87b0db18  r1 : 003b7fff  r0 : 001000f0
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

- do_menu could use a if (!argc) return COMMAND_ERROR_USAGE;

- It would be nice to have an option to directly create a submenu on the
  command line (though this can be added later). So instead of doing

menu -e -a -m boot -c "menu -s -m network" -R -d "Network settings ->"

we could have a

menu -e -a -m boot -u network -R -d "Network settings ->"

We could than automatically add a 'back' entry if a menu is a submenu.

- It shouldn't be possible to add the same menu twice. example:

barebox@Phytec phyCORE-i.MX31:/ menu -a -m boot -d "Boot Menu"
barebox@Phytec phyCORE-i.MX31:/ menu -a -m boot -d "Boot Menu"
barebox@Phytec phyCORE-i.MX31:/ menu -l
boot: Boot Menu
boot: Boot Menu
barebox@Phytec phyCORE-i.MX31:/

- Removing entries does not work as expected. example:

menu -a -m boot -d "Boot Menu"
menu -e -a -m boot -c boot -d "Boot"
menu -e -a -m boot -c reset -d "Reset"
menu -e -a -m boot -c "exit" -d "Command line"
menu -e -r -m boot -n 1
menu -s -m boot

As expected the first entry is missing, but instead an empty line is
printed. When I then try to add an entry after this the menu is corrupt.

- commands should always return positive error codes. A good practice is
  to pass -E* values up to do_menu, use strerror() to print the error
  code and return 1 afterwards.

> +		switch(opt) {
> +		case 'm':
> +			cm.menu = optarg;
> +			break;
> +			break;
> +		case 'l':
> +			cm.action = action_list;
> +			break;
> +		case 's':
> +			cm.action = action_show;
> +			break;
> +#if defined(CONFIG_CMD_MENU_MANAGEMENT)
> +		case 'e':
> +			cm.entry = 1;
> +		case 'a':

There is a 'break' missing here.

> +			cm.action = action_add;
> +			break;
> +		case 'r':
> +			cm.action = action_remove;
> +			break;
> +		case 'c':
> +			cm.command = optarg;
> +			break;

Thank you for this work. I really appreciate it ;)

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

  reply	other threads:[~2010-08-19  8:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-19  3:53 Jean-Christophe PLAGNIOL-VILLARD
2010-08-19  8:29 ` Sascha Hauer [this message]
2010-08-20  3:21   ` Jean-Christophe PLAGNIOL-VILLARD
2010-08-20  6:38     ` Sascha Hauer
2010-08-20  6:51       ` Jean-Christophe PLAGNIOL-VILLARD
2010-08-20  7:09         ` Robert Schwebel
2010-08-20  8:18           ` Jean-Christophe PLAGNIOL-VILLARD
2010-08-20  8:22 ` [PATCH 1/2 v2] " Jean-Christophe PLAGNIOL-VILLARD
2010-08-20  8:22 ` [PATCH 2/2] Menu/cmd: add sub menu entry command support 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=20100819082922.GE27749@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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