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
I'm not sure if this is pyserial-asyncio's issue or asyncio's but there seems to be no way to determine if the read buffer is empty.
If I understand correctly using the StreamReader returned from open_serial_connection(), await StreamReader.read(1) should return empty bytes if the buffer is empty (EOF) but in my case it awaits indefinitely if no bytes are ever received (returns as soon as a byte is received). await StreamReader.read() awaits forever even if bytes are received, so appears to be useless.
StreamReader.at_eof() is always False even after a freshly opened connection or after read() returns.
I'm on Windows and I read in another issue that the Windows implementation is non-optimal so I'm not sure if that's related. I haven't tested on other platforms.
The text was updated successfully, but these errors were encountered:
AFAIK, EOF condition is not equivalent to buffer being empty. So when the read buffer is empty, the library just waits for new bytes to arrive (and can do it forever).
Moreover, the source code has this comment: Serial ports do not support the concept of end-of-file., which means that you should not rely on EOF-related APIs in any way.
I'm not sure if this is pyserial-asyncio's issue or asyncio's but there seems to be no way to determine if the read buffer is empty.
If I understand correctly using the
StreamReader
returned fromopen_serial_connection()
,await StreamReader.read(1)
should return empty bytes if the buffer is empty (EOF) but in my case it awaits indefinitely if no bytes are ever received (returns as soon as a byte is received).await StreamReader.read()
awaits forever even if bytes are received, so appears to be useless.StreamReader.at_eof()
is always False even after a freshly opened connection or after read() returns.I'm on Windows and I read in another issue that the Windows implementation is non-optimal so I'm not sure if that's related. I haven't tested on other platforms.
The text was updated successfully, but these errors were encountered: