Skip to content

Commit

Permalink
D2 : If we get a routineNotCompleteOrServiceInProgress response, disc…
Browse files Browse the repository at this point in the history
…ard it

and keep listening until we get the final response. This is necessary for
requests that return a few routineNotCompleteOrServiceInProgresses before
they complete, such as clearDiagnosticInformation on AW50-42.

Fixes fenugrec#84
  • Loading branch information
aaeegg committed Oct 10, 2023
1 parent d08f1b2 commit 8625561
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions scantool/diag_l2_d2.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,21 @@ static struct diag_msg *dl2p_d2_request(struct diag_l2_conn *d_l2_conn, struct d
return NULL;
}

rv = dl2p_d2_recv(d_l2_conn, 1000, dl2p_d2_request_callback, &rmsg);
if (rv < 0) {
*errval = rv;
return NULL;
}
if (rmsg == NULL) {
*errval = DIAG_ERR_NOMEM;
}
do {
if (rmsg != NULL)
diag_freemsg(rmsg);
rv = dl2p_d2_recv(d_l2_conn, 1000, dl2p_d2_request_callback, &rmsg);
if (rv < 0) {
*errval = rv;
return NULL;
}
if (rmsg == NULL) {
*errval = DIAG_ERR_NOMEM;
return NULL;
}
/* If we got routineNotCompleteOrServiceInProgress, loop until
the final response. */
} while(rmsg->len==3 && rmsg->data[0]==0x7e && rmsg->data[1]==msg->data[0] && rmsg->data[2]==0x23);

return rmsg;
}
Expand Down

0 comments on commit 8625561

Please sign in to comment.