Skip to contentSkip to conversation

cmd_nand: show nand scrub confirmation character

PATCH New Florian Fainelli 2 participants 4 messages Mar 19, 2010 – Mar 23, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---

common/cmd_nand.c +4 -2
index 075a8af..69cc0a8 100644
@@ -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;
#1 lore raw

PATCH 1/1 cmd_nand: show nand scrub confirmation character

Quoted 14 lines · Florian Fainelli

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.

---

common/cmd_nand.c +0 -0
index 075a8af..69cc0a8 100644
@@ -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");

common/cmd_nand.c int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) · line 336

Quoted 10 lines
common/cmd_nand.c +4 -2
 
-			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

#2 lore raw

PATCH 1/1 cmd_nand: show nand scrub confirmation character

Quoted 16 lines · On Friday 19 March 2010 23:02:11 Scott Wood wrote:
Quoted 15 lines · Florian Fainelli

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.

---

common/cmd_nand.c +0 -0
index 075a8af..69cc0a8 100644
@@ -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");

Quoted 13 lines

common/cmd_nand.c

Quoted 9 lines
common/cmd_nand.c +4 -2
-			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 <[email protected]>
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.

---

common/cmd_nand.c +8 -2
index 075a8af..9b0c930 100644
@@ -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;
#3 lore raw

PATCH 1/1 cmd_nand: show nand scrub confirmation character

Quoted 9 lines · Florian Fainelli
Quoted 3 lines · 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 <[email protected]>
Subject: [PATCH] cmd_nand: show nand scrub confirmation character

Applied to u-boot-nand-flash next.

-Scott