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

UART_SELECT_WRITE_NOTIF should be trigger when the uart is writable (IDFGH-10083) #11358

Closed
XinyuKhan opened this issue May 9, 2023 · 5 comments
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Feature Request Feature request for IDF

Comments

@XinyuKhan
Copy link

Is your feature request related to a problem?

I was using vfs_uart module to manage uart io, but I found the behaviour of uart fd is not same as which of a socket fd. I never receive a writable event of a uart fd when I selecting it. I found the UART_SELECT_WRITE_NOTIF event was never triggered in the vfs implementation. I want to know why?

Describe the solution you'd like.

I hope the behaviour of the selecting of a uart fd is as same as which of a socket fd.

Describe alternatives you've considered.

No response

Additional context.

No response

@XinyuKhan XinyuKhan added the Type: Feature Request Feature request for IDF label May 9, 2023
@github-actions github-actions bot changed the title UART_SELECT_WRITE_NOTIF should be trigger when the uart is writable UART_SELECT_WRITE_NOTIF should be trigger when the uart is writable (IDFGH-10083) May 9, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label May 9, 2023
@adokitkat
Copy link
Collaborator

Hi, could you please specify which ESP32 chip are you using and also provide a working example which reproduces this behavior as a zip file or a link to your repo? Thank you.

@XinyuKhan
Copy link
Author

XinyuKhan commented May 11, 2023

Hi, thank you for your reply. I've encountered an issue in one of my extensive projects, so it might take some time for me to extract the relevant UART code if necessary. Meanwhile, you could search for the UART_SELECT_WRITE_NOTIF macro in the esp-idf repository, specifically in the version 5.0 release. You'll find that this macro is never actually utilized in the code. The implementation of UART VFS clearly indicates that the writable event will never be triggered if the UART_SELECT_WRITE_NOTIF macro isn't employed in the code. This constitutes the problem at hand.

@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development Awaiting Response awaiting a response from the author and removed Status: Opened Issue is new Awaiting Response awaiting a response from the author labels May 15, 2023
@dobairoland
Copy link
Collaborator

This was implemented years ago and introduced in v3.1. Write notification was never fired. If I remember the reason well then the assumption was that one can always write to UART. Starting a select call and waiting for UART to be writable would immediately return from the call.

Nobody missed this over the years. I guess implementing this would require to define the use case and create an example where the implementation could be tested.

@XinyuKhan
Copy link
Author

This was implemented years ago and introduced in v3.1. Write notification was never fired. If I remember the reason well then the assumption was that one can always write to UART. Starting a select call and waiting for UART to be writable would immediately return from the call.

Nobody missed this over the years. I guess implementing this would require to define the use case and create an example where the implementation could be tested.

Dear dobairoland,

Thank you for your insightful comment on the UART_SELECT_WRITE_NOTIF issue. I appreciate your explanation and the historical context you provided.

I would like to share my perspective on a couple of points you raised:

The behavior where starting a select call and waiting for UART to be writable immediately returns from the call is, in my opinion, more intuitive and consistent with the behavior of TCP sockets. This consistency can help avoid confusion for developers who are working with both UART and TCP sockets.

While I understand that "one can always write to UART" is a low-level detail, the behavior of select is a higher-level convention. I believe that these higher-level conventions should not be compromised due to low-level details. The abstraction provided by these conventions is crucial for developers to write efficient and maintainable code without needing to understand all the low-level details.

I hope these points can contribute to the ongoing discussion and look forward to hearing your thoughts.

Best regards,
XinyuKhan

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Selected for Development Issue is selected for development labels Jul 13, 2023
@RathiSonika
Copy link
Collaborator

Duplicates: #10986
Closed with commit 571831b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

5 participants