diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2018-03-06 16:48:36 +0100 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-03-06 14:38:53 -0800 |
commit | 258b9b1ebe223a87d2a8159db5d5720b30ea014e (patch) | |
tree | a07a17c0705d8bed89ec5373df1876c022cc649d | |
parent | 7f4018c41f875c7fbdff03ee4a489753d541b0a9 (diff) | |
download | chrome-ec-258b9b1ebe223a87d2a8159db5d5720b30ea014e.tar.gz |
ectool: fix error codes for servo v2 spi support
When the EC sends back an error code inside the 'result' field of the v3
protocol, the transport is supposed to return -EECRESULT-error_code.
Fix the the servo spi transport to do so.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=b:72360575
TEST=with ZerbleBarn connected to a Servo v2, run 'ectool_servo fpinfo'
and 'ectool_servo fptemplate badfile.bin'
Change-Id: I54eec9194cfefd422078344500685736aadaffcf
Reviewed-on: https://chromium-review.googlesource.com/951682
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | util/comm-servo-spi.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/util/comm-servo-spi.c b/util/comm-servo-spi.c index 6d9d095be4..4010d2ec64 100644 --- a/util/comm-servo-spi.c +++ b/util/comm-servo-spi.c @@ -236,7 +236,7 @@ static int get_response(uint8_t *bodydest, size_t bodylen) return -EC_RES_ERROR; } - return 0; + return hdr.result ? -EECRESULT - hdr.result : 0; read_error: fprintf(stderr, "Read failed: %s\n", ftdi_get_error_string(&ftdi)); @@ -256,9 +256,8 @@ static int ec_command_servo_spi(int cmd, int version, return -EC_RES_ERROR; } - if (send_request(cmd, version, outdata, outsize) == 0 && - get_response(indata, insize) == 0) - ret = 0; + if (send_request(cmd, version, outdata, outsize) == 0) + ret = get_response(indata, insize); if (mpsse_set_pins(CS_L) != 0) { fprintf(stderr, "Stop failed: %s\n", |