diff options
-rw-r--r-- | fw-update.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fw-update.c b/fw-update.c index 70f5e10..72695b0 100644 --- a/fw-update.c +++ b/fw-update.c @@ -201,7 +201,7 @@ bool fw_update(int fd, uint8_t device_index, uint8_t *fw, size_t fw_len) { #define DFU_WRITE(_msg) \ do { \ r = hidpp10_request(fd, &_msg, NULL, NULL); \ - RETURN_IF_FAIL(r == 0, "Write E2 failed, r=%#04x", r); \ + PRWARN_IF_FAIL(r == 0, "Write E2 failed, r=%#04x", r); \ } while (0) HidppMessage dfu_req; @@ -239,7 +239,13 @@ bool fw_update(int fd, uint8_t device_index, uint8_t *fw, size_t fw_len) { // [ix 82 E2] send firmware (+check toggle) dfu_req = DFU_INIT(action); memcpy(&dfu_req.params_l[1], fw + fw_pos, 15); - DFU_WRITE(dfu_req); + r = hidpp10_request(fd, &dfu_req, NULL, NULL); + if (r != 0) { + /* the official updater does 4 attempts (3 retries), this is + * simpler. */ + warnx("Device does not respond! Aborting"); + break; + } /* verify response */ int code = dfu_req.params[0]; |