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

Serial communication may be blocking #39

Open
alexrudd2 opened this issue Apr 12, 2023 · 2 comments
Open

Serial communication may be blocking #39

alexrudd2 opened this issue Apr 12, 2023 · 2 comments

Comments

@alexrudd2
Copy link
Member

I think the higher-level write_and_read will block with this serial implementation. There needs to be an async wait-until-ready part.

I don't know how best to do this with serial today.

Originally posted by @patrickfuller in #37 (comment)

@griffinmilsap
Copy link

I can confirm this is definitely an issue with the module. I believe pyserial was mostly written before asyncio was common. There's a pyserial-asyncio extension that appears to implement a cross-platfrom async serial implementation, but ... it also looks like pyserial is not well maintained these days.

Unclear if the solution is to bring in pyserial-asyncio (or the homelab fork) and hope for the best, or if it makes sense to make changes the serial backend to natively support interactions with serial file-descriptors using O_NONBLOCK and some Windows-specific nonsense for that platform.

I was thrilled to see that this module was recent and featured an async API, but learning that the serial comms are not actually async under the hood makes a fix for this issue imperative for me. I'll start work on a PR.

@alexrudd2
Copy link
Member Author

I can confirm this is definitely an issue with the module. I believe pyserial was mostly written before asyncio was common. There's a pyserial-asyncio extension that appears to implement a cross-platfrom async serial implementation, but ... it also looks like pyserial is not well maintained these days.

Unclear if the solution is to bring in pyserial-asyncio (or the homelab fork) and hope for the best, or if it makes sense to make changes the serial backend to natively support interactions with serial file-descriptors using O_NONBLOCK and some Windows-specific nonsense for that platform.

I was thrilled to see that this module was recent and featured an async API, but learning that the serial comms are not actually async under the hood makes a fix for this issue imperative for me. I'll start work on a PR.

Thanks for your comment, and I hope the library can be of use to you. Please send any pull requests to alexrudd2/alicat as that fork is actively maintained.

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

2 participants