[flashrom] [PATCH 4/4] add printing of chip voltage ranges to print_wiki.c

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Sat Jun 4 09:32:19 CEST 2011


- add voltage ranges
- center some headers (test values OK, No, ? are centered via wiki templates)
- fix style error in header (align:right -> text-align:right)

Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
---
 print_wiki.c |   46 ++++++++++++++++++++++++++++++++--------------
 1 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/print_wiki.c b/print_wiki.c
index 0fcc32a..6601bd7 100644
--- a/print_wiki.c
+++ b/print_wiki.c
@@ -29,7 +29,8 @@
 
 static const char wiki_header[] = "= Supported devices =\n\n\
 <div style=\"margin-top:0.5em; padding:0.5em 0.5em 0.5em 0.5em; \
-background-color:#eeeeee; align:right; border:1px solid #aabbcc;\"><small>\n\
+background-color:#eeeeee; text-align:right; border:1px solid #aabbcc;\">\
+<small>\n\
 Please do '''not''' edit these tables in the wiki directly, they are \
 generated by pasting '''flashrom -z''' output.<br />\
 '''Last update:''' %s(generated by flashrom %s)\n</small></div>\n";
@@ -37,12 +38,13 @@ generated by pasting '''flashrom -z''' output.<br />\
 #if CONFIG_INTERNAL == 1
 static const char chipset_th[] = "{| border=\"0\" style=\"font-size: smaller\"\n\
 |- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
-! align=\"left\" | Southbridge\n! align=\"left\" | PCI IDs\n\
-! align=\"left\" | Status\n\n";
+! align=\"left\" | Southbridge\n! align=\"center\" | PCI IDs\n\
+! align=\"center\" | Status\n\n";
 
 static const char board_th[] = "{| border=\"0\" style=\"font-size: smaller\" \
 valign=\"top\"\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
-! align=\"left\" | Mainboard\n! align=\"left\" | Required option\n! align=\"left\" | Status\n\n";
+! align=\"left\" | Mainboard\n! align=\"left\" | Required option\n\
+! align=\"center\" | Status\n\n";
 
 static const char board_intro[] = "\
 \n== Supported mainboards ==\n\n\
@@ -57,20 +59,26 @@ know, someone has to give it a try). Please report any further verified \
 mainboards on the [[Mailinglist|mailing list]].\n";
 #endif
 
-static const char chip_th[] = "{| border=\"0\" style=\"font-size: smaller\" \
-valign=\"top\"\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
-! align=\"left\" | Device\n! align=\"left\" | Size / kB\n\
-! align=\"left\" | Type\n! align=\"left\" colspan=\"4\" | Status\n\n\
+static const char chip_th[] = "{\
+| border=\"0\" style=\"font-size: smaller\"valign=\"top\"\n\
+|- bgcolor=\"#6699dd\"\n\
+! align=\"left\" | Vendor\n\
+! align=\"left\" | Device\n\
+! align=\"center\" | Size [kB]\n\
+! align=\"center\" | Type\n\
+! align=\"center\" colspan=\"4\" | Status\n\
+! align=\"center\" colspan=\"2\" | Voltage [V]\n\n\
 |- bgcolor=\"#6699ff\"\n| colspan=\"4\" |  \n\
-| Probe\n| Read\n| Erase\n| Write\n\n";
+| Probe\n| Read\n| Erase\n| Write\n\
+| align=\"center\" | min \n| align=\"center\" | max\n\n";
 
 static const char programmer_section[] = "\
 \n== Supported programmers ==\n\nThis is a list \
 of supported PCI devices flashrom can use as programmer:\n\n{| border=\"0\" \
 valign=\"top\"\n| valign=\"top\"|\n\n{| border=\"0\" style=\"font-size: \
 smaller\" valign=\"top\"\n|- bgcolor=\"#6699dd\"\n! align=\"left\" | Vendor\n\
-! align=\"left\" | Device\n! align=\"left\" | PCI IDs\n\
-! align=\"left\" | Status\n\n";
+! align=\"left\" | Device\n! align=\"center\" | PCI IDs\n\
+! align=\"center\" | Status\n\n";
 
 #if CONFIG_INTERNAL == 1
 static const char laptop_intro[] = "\n== Supported laptops/notebooks ==\n\n\
@@ -204,6 +212,9 @@ static void print_supported_chips_wiki(int cols)
 	const struct flashchip *f, *old = NULL;
 	uint32_t t;
 	char *tmp_bus_str;
+	char tmp_max_str[6];
+	char tmp_min_str[6];
+	const char *na = "N/A";
 
 	for (f = flashchips; f->name != NULL; f++)
 		chipcount++;
@@ -223,8 +234,13 @@ static void print_supported_chips_wiki(int cols)
 
 		t = f->tested;
 		tmp_bus_str = flashbuses_to_text(f->bustype);
-		printf("|- bgcolor=\"#%s\"\n| %s || %s || %d "
-		       "|| %s || {{%s}} || {{%s}} || {{%s}} || {{%s}}\n",
+		sprintf(tmp_min_str, "%0.03f", f->voltage.min/(double)1000);
+		sprintf(tmp_max_str, "%0.03f", f->voltage.max/(double)1000);
+		/* '{{%s}}' is used in combination with 'OK', 'No' and '?3' to
+		 * select special formatting templates for the bg color. */
+		printf("|- bgcolor=\"#%s\"\n| %s || %s || align=\"right\" | %d "
+		       "|| %s || {{%s}} || {{%s}} || {{%s}} || {{%s}}"
+		       "|| %s || %s \n",
 		       (c == 1) ? "eeeeee" : "dddddd", f->vendor, f->name,
 		       f->total_size, tmp_bus_str,
 		       (t & TEST_OK_PROBE) ? "OK" :
@@ -234,7 +250,9 @@ static void print_supported_chips_wiki(int cols)
 		       (t & TEST_OK_ERASE) ? "OK" :
 		       (t & TEST_BAD_ERASE) ? "No" : "?3",
 		       (t & TEST_OK_WRITE) ? "OK" :
-		       (t & TEST_BAD_WRITE) ? "No" : "?3");
+		       (t & TEST_BAD_WRITE) ? "No" : "?3",
+		       f->voltage.min ? tmp_min_str : na,
+		       f->voltage.min ? tmp_max_str : na);
 		free(tmp_bus_str);
 
 		/* Split table into 'cols' columns. */
-- 
1.7.1





More information about the flashrom mailing list