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

Windows implementation #4

Merged
merged 2 commits into from
Feb 25, 2018
Merged

Windows implementation #4

merged 2 commits into from
Feb 25, 2018

Conversation

ndusart
Copy link
Contributor

@ndusart ndusart commented Dec 30, 2017

This add support for Windows platform.

I used the mio-named-pipes crate to implement that easily without having to copy files from mio to use structs that are not public.

As its name implie, this crate allow to read/write to a named pipe which is basically implemented using ReadFile/WriteFile api just as what we have to use for COM ports.
The only difference reside in the way to create that file which is then handled specifically in Serial::from_path.

This is based on serialport-2 branch as we need a new function (not merged yet) to create a COMPort with a handle directly. Allowing to open the file for asynchronous operations.
I'll have to switch to the crates.io serialport when published.

I modified the example to build on Windows too.
As async API is completion-based on Windows, readiness is actually updated only when read is actually performed. so we got a lot of "Read would have blocked." in the output as it is readable even if no bytes are available. That's inherent to mio

@berkowski berkowski mentioned this pull request Jan 2, 2018
4 tasks
@berkowski
Copy link
Owner

Well happy new-year!

I'll keep track of your progress on serialport-rs: https://gitlab.com/susurrus/serialport-rs/merge_requests/25. When that goes through at least we can keep the serialport-rs git link pointed at the main repository.

I don't have any experience with rust on windows, so thank you very much for pushing the initiative along!

@Susurrus
Copy link

I just released 2.1 of serialport-rs to crates.io, so at least that part is done now.

@berkowski
Copy link
Owner

@ndusart Looks like the "examples/win_test.rs" isn't included? Otherwise looks ready to go.

@ndusart
Copy link
Contributor Author

ndusart commented Feb 25, 2018

I removed the example reference in Cargo.toml.
It was a basic test I made when first iterating over my implementation. It does not add any value to the existing example, and I don't have it now anyway.

@berkowski berkowski merged commit 9868061 into berkowski:serialport-2 Feb 25, 2018
@ndusart ndusart deleted the win branch February 27, 2018 09:30
@berkowski berkowski mentioned this pull request Mar 15, 2020
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

Successfully merging this pull request may close these issues.

None yet

3 participants