File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ project adheres to [Semantic Versioning](https://semver.org/).
1212### Fixed
1313* Fixes a bug where ` available_ports() ` returned disabled devices on Windows.
1414 [ #144 ] ( https://github.com/serialport/serialport-rs/pull/144 )
15+ * Fixes a bug on Windows where the ` WriteTotalTimeoutConstant ` field hasn't been
16+ configured properly when the ` set_timeout ` method is called.
17+ [ #124 ] ( https://github.com/serialport/serialport-rs/issues/124 )
1518
1619### Removed
1720
Original file line number Diff line number Diff line change @@ -240,14 +240,14 @@ impl SerialPort for COMPort {
240240 }
241241
242242 fn set_timeout ( & mut self , timeout : Duration ) -> Result < ( ) > {
243- let milliseconds = timeout. as_secs ( ) * 1000 + timeout . subsec_nanos ( ) as u64 / 1_000_000 ;
243+ let milliseconds = timeout. as_millis ( ) ;
244244
245245 let mut timeouts = COMMTIMEOUTS {
246246 ReadIntervalTimeout : 0 ,
247247 ReadTotalTimeoutMultiplier : 0 ,
248248 ReadTotalTimeoutConstant : milliseconds as DWORD ,
249249 WriteTotalTimeoutMultiplier : 0 ,
250- WriteTotalTimeoutConstant : 0 ,
250+ WriteTotalTimeoutConstant : milliseconds as DWORD ,
251251 } ;
252252
253253 if unsafe { SetCommTimeouts ( self . handle , & mut timeouts) } == 0 {
You can’t perform that action at this time.
0 commit comments