diff loadtools/flmain.c @ 508:211be4dc6be2

new flash geom command made a little nicer
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 28 May 2019 07:20:14 +0000
parents 0dd2c87c1b63
children 815c3f8bcff1
line wrap: on
line diff
--- a/loadtools/flmain.c	Tue May 28 05:34:45 2019 +0000
+++ b/loadtools/flmain.c	Tue May 28 07:20:14 2019 +0000
@@ -18,6 +18,7 @@
 	char **argv;
 {
 	struct flash_bank_info *bi;
+	unsigned rn;
 
 	if (argc > 2) {
 		fprintf(stderr, "error: too many arguments\n");
@@ -26,14 +27,19 @@
 	if (flash_detect(bank, 0) < 0)
 		return(-1);
 	bi = flash_bank_info + bank;
+	printf("Detected flash device: %s\n", bi->device->name);
 	if (bi->device->bank_geom[1])
 		printf("Device has two banks, looking at bank %d\n", bank);
 	else
 		printf("Single-bank flash device\n");
-	printf("Bank %d total size: %lx\n", bank,
+	printf("Bank %d total size: 0x%lx\n", bank,
 		(u_long) bi->geom->total_size);
 	printf("Sectors in bank %d: %u (%u regions)\n", bank,
 		bi->geom->total_sectors, bi->geom->nregions);
+	for (rn = 0; rn < bi->geom->nregions; rn++)
+		printf("Region %u: %u sectors of 0x%lx bytes\n", rn,
+			bi->geom->regions[rn].nsectors,
+			(u_long) bi->geom->regions[rn].sector_size);
 	printf("Command set style: %s\n", bi->ops->cmdset_name);
 	return(0);
 }