<div dir="ltr">Definitely an improvement. One print needs to be re-worked to use <= 80cols when printed to the terminal, but aside from that:<div><br></div><div>Acked-by: David Hendricks <<a href="mailto:dhendrix@google.com">dhendrix@google.com</a>><br>

<div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 6, 2013 at 2:19 PM, Stefan Tauner <span dir="ltr"><<a href="mailto:stefan.tauner@student.tuwien.ac.at" target="_blank">stefan.tauner@student.tuwien.ac.at</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">With every newly supported programmer the information regarding reboots<br>
on failures becomes more ridiculous. With this patch it is only shown when<br>
the internal programmer module was selected.<br>
<br>
Example outputs for external programmers:<br>
1) non-fatal:<br>
[…]<br>
Reading current flash chip contents... done. FAILED at 0x00000000! Expected=0xff, Found=0x28, failed byte count from 0x00000000-0x0001ffff: 0x1fde7<br>
ERASE FAILED!<br>
FAILED!<br>
Uh oh. Erase/write failed. Checking if anything changed.<br>
Good. It seems nothing was changed.<br>
Writing to the flash chip apparently didn't do anything.<br>
Please check the connections (especially those to write protection pins) between<br>
the programmer and the flash chip. If you think the error is caused by flashrom<br>
please report this on IRC at <a href="http://chat.freenode.net" target="_blank">chat.freenode.net</a> (channel #flashrom) or<br>
mail <a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a>, thanks!<br>
<br>
2) fatal:<br>
[…]<br>
Verifying flash... FAILED at 0x00000000! Expected=0x0f, Found=0xff, failed byte count from 0x00000000-0x0001ffff: 0x1fde6<br>
Your flash chip is in an unknown state.<br>
Please report this on IRC at <a href="http://chat.freenode.net" target="_blank">chat.freenode.net</a> (channel #flashrom) or<br>
mail <a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a>, thanks!<br>
<br>
Signed-off-by: Stefan Tauner <<a href="mailto:stefan.tauner@student.tuwien.ac.at">stefan.tauner@student.tuwien.ac.at</a>><br>
---<br>
<br>
Tests with a failing internal programmer or a review/ack would be appreciated :)<br>
<br>
 flashrom.c | 46 ++++++++++++++++++++++++++++------------------<br>
 1 file changed, 28 insertions(+), 18 deletions(-)<br>
<br>
diff --git a/flashrom.c b/flashrom.c<br>
index 43b7b11..2a89a85 100644<br>
--- a/flashrom.c<br>
+++ b/flashrom.c<br>
@@ -1492,26 +1492,37 @@ int erase_and_write_flash(struct flashctx *flash, uint8_t *oldcontents,<br>
        return ret;<br>
 }<br>
<br>
-void nonfatal_help_message(void)<br>
+static void nonfatal_help_message(void)<br>
 {<br>
-       msg_gerr("Writing to the flash chip apparently didn't do anything.\n"<br>
-               "This means we have to add special support for your board, "<br>
-                 "programmer or flash chip.\n"<br>
-               "Please report this on IRC at <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> (channel "<br>
-                 "#flashrom) or\n"<br>
-               "mail <a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a>!\n"<br>
-               "-------------------------------------------------------------"<br>
-                 "------------------\n"<br>
-               "You may now reboot or simply leave the machine running.\n");<br>
+       msg_gerr("Writing to the flash chip apparently didn't do anything.\n");<br>
+#if CONFIG_INTERNAL == 1<br>
+       if (programmer == PROGRAMMER_INTERNAL)<br>
+               msg_gerr("This means we have to add special support for your board, programmer or flash chip.\n"<br>
+                        "Please report this on IRC at <a href="http://chat.freenode.net" target="_blank">chat.freenode.net</a> (channel #flashrom) or\n"<br>
+                        "mail <a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a>, thanks!\n"<br>
+                        "-------------------------------------------------------------------------------\n"<br>
+                        "You may now reboot or simply leave the machine running.\n");<br>
+       else<br>
+#endif<br>
+               msg_gerr("Please check the connections (especially those to write protection pins) between\n"<br>
+                        "the programmer and the flash chip. If you think the error is caused by flashrom\n"<br>
+                        "please report this on IRC at <a href="http://chat.freenode.net" target="_blank">chat.freenode.net</a> (channel #flashrom) or\n"<br>
+                        "mail <a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a>, thanks!\n");<br>
 }<br>
<br>
-void emergency_help_message(void)<br>
+static void emergency_help_message(void)<br>
 {<br>
-       msg_gerr("Your flash chip is in an unknown state.\n"<br>
-               "Get help on IRC at <a href="http://chat.freenode.net" target="_blank">chat.freenode.net</a> (channel #flashrom) or\n"<br>
-               "mail <a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a> with the subject \"FAILED: <your board name>\"!\n"<br>
-               "-------------------------------------------------------------------------------\n"<br>
-               "DO NOT REBOOT OR POWEROFF!\n");<br>
+       msg_gerr("Your flash chip is in an unknown state.\n");<br>
+#if CONFIG_INTERNAL == 1<br>
+       if (programmer == PROGRAMMER_INTERNAL)<br>
+               msg_gerr("Get help on IRC at <a href="http://chat.freenode.net" target="_blank">chat.freenode.net</a> (channel #flashrom) or\n"<br>
+                       "mail <a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a> with the subject \"FAILED: <your board name>\"!\n"<br>
+                       "-------------------------------------------------------------------------------\n"<br>
+                       "DO NOT REBOOT OR POWEROFF!\n");<br>
+       else<br>
+#endif<br>
+               msg_gerr("Please report this on IRC at <a href="http://chat.freenode.net" target="_blank">chat.freenode.net</a> (channel #flashrom) or\n"<br>
+                        "mail <a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a>, thanks!\n");<br>
 }<br>
<br>
 /* The way to go if you want a delimited list of programmers */<br>
@@ -1972,8 +1983,7 @@ int doit(struct flashctx *flash, int force, const char *filename, int read_it,<br>
                                 "anything changed.\n");<br>
                        if (!flash->chip->read(flash, newcontents, 0, size)) {<br>
                                if (!memcmp(oldcontents, newcontents, size)) {<br>
-                                       msg_cinfo("Good. It seems nothing was "<br>
-                                                 "changed.\n");<br>
+                                       msg_cinfo("Good. It seems nothing was changed.\n");<br>
                                        nonfatal_help_message();<br>
                                        ret = 1;<br>
                                        goto out;<br>
<span class="HOEnZb"><font color="#888888">--<br>
Kind regards, Stefan Tauner<br>
<br>
<br>
_______________________________________________<br>
flashrom mailing list<br>
<a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a><br>
<a href="http://www.flashrom.org/mailman/listinfo/flashrom" target="_blank">http://www.flashrom.org/mailman/listinfo/flashrom</a></font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>David Hendricks (dhendrix)<br>

Systems Software Engineer, Google Inc.
</div></div></div>