-
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
UART_SELECT_WRITE_NOTIF should be trigger when the uart is writable (IDFGH-10083) #11358
Comments
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. |
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. |
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, |
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
The text was updated successfully, but these errors were encountered: