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

reader never receives EOF #86

Open
davegravy opened this issue Aug 7, 2022 · 2 comments
Open

reader never receives EOF #86

davegravy opened this issue Aug 7, 2022 · 2 comments

Comments

@davegravy
Copy link

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.

@ALERTua
Copy link

ALERTua commented Mar 18, 2024

The library is unusable for me due to this bug.

@positron96
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants