de-vri-es / serial2-rs

Cross platform serial ports for Rust
Other
41 stars 10 forks source link

Expose raw platform specific serial port settings. #18

Closed de-vri-es closed 8 months ago

de-vri-es commented 9 months ago

This PR exposes access to raw platform specific settings as an escape hatch for unimplemented functionality.

de-vri-es commented 9 months ago

@jerrywrice: Could you review this PR and check if it enables your use case?

jerrywrice commented 9 months ago

Looking at the new interface methods

'pub fn get_windows_timeouts(&self) -> std::io::Result' and 'pub fn set_windows_timeouts(&self, timeouts: &crate::os::windows::CommTimeouts) -> std::io::Result<()>'

it appears this should do it.

I look forward to using these.

Please let me know if and when you need some testing done on this.

de-vri-es commented 9 months ago

If you have the time, could you test the changes directly from this branch before I merge? Would be nice to get some real world testing done before releasing it :D

jerrywrice commented 9 months ago

Yes, I'll do this starting this weekend. I'll update you as I proceed.


I built this PR branch on 10-14-2023, and integrated it into my rust dual serial port test utility (originally developed for 'serialport-rs'). I executed multiple runs involving 200 cycles of 100 bytes transmitted and received between two serial ports at 115200 baud. I did this with the following two read timeout configurations (in separate runs):

First test timeout config setup =>

read_interval_timeout = u32::MAX;
read_total_timeout_multiplier = u32::MAX;
read_total_timeout_constant = timeout_ms;
write_total_timeout_constant = 0u32;
write_total_timeout_multiplier = 0u32;

Second test timeout config setup =>

read_interval_timeout = u32::MAX;
read_total_timeout_multiplier = 0u32;
read_total_timeout_constant = 0u32;
write_total_timeout_constant = 0u32;
write_total_timeout_multiplier = 0u32;

The transfer/receives succeeded when executed in sequence with the specified sets of different COMMTIMEOUT parameter values. Your new Windows specific timeout setting functionality is operating correctly.

⁣Sent from TypeApp ​

On Oct 12, 2023, 8:42 AM, at 8:42 AM, Maarten de Vries @.***> wrote:

If you have the time, could you test the changes directly from this branch before I merge? Would be nice to get some real world testing done before releasing it :D

-- Reply to this email directly or view it on GitHub: https://github.com/de-vri-es/serial2-rs/pull/18#issuecomment-1759878296 You are receiving this because you were mentioned.

Message ID: @.***>

jerrywrice commented 8 months ago

Maarten,

Done. It looks and works fine.

I added a new comment on the Github PR describing my testing.

Thanks for implementing this for promptly!

Best wishes,

Jerry W. Rice, Chief Technology Officer

http://www.FABNexus.com www.FABNexus.com

660 Arboleda Drive

Los Altos, CA 94024

Email: @.> @.

Cell: 650-207-8235

From: Maarten de Vries @.> Sent: Thursday, October 12, 2023 8:42 AM To: de-vri-es/serial2-rs @.> Cc: JWR_FABNexus @.>; Mention @.> Subject: Re: [de-vri-es/serial2-rs] Expose raw platform specific serial port settings. (PR #18)

If you have the time, could you test the changes directly from this branch before I merge? Would be nice to get some real world testing done before releasing it :D

— Reply to this email directly, view it on GitHub https://github.com/de-vri-es/serial2-rs/pull/18#issuecomment-1759878296 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHOLCTRXD3TOETC2ULRM5LX7AFWFANCNFSM6AAAAAA54RSBHA . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AEHOLCRQCHXW7M56IT6PONDX7AFWFA5CNFSM6AAAAAA54RSBHCWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTI4WOJQ.gif Message ID: @. @.> >

de-vri-es commented 8 months ago

Great. Thanks for testing!

de-vri-es commented 8 months ago

Released as 0.2.7 :)