You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error returned by read_raw does not only contain the error itself (in err_type) but also pub discarded: &'err [u8], possibly data that was already read from the peripheral before the error occurred. That data gets silently dropped.
Instead, it may be better to check if the length of discarded is non-zero, and if so, return an Ok result containing that data. In that case, the error needs to be stored somewhere, to be returned in the next call to Read.
The text was updated successfully, but these errors were encountered:
jannic
added a commit
to jannic/rp-hal
that referenced
this issue
May 1, 2024
While working on #781 I noticed a flaw in the error handling of the reader implementation:
The error returned by
read_raw
does not only contain the error itself (inerr_type
) but alsopub discarded: &'err [u8]
, possibly data that was already read from the peripheral before the error occurred. That data gets silently dropped.Instead, it may be better to check if the length of
discarded
is non-zero, and if so, return anOk
result containing that data. In that case, the error needs to be stored somewhere, to be returned in the next call toRead
.The text was updated successfully, but these errors were encountered: