modem: ubx: fix incoming byte processing
`ret` holds the amount of bytes received from the modem. However during processing of the bytes its value is overwritten by the return value of `modem_ubx_process_received_byte`, in practice discarding all but the first byte read. To prevent this, store the length in a separate variable. Signed-off-by: Anders T. Akre <anders@akre.io>
This commit is contained in:
parent
93c9da6694
commit
26cd98e483
1 changed files with 3 additions and 1 deletions
|
|
@ -269,7 +269,9 @@ static void modem_ubx_process_handler(struct k_work *item)
|
|||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ret; i++) {
|
||||
const size_t length = ret;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
ret = modem_ubx_process_received_byte(ubx, ubx->receive_buf[i]);
|
||||
if (ret == 0) { /* Frame matched successfully. Terminate the script. */
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue