Differentiate ultimate error messages depending on programmer used
With every newly supported programmer the information regarding reboots
on failures becomes more ridiculous. With this patch it is only shown when
the internal programmer module was selected.
Example outputs for external programmers:
1) non-fatal:
[…]
Reading current flash chip contents... done. FAILED at 0x00000000! Expected=0xff, Found=0x28, failed byte count from 0x00000000-0x0001ffff: 0x1fde7
ERASE FAILED!
FAILED!
Uh oh. Erase/write failed. Checking if anything changed.
Good. It seems nothing was changed.
Writing to the flash chip apparently didn't do anything.
Please check the connections (especially those to write protection pins) between
the programmer and the flash chip. If you think the error is caused by flashrom
please report this on IRC at chat.freenode.net (channel #flashrom) or
mail flashrom@flashrom.org, thanks!
2) fatal:
[…]
Verifying flash... FAILED at 0x00000000! Expected=0x0f, Found=0xff, failed byte count from 0x00000000-0x0001ffff: 0x1fde6
Your flash chip is in an unknown state.
Please report this on IRC at chat.freenode.net (channel #flashrom) or
mail flashrom@flashrom.org, thanks!
Corresponding to flashrom svn r1699.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: David Hendricks <dhendrix@google.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
diff --git a/flashrom.c b/flashrom.c
index c298748..b9c0395 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1493,26 +1493,37 @@
return ret;
}
-void nonfatal_help_message(void)
+static void nonfatal_help_message(void)
{
- msg_gerr("Writing to the flash chip apparently didn't do anything.\n"
- "This means we have to add special support for your board, "
- "programmer or flash chip.\n"
- "Please report this on IRC at irc.freenode.net (channel "
- "#flashrom) or\n"
- "mail flashrom@flashrom.org!\n"
- "-------------------------------------------------------------"
- "------------------\n"
- "You may now reboot or simply leave the machine running.\n");
+ msg_gerr("Writing to the flash chip apparently didn't do anything.\n");
+#if CONFIG_INTERNAL == 1
+ if (programmer == PROGRAMMER_INTERNAL)
+ msg_gerr("This means we have to add special support for your board, programmer or flash\n"
+ "chip. Please report this on IRC at chat.freenode.net (channel #flashrom) or\n"
+ "mail flashrom@flashrom.org, thanks!\n"
+ "-------------------------------------------------------------------------------\n"
+ "You may now reboot or simply leave the machine running.\n");
+ else
+#endif
+ msg_gerr("Please check the connections (especially those to write protection pins) between\n"
+ "the programmer and the flash chip. If you think the error is caused by flashrom\n"
+ "please report this on IRC at chat.freenode.net (channel #flashrom) or\n"
+ "mail flashrom@flashrom.org, thanks!\n");
}
-void emergency_help_message(void)
+static void emergency_help_message(void)
{
- msg_gerr("Your flash chip is in an unknown state.\n"
- "Get help on IRC at chat.freenode.net (channel #flashrom) or\n"
- "mail flashrom@flashrom.org with the subject \"FAILED: <your board name>\"!\n"
- "-------------------------------------------------------------------------------\n"
- "DO NOT REBOOT OR POWEROFF!\n");
+ msg_gerr("Your flash chip is in an unknown state.\n");
+#if CONFIG_INTERNAL == 1
+ if (programmer == PROGRAMMER_INTERNAL)
+ msg_gerr("Get help on IRC at chat.freenode.net (channel #flashrom) or\n"
+ "mail flashrom@flashrom.org with the subject \"FAILED: <your board name>\"!\n"
+ "-------------------------------------------------------------------------------\n"
+ "DO NOT REBOOT OR POWEROFF!\n");
+ else
+#endif
+ msg_gerr("Please report this on IRC at chat.freenode.net (channel #flashrom) or\n"
+ "mail flashrom@flashrom.org, thanks!\n");
}
/* The way to go if you want a delimited list of programmers */
@@ -1973,8 +1984,7 @@
"anything changed.\n");
if (!flash->chip->read(flash, newcontents, 0, size)) {
if (!memcmp(oldcontents, newcontents, size)) {
- msg_cinfo("Good. It seems nothing was "
- "changed.\n");
+ msg_cinfo("Good. It seems nothing was changed.\n");
nonfatal_help_message();
ret = 1;
goto out;