at_tools: fix bugs
1 reset buffer before each read 2 increase sleep duration
This commit is contained in:
parent
d66ae5e830
commit
e9c43e11b1
@ -132,12 +132,13 @@ int tty_read_keyword(FILE *fdi, char *output, int len, char *key_word, int soft_
|
||||
time_t start_time = time(NULL);
|
||||
int exitcode = TIMEOUT_WAITING_NEWLINE;
|
||||
while (difftime(time(NULL), start_time) < soft_timeout)
|
||||
{
|
||||
{
|
||||
memset(tmp, 0, LINE_BUF);
|
||||
if (fgets(tmp, LINE_BUF, fdi))
|
||||
{
|
||||
read_flag = 1;
|
||||
dbg_msg("%s", tmp);
|
||||
if (output != NULL)
|
||||
if (output != NULL)
|
||||
msg_len += snprintf(output + msg_len, len - msg_len, "%s", tmp);
|
||||
|
||||
if (strncmp(tmp, "OK", 2) == 0 ||
|
||||
@ -176,7 +177,7 @@ int tty_read_keyword(FILE *fdi, char *output, int len, char *key_word, int soft_
|
||||
}
|
||||
}
|
||||
#endif
|
||||
usleep(1000);
|
||||
usleep(10000);
|
||||
}
|
||||
if (read_flag == 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user