|
| 1 | +--- a/src/cli/cli_opts.c |
| 2 | ++++ b/src/cli/cli_opts.c |
| 3 | +@@ -543,7 +543,7 @@ int parse_cli_options(int argc, char *co |
| 4 | + copts->argv = argv; |
| 5 | + opterr = 0; |
| 6 | + copts->prgname = argv[0]; |
| 7 | +- copts->timeout = 3; |
| 8 | ++ copts->timeout = 1; |
| 9 | + |
| 10 | + return parse_mcumgr_options(copts); |
| 11 | + } |
| 12 | +--- a/src/mcumgr-client/commands/cmd_common.c |
| 13 | ++++ b/src/mcumgr-client/commands/cmd_common.c |
| 14 | +@@ -19,6 +19,9 @@ int cmd_run(struct smp_transport *transp |
| 15 | + rc = transport->ops->write(transport, buf, reqsz); |
| 16 | + |
| 17 | + /* TODO: try reconnecting ?*/ |
| 18 | ++ if (rc == -ETIMEDOUT) { |
| 19 | ++ continue; |
| 20 | ++ } |
| 21 | + if (rc < 0) { |
| 22 | + return rc; |
| 23 | + } |
| 24 | +--- a/src/mcumgr-client/transport/serial/smp_serial.c |
| 25 | ++++ b/src/mcumgr-client/transport/serial/smp_serial.c |
| 26 | +@@ -362,7 +362,7 @@ static int serial_transport_read(struct |
| 27 | + DBG("Read: maxlen: %zu\n", maxlen); |
| 28 | + |
| 29 | + now = time_get(); |
| 30 | +- end_time = now + tmo + 2; |
| 31 | ++ end_time = now + tmo; |
| 32 | + |
| 33 | + while (1) { |
| 34 | + /* read no more than buffers allow, and never more than one frame data |
| 35 | +--- a/src/cli/main.c |
| 36 | ++++ b/src/cli/main.c |
| 37 | +@@ -403,6 +403,7 @@ main(int argc, char **argv) |
| 38 | + } |
| 39 | + transport.verbose = copts.verbose; |
| 40 | + transport.timeout = copts.timeout; |
| 41 | ++ transport.retries = copts.retries; |
| 42 | + } |
| 43 | + |
| 44 | + if (copts.subcmd != CMD_IMAGE_INFO) { |
| 45 | +--- a/src/mcumgr-client/commands/cmd_img.c |
| 46 | ++++ b/src/mcumgr-client/commands/cmd_img.c |
| 47 | +@@ -238,6 +238,7 @@ int cmd_img_run_image_upload(struct smp_ |
| 48 | + fprintf(stderr, "Upload continue\n"); |
| 49 | + } |
| 50 | + |
| 51 | ++ int errors = 0; |
| 52 | + while (state.offs < req->image.file_sz) { |
| 53 | + |
| 54 | + size_t seglen; |
| 55 | +@@ -295,6 +296,12 @@ int cmd_img_run_image_upload(struct smp_ |
| 56 | + } |
| 57 | + |
| 58 | + if (state.offs <= old_off) { |
| 59 | ++ errors ++; |
| 60 | ++ } else { |
| 61 | ++ errors = 0; |
| 62 | ++ } |
| 63 | ++ |
| 64 | ++ if (state.offs <= old_off && errors >= 10) { |
| 65 | + fprintf(stderr, "FW upload stall\n"); |
| 66 | + return -EPROTO; |
| 67 | + } |
0 commit comments