kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/linenoise_probe' into 'master'
console: fix linenoiseProbe never timing out Closes IDFCI-387 See merge request espressif/esp-idf!12012pull/6416/head
commit
9cb3ac94c4
|
@ -935,13 +935,17 @@ int linenoiseProbe(void) {
|
|||
|
||||
/* Try to read response */
|
||||
int timeout_ms = 200;
|
||||
const int retry_ms = 10;
|
||||
size_t read_bytes = 0;
|
||||
while (timeout_ms > 0 && read_bytes < 4) { // response is ESC[0n or ESC[3n
|
||||
usleep(10000);
|
||||
usleep(retry_ms * 1000);
|
||||
timeout_ms -= retry_ms;
|
||||
char c;
|
||||
int cb = read(stdin_fileno, &c, 1);
|
||||
if (cb < 0) {
|
||||
continue;
|
||||
}
|
||||
read_bytes += cb;
|
||||
timeout_ms--;
|
||||
}
|
||||
/* Restore old mode */
|
||||
flags &= ~O_NONBLOCK;
|
||||
|
|
Ładowanie…
Reference in New Issue