Author: stefanct
Date: Mon Jul 15 12:47:53 2013
New Revision: 1699
URL: http://flashrom.org/trac/flashrom/changeset/1699

Log:
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 [email protected], 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 [email protected], thanks!

Signed-off-by: Stefan Tauner <[email protected]>
Acked-by: David Hendricks <[email protected]>
Acked-by: Carl-Daniel Hailfinger <[email protected]>

Modified:
   trunk/flashrom.c

Modified: trunk/flashrom.c
==============================================================================
--- trunk/flashrom.c    Sun Jul 14 01:31:37 2013        (r1698)
+++ trunk/flashrom.c    Mon Jul 15 12:47:53 2013        (r1699)
@@ -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 [email protected]!\n"
-               "-------------------------------------------------------------"
-                 "------------------\n"
-               "You may now reboot or simply leave the machine running.\n");
-}
-
-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 [email protected] with the subject \"FAILED: <your 
board name>\"!\n"
-               
"-------------------------------------------------------------------------------\n"
-               "DO NOT REBOOT OR POWEROFF!\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 [email protected], 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 [email protected], thanks!\n");
+}
+
+static void emergency_help_message(void)
+{
+       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 [email protected] 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 [email protected], 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;

_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to