* [mtd-utils] nanddump: print ecc.stat info after reading
@ 2013-05-10 8:32 Gupta, Pekon
2013-05-10 19:01 ` Mike Frysinger
0 siblings, 1 reply; 2+ messages in thread
From: Gupta, Pekon @ 2013-05-10 8:32 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
Hi Mike,
One more request..
Shouldn't the following ecc.stat info moved after actual mtd_read() ?
fprintf(stderr, "ECC failed: %d\n", stat1.failed);
fprintf(stderr, "ECC corrected: %d\n", stat1.corrected);
fprintf(stderr, "Number of bad blocks: %d\n", stat1.badblocks);
fprintf(stderr, "Number of bbt blocks: %d\n", stat1.bbtblocks);
Currently this info is printed, before the actual reads happen on
MTD device. I'm not sure if this was intended for some other purpose?
-----------------------------------------------------------------
diff --git a/nanddump.c b/nanddump.c
index be458c6..ac0f299 100644
--- a/nanddump.c
+++ b/nanddump.c
/* Open output file for writing. If file name is "-", write to standard
@@ -476,6 +464,18 @@ int main(int argc, char * const argv[])
write(ofd, oobbuf, mtd.oob_size);
}
+ /* check if we can read ecc stats */
+ if (!noecc && !ioctl(fd, ECCGETSTATS, &stat1)) {
+ eccstats = true;
+ if (!quiet) {
+ fprintf(stderr, "ECC failed: %d\n", stat1.failed);
+ fprintf(stderr, "ECC corrected: %d\n", stat1.corrected);
+ fprintf(stderr, "Number of bad blocks: %d\n", stat1.badblocks);
+ fprintf(stderr, "Number of bbt blocks: %d\n", stat1.bbtblocks);
+ }
+ } else {
+ perror("No ECC status information available");
+ }
/* Close the output file and MTD device, free memory */
close(fd);
close(ofd);
with regards, pekon
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [mtd-utils] nanddump: print ecc.stat info after reading
2013-05-10 8:32 [mtd-utils] nanddump: print ecc.stat info after reading Gupta, Pekon
@ 2013-05-10 19:01 ` Mike Frysinger
0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2013-05-10 19:01 UTC (permalink / raw)
To: Gupta, Pekon; +Cc: linux-mtd
[-- Attachment #1: Type: Text/Plain, Size: 679 bytes --]
On Friday 10 May 2013 04:32:50 Gupta, Pekon wrote:
> One more request..
> Shouldn't the following ecc.stat info moved after actual mtd_read() ?
>
> fprintf(stderr, "ECC failed: %d\n", stat1.failed);
> fprintf(stderr, "ECC corrected: %d\n", stat1.corrected);
> fprintf(stderr, "Number of bad blocks: %d\n", stat1.badblocks);
> fprintf(stderr, "Number of bbt blocks: %d\n", stat1.bbtblocks);
>
> Currently this info is printed, before the actual reads happen on
> MTD device. I'm not sure if this was intended for some other purpose?
i think the idea is that header/device info is shown first before we dump each
page. so all that info should come first.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-10 19:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-10 8:32 [mtd-utils] nanddump: print ecc.stat info after reading Gupta, Pekon
2013-05-10 19:01 ` Mike Frysinger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.