summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2016-11-25 12:44:06 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-11-28 20:53:53 -0800
commit56310c97bf25220c9124b97f3920ec74e67a213f (patch)
tree72298b8a196875111a7116fa19ec0442ed9b4ed3
parent6eae52a0944136f4745770be0233dc1bef6cd2a1 (diff)
downloadchrome-ec-56310c97bf25220c9124b97f3920ec74e67a213f.tar.gz
usb_updater: improve debugability
When usb update errors happen it helps a lot to be able to see the actual error code returned by the target and where the error was generated. This patch adds a few printouts to help with debugging. BRANCH=none BUG=none TEST=observed proper error messages generated while debugging introduction of extension/vendor commands transfer over USB. Change-Id: I06c77e7467f7f9547704c88c4b673866fb2e6032 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/414947 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--chip/g/upgrade_fw.c1
-rw-r--r--chip/g/usb_upgrade.c2
-rw-r--r--extra/usb_updater/usb_updater.c9
3 files changed, 11 insertions, 1 deletions
diff --git a/chip/g/upgrade_fw.c b/chip/g/upgrade_fw.c
index f77d4145e8..d5be0f4491 100644
--- a/chip/g/upgrade_fw.c
+++ b/chip/g/upgrade_fw.c
@@ -214,6 +214,7 @@ void fw_upgrade_command_handler(void *body,
*/
if (!valid_sections.ro_top_offset ||
!valid_sections.rw_top_offset) {
+ CPRINTF("%s:%d\n", __func__, __LINE__);
rpdu->return_value = htobe32(UPGRADE_GEN_ERROR);
return;
}
diff --git a/chip/g/usb_upgrade.c b/chip/g/usb_upgrade.c
index 3800c529c5..d709f1f49b 100644
--- a/chip/g/usb_upgrade.c
+++ b/chip/g/usb_upgrade.c
@@ -162,6 +162,7 @@ static void upgrade_out_handler(struct consumer const *consumer, size_t count)
* a single byte error code.
*/
resp_value = UPGRADE_GEN_ERROR;
+ CPRINTS("%s:%d", __FILE__, __LINE__);
QUEUE_ADD_UNITS(&upgrade_to_usb, &resp_value, 1);
return;
}
@@ -228,6 +229,7 @@ static void upgrade_out_handler(struct consumer const *consumer, size_t count)
* gotten out of sync with the host.
*/
resp_value = UPGRADE_GEN_ERROR;
+ CPRINTS("%s:%d", __FILE__, __LINE__);
QUEUE_ADD_UNITS(&upgrade_to_usb, &resp_value, 1);
return;
}
diff --git a/extra/usb_updater/usb_updater.c b/extra/usb_updater/usb_updater.c
index 67a5aec366..a1248c58f1 100644
--- a/extra/usb_updater/usb_updater.c
+++ b/extra/usb_updater/usb_updater.c
@@ -878,8 +878,15 @@ static void setup_connection(struct transfer_descriptor *td)
if (rxed_size <= 4) {
if (td->ep_type != spi_xfer) {
- fprintf(stderr, "Unexpected response size %zd\n",
+ size_t i;
+
+ fprintf(stderr, "Unexpected response size %zd: ",
rxed_size);
+
+ for (i = 0; i < rxed_size; i++)
+ fprintf(stderr, " %02x",
+ ((uint8_t *)&start_resp)[i]);
+ fprintf(stderr, "\n");
exit(update_error);
}