Skip to content
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

Closed
AguileraG opened this issue Jul 9, 2024 · 2 comments
Closed

Improve UART VFS support for binary streams (IDFGH-13218) #14155

AguileraG opened this issue Jul 9, 2024 · 2 comments
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Feature Request Feature request for IDF

Comments

@AguileraG
Copy link

Is your feature request related to a problem?

Both uart_read() and uart_write() treat end-of-line characters as special characters. Most of this specific behaviour can be disabled by configuring the VFS driver with the ESP_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 therefore uart_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() or poll(), as the application must keep track of how long each call to read() takes.

Additional context.

No response

@AguileraG AguileraG added the Type: Feature Request Feature request for IDF label Jul 9, 2024
@github-actions github-actions bot changed the title Improve UART VFS support for binary streams Improve UART VFS support for binary streams (IDFGH-13218) Jul 9, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Jul 9, 2024
@igrr
Copy link
Member

igrr commented Jul 9, 2024

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.

@robin-twice
Copy link

@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!

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: Opened Issue is new labels Oct 31, 2024
espressif-bot pushed a commit that referenced this issue Dec 11, 2024
- 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
espressif-bot pushed a commit that referenced this issue Dec 11, 2024
- 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
espressif-bot pushed a commit that referenced this issue Dec 11, 2024
- 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
espressif-bot pushed a commit that referenced this issue Dec 16, 2024
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

5 participants