Robert Zieba has uploaded this change for review.

View Change

raiden_debug_spi: Add more informative error message when WP is enabled

Current error messages are not very helpful when attempting to flash a
target that has WP enabled. This change checks for the USB_SPI_DISABLED
error that occurs in this case and gives a more informative error
message.

BUG=b:210645611
TEST=Tested with WP enabled and disable to verify that error message is
displayed properly

Signed-off-by: Robert Zieba <robertzieba@google.com>
Change-Id: Ib1e8383baa9c3ea41ab1079af12e3dc8cdff90ae
---
M raiden_debug_spi.c
1 file changed, 19 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/09/62909/1
diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c
index 3f35552..ea85984 100644
--- a/raiden_debug_spi.c
+++ b/raiden_debug_spi.c
@@ -343,6 +343,7 @@
#include "usb_device.h"

#include <libusb.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -983,6 +984,24 @@
return status;
}

+ /* Check if we received an error from the device, 4 is the size of a
+ packet id and error code. */
+ if (rsp_config.packet_size == 4 &&
+ rsp_config.packet_v2.rsp_start.status_code != USB_SPI_SUCCESS) {
+ status = rsp_config.packet_v2.rsp_start.status_code;
+ switch (status) {
+ case USB_SPI_DISABLED:
+ msg_perr("Raiden: Target SPI bridge is disabled (is WP enabled?)\n");
+ break;
+
+ default:
+ msg_perr("Raiden: Received error 0x%x from device\n", status);
+ break;
+ }
+
+ return status;
+ }
+
msg_perr("Raiden: Packet is not a valid config\n"
" config attempt = %d\n"
" packet id = %u\n"

To view, visit change 62909. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ib1e8383baa9c3ea41ab1079af12e3dc8cdff90ae
Gerrit-Change-Number: 62909
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Zieba <robertzieba@google.com>
Gerrit-MessageType: newchange