* [U-Boot] [PATCH] cmd_nand: show nand scrub confirmation character
@ 2010-03-19 15:06 Florian Fainelli
2010-03-19 22:02 ` Scott Wood
0 siblings, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2010-03-19 15:06 UTC (permalink / raw)
To: u-boot
When issuing a nand scrub command, the entered character is not displayed
this may be confusing. This patch makes the input character being displayed
if it is a 'y' so that an user knows he is about to scrub his nand.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 075a8af..69cc0a8 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -327,8 +327,10 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
"are sure of what you are doing!\n"
"\nReally scrub this NAND flash? <y/N>\n");
- if (getc() == 'y' && getc() == '\r') {
- opts.scrub = 1;
+ if (getc() == 'y') {
+ puts("y");
+ if (getc() == '\r')
+ opts.scrub = 1;
} else {
puts("scrub aborted\n");
return -1;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] cmd_nand: show nand scrub confirmation character
2010-03-19 15:06 [U-Boot] [PATCH] cmd_nand: show nand scrub confirmation character Florian Fainelli
@ 2010-03-19 22:02 ` Scott Wood
2010-03-20 18:02 ` Florian Fainelli
0 siblings, 1 reply; 4+ messages in thread
From: Scott Wood @ 2010-03-19 22:02 UTC (permalink / raw)
To: u-boot
On Fri, Mar 19, 2010 at 04:06:16PM +0100, Florian Fainelli wrote:
> When issuing a nand scrub command, the entered character is not displayed
> this may be confusing. This patch makes the input character being displayed
> if it is a 'y' so that an user knows he is about to scrub his nand.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> diff --git a/common/cmd_nand.c b/common/cmd_nand.c
> index 075a8af..69cc0a8 100644
> --- a/common/cmd_nand.c
> +++ b/common/cmd_nand.c
> @@ -327,8 +327,10 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
> "are sure of what you are doing!\n"
> "\nReally scrub this NAND flash? <y/N>\n");
>
> - if (getc() == 'y' && getc() == '\r') {
> - opts.scrub = 1;
> + if (getc() == 'y') {
> + puts("y");
> + if (getc() == '\r')
> + opts.scrub = 1;
> } else {
> puts("scrub aborted\n");
> return -1;
>
You're changing the behavior in case the user presses y and then does
something other than hit return. You won't set scrub = 1, but you'll
continue with the erase rather than printing "scrub aborted" and returning.
-Scott
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] cmd_nand: show nand scrub confirmation character
2010-03-19 22:02 ` Scott Wood
@ 2010-03-20 18:02 ` Florian Fainelli
2010-03-23 19:31 ` Scott Wood
0 siblings, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2010-03-20 18:02 UTC (permalink / raw)
To: u-boot
On Friday 19 March 2010 23:02:11 Scott Wood wrote:
> On Fri, Mar 19, 2010 at 04:06:16PM +0100, Florian Fainelli wrote:
> > When issuing a nand scrub command, the entered character is not displayed
> > this may be confusing. This patch makes the input character being
> > displayed if it is a 'y' so that an user knows he is about to scrub his
> > nand.
> >
> > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> > ---
> > diff --git a/common/cmd_nand.c b/common/cmd_nand.c
> > index 075a8af..69cc0a8 100644
> > --- a/common/cmd_nand.c
> > +++ b/common/cmd_nand.c
> > @@ -327,8 +327,10 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc,
> > char *argv[]) "are sure of what you are doing!\n"
> > "\nReally scrub this NAND flash? <y/N>\n");
> >
> > - if (getc() == 'y' && getc() == '\r') {
> > - opts.scrub = 1;
> > + if (getc() == 'y') {
> > + puts("y");
> > + if (getc() == '\r')
> > + opts.scrub = 1;
> > } else {
> > puts("scrub aborted\n");
> > return -1;
>
> You're changing the behavior in case the user presses y and then does
> something other than hit return. You won't set scrub = 1, but you'll
> continue with the erase rather than printing "scrub aborted" and returning.
That's correct, what about this:
--
From: Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH] cmd_nand: show nand scrub confirmation character
When issuing a nand scrub command, the entered character is not displayed
this may be confusing. This patch makes the input character being
displayed if it is a 'y' so that an user knows he is about to scrub his
nand.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 075a8af..9b0c930 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -327,8 +327,14 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
"are sure of what you are doing!\n"
"\nReally scrub this NAND flash? <y/N>\n");
- if (getc() == 'y' && getc() == '\r') {
- opts.scrub = 1;
+ if (getc() == 'y') {
+ puts("y");
+ if (getc() == '\r')
+ opts.scrub = 1;
+ else {
+ puts("scrub aborted\n");
+ return -1;
+ }
} else {
puts("scrub aborted\n");
return -1;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] cmd_nand: show nand scrub confirmation character
2010-03-20 18:02 ` Florian Fainelli
@ 2010-03-23 19:31 ` Scott Wood
0 siblings, 0 replies; 4+ messages in thread
From: Scott Wood @ 2010-03-23 19:31 UTC (permalink / raw)
To: u-boot
On Sat, Mar 20, 2010 at 07:02:58PM +0100, Florian Fainelli wrote:
> On Friday 19 March 2010 23:02:11 Scott Wood wrote:
> > You're changing the behavior in case the user presses y and then does
> > something other than hit return. You won't set scrub = 1, but you'll
> > continue with the erase rather than printing "scrub aborted" and returning.
>
> That's correct, what about this:
> --
> From: Florian Fainelli <f.fainelli@gmail.com>
> Subject: [PATCH] cmd_nand: show nand scrub confirmation character
Applied to u-boot-nand-flash next.
-Scott
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-03-23 19:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-19 15:06 [U-Boot] [PATCH] cmd_nand: show nand scrub confirmation character Florian Fainelli
2010-03-19 22:02 ` Scott Wood
2010-03-20 18:02 ` Florian Fainelli
2010-03-23 19:31 ` Scott Wood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox