Hi,

this patch groups register dumps by 8 and removes trailing spaces.

Output then looks like:

LDN 0x04 (Environment controller)
idx 2b 30 60 61 62 63 70 f0  f1 f2 f3 f4 f5 f6
val 00 01 02 90 02 30 00 80  00 00 00 40 00 ff
def 00 00 02 90 02 30 09 00  00 00 00 00 NA NA

instead of (trailing spaces here manually marked with '_')

LDN 0x04 (Environment controller)
idx 2b 30 60 61 62 63 70 f0 f1 f2 f3 f4 f5 f6_
val 00 01 02 90 02 30 00 80 00 00 00 40 00 ff_
def 00 00 02 90 02 30 09 00 00 00 00 00 NA NA_

as the lines get longer the grouping gets increasingly more helpfull.

Greetings,
Frieder
Index: superiotool.c
===================================================================
--- superiotool.c	(Revision 2953)
+++ superiotool.c	(Arbeitskopie)
@@ -82,9 +82,9 @@
 	const int *idx;
 
 	if (reg_table[i].ldn[j].ldn != NOLDN) {
-		printf("LDN 0x%02x ", reg_table[i].ldn[j].ldn);
+		printf("LDN 0x%02x", reg_table[i].ldn[j].ldn);
 		if (reg_table[i].ldn[j].name != NULL)
-			printf("(%s)", reg_table[i].ldn[j].name);
+			printf(" (%s)", reg_table[i].ldn[j].name);
 		regwrite(port, 0x07, reg_table[i].ldn[j].ldn);
 	} else {
 		printf("Register dump:");
@@ -92,33 +92,33 @@
 
 	idx = reg_table[i].ldn[j].idx;
 
-	printf("\nidx ");
-	for (k = 0; /* Nothing */; k++) {
-		if (idx[k] == EOT)
-			break;
-		printf("%02x ", idx[k]);
+	printf("\nidx");
+	for (k = 0; idx[k] != EOT; k++) {
+		if (k && !(k % 8))
+			putchar(' ');
+		printf(" %02x", idx[k]);
 	}
 
-	printf("\nval ");
-	for (k = 0; /* Nothing */; k++) {
-		if (idx[k] == EOT)
-			break;
-		printf("%02x ", regval(port, idx[k]));
+	printf("\nval");
+	for (k = 0; idx[k] != EOT; k++) {
+		if (k && !(k % 8))
+			putchar(' ');
+		printf(" %02x", regval(port, idx[k]));
 	}
 
-	printf("\ndef ");
+	printf("\ndef");
 	idx = reg_table[i].ldn[j].def;
-	for (k = 0; /* Nothing */; k++) {
-		if (idx[k] == EOT)
-			break;
-		else if (idx[k] == NANA)
-			printf("NA ");
+	for (k = 0; idx[k] != EOT; k++) {
+		if (k && !(k % 8))
+			putchar(' ');
+		if (idx[k] == NANA)
+			printf(" NA");
 		else if (idx[k] == RSVD)
-			printf("RR ");
+			printf(" RR");
 		else if (idx[k] == MISC)	/* TODO */
-			printf("MM ");
+			printf(" MM");
 		else
-			printf("%02x ", idx[k]);
+			printf(" %02x", idx[k]);
 	}
 	printf("\n");
 }
-- 
linuxbios mailing list
linuxbios@linuxbios.org
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to