-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve UART VFS support for binary streams (IDFGH-13218) #14155
Comments
Thanks for raising this issue! Incidentally, we got another bug report about UART VFS reading behavior, and after fixing that other issue, early return on a newline character can actually be removed, fixing your issue as well. We'll update this ticket once the fix is merged. |
@igrr I stumbled over the issue @AguileraG described here. Do you have any idea whether this is going to be resolved any time soon? Thanks in advance! |
- For blocking mode, block until data available - Return with the bytes available in the file at the time, it should not block until reaching the requested size And read() should not realy return on the newline character Closes #14155
- For blocking mode, block until data available - Return with the bytes available in the file at the time, it should not block until reaching the requested size And read() should not realy return on the newline character Closes #14155
- For blocking mode, block until data available - Return with the bytes available in the file at the time, it should not block until reaching the requested size And read() should not realy return on the newline character Closes #14155
Is your feature request related to a problem?
Both
uart_read()
anduart_write()
treat end-of-line characters as special characters. Most of this specific behaviour can be disabled by configuring the VFS driver with theESP_LINE_ENDINGS_LF
line ending mode.However,
uart_read()
always stops reading data when a'\n'
character is received, even though more bytes may be available on the RX buffer (see line 285).This behaviour cannot be disabled in any way, and it makes it more difficult to work with binary protocols which treat
'\n'
as a regular byte.Describe the solution you'd like.
I would like for the UART VFS driver to be configurable so that all incoming characters are treated as regular bytes, so that when
uart_read()
is called, all data available in the RX buffer is read.Describe alternatives you've considered.
Right now, this issue can be worked around by calling
read()
and thereforeuart_read()
in a loop until the expected number of bytes is received.However, this approach makes it more difficult to perform non-blocking reads with
select()
orpoll()
, as the application must keep track of how long each call toread()
takes.Additional context.
No response
The text was updated successfully, but these errors were encountered: