1# Change log 2 3All notable changes to this project will be documented in this file. 4 5The format is based on [Keep a Changelog](https://keepachangelog.com/) and this 6project adheres to [Semantic Versioning](https://semver.org/). 7 8## [Unreleased] 9 10### Added 11### Changed 12### Fixed 13### Removed 14 15 16## [4.7.0] - 2025-01-13 17 18### Changed 19 20* Enumerate ports from more subsystems on Linux without libudev. 21 [#238](https://github.com/serialport/serialport-rs/pull/238) 22* Set data terminal ready (DTR) signal when opening a port by default and allow 23 to customize this behavior through the builder. 24 [#239](https://github.com/serialport/serialport-rs/pull/239) 25 26### Fixed 27 28* Retry flushing data on `EINTR` up to the ports read/write timeout. 29 [#225](https://github.com/serialport/serialport-rs/pull/225) 30 31 32## [4.6.1] - 2024-12-01 33 34### Fixed 35 36* Pin subdependency `libc` to maintain compatibility with MSRV 1.59.0. 37 [#229](https://github.com/serialport/serialport-rs/pull/229) 38 39 40## [4.6.0] - 2024-10-21 41 42### Added 43 44* Add recommendation on how to interpret `UsbPortInfo::interface_number`. 45 [#219](https://github.com/serialport/serialport-rs/pull/219) 46* Add support for retrieving USB port info on Linux without libudev. 47 [#220](https://github.com/serialport/serialport-rs/pull/220) 48 49### Changed 50 51* Switched from core-foundation-sys to core-foundation for more conveniently 52 working with Core Foundation types for enumeration on macOS. 53 [#218](https://github.com/serialport/serialport-rs/pull/218) 54* Refactored output from example `list_ports` (alignment and order) for easily 55 comparing different runs. 56 [#220](https://github.com/serialport/serialport-rs/pull/220) 57 58### Fixed 59 60* Fix enumeration USB reported as PCI devices which do not have a (short) 61 serial number. 62 [#160](https://github.com/serialport/serialport-rs/pull/160) 63* Fix ignoring the status of several function calls into Core Foundation on mac 64 OS. 65 [#218](https://github.com/serialport/serialport-rs/pull/218) 66 67 68## [4.5.1] - 2024-09-20 69 70### Fixed 71 72* Fix ignoring errors from setting baud rate and ignoring unsupported baud 73 rates. 74 [#213](https://github.com/serialport/serialport-rs/pull/213) 75* Remove leftover debug output from `posix::poll::wait_fd`. 76 [#216](https://github.com/serialport/serialport-rs/pull/216) 77 78 79## [4.5.0] - 2024-08-05 80 81### Added 82 83* Add `IntoRawHandle` implementation for `COMPort` 84 [#199](https://github.com/serialport/serialport-rs/pull/199) 85* Add MODALIAS as additional source of information for USB devices on Linux 86 [#170](https://github.com/serialport/serialport-rs/pull/170) 87 88### Changed 89* Replace using regex crate for parsing device identification strings for 90 `available_ports` on Windows. This is now done by some bespoke code to 91 significantly reduce build times. 92 [#201](https://github.com/serialport/serialport-rs/pull/201) 93* Switch from ANSI to Unicode/UTF-16 string API on Windows. 94 [#89](https://github.com/serialport/serialport-rs/pull/89) 95### Fixed 96* Fix looking up `UsbPortInfo::interface` on macOS. 97 [#193](https://github.com/serialport/serialport-rs/pull/193) 98* Fix issues with very long timeout values like `Duration::MAX` by clamping to 99 maximum supported value for underlying platform. 100 [#207](https://github.com/serialport/serialport-rs/issues/207), 101 [#208](https://github.com/serialport/serialport-rs/pull/208) 102 103 104## [4.4.0] - 2024-06-26 105 106### Added 107* Add conversions between `DataBits`, `StopBits` types and their numeric 108 representations. 109* Add `FromStr` implementation for `FlowControl`. 110 [#163](https://github.com/serialport/serialport-rs/pull/163) 111 112### Changed 113* Several changes for CI hygiene. 114 115### Fixed 116* Fix a bug where `available_ports()` returned disabled devices on Windows. 117 [#144](https://github.com/serialport/serialport-rs/pull/144) 118* Fix a bug on Windows where the `WriteTotalTimeoutConstant` field hasn't been 119 configured properly when the `set_timeout` method is called. 120 [#124](https://github.com/serialport/serialport-rs/issues/124) 121* Fix a longstanding bug on Windows where timeouts of length zero 122 (`Duration::ZERO`) actually resulted in waiting indefinitely. 123 [#79](https://github.com/serialport/serialport-rs/pull/79) 124* Fix missing modem ports from `available_ports()` on Windows. 125 [#81](https://github.com/serialport/serialport-rs/issues/81) 126 [#84](https://github.com/serialport/serialport-rs/pull/84) 127* Fix MSRV incompatibility with sub-dependency of clap. 128 [#186](https://github.com/serialport/serialport-rs/pull/186) 129 130 131## [4.3.0] - 2023-12-11 132 133### Changed 134 135* Raise MSRV from 1.56.1 to 1.59.0 and Rust edition from 2018 to 2021. 136 [#137](https://github.com/serialport/serialport-rs/pull/137) 137* Update `bitflags` dependency to 2.4.0. 138 [#127](https://github.com/serialport/serialport-rs/pull/127) 139* Open serial devices with `O_CLOEXEC` (Posix). This will close the device 140 handles when starting a child process. In particular this means that a serial 141 device can be reopened after making SW update of a Tauri application. 142 [#130](https://github.com/serialport/serialport-rs/pull/130) 143* Prefer USB device manufacturer and model information from the actual USB 144 device over the information from udev's database. 145 [#137](https://github.com/serialport/serialport-rs/pull/137) 146 147### Fixed 148* Fixes a bug on Windows where composite devices would show a incorrect serial 149 number. 150 [#141](https://github.com/serialport/serialport-rs/pull/141) 151* Fixes a bug on Linux without udev where `available_ports()` returned wrong 152 device file paths. 153 [#122](https://github.com/serialport/serialport-rs/pull/122) 154* Fixes a bug on Windows where some USB device serial numbers were truncated. 155 [#131](https://github.com/serialport/serialport-rs/pull/131) 156* Switches to maintained sys crates for CoreFoundation and IOKit on macOS. 157 [#112](https://github.com/serialport/serialport-rs/issues/112), 158 [#136](https://github.com/serialport/serialport-rs/pull/136) 159 160## [4.2.2] - 2023-08-03 161### Fixed 162* Fixes a bug on the Raspberry Pi 4, which results in USB-devices being detected as PCI-devices. 163 [#113](https://github.com/serialport/serialport-rs/pull/113) 164 165 166 167## [4.2.1] - 2023-05-21 168### Added 169* Add support for reporting the USB device interface (feature-gated by 170 _usbserialinfo-interface_). 171 [#47](https://github.com/serialport/serialport-rs/pull/47), 172 [#101](https://github.com/serialport/serialport-rs/pull/101) 173* Add example for loopback testing with real hardware. 174 [#69](https://github.com/serialport/serialport-rs/pull/69) 175* Implement `fmt::Debug` and `fmt::Display` for `SerialPort` and related enums. 176 [#91](https://github.com/serialport/serialport-rs/pull/91) 177### Changed 178* Migrated from unmaintainted dependency `mach` to `mach2`. 179* Update dependency `nix` from 0.24.1 to 0.26.0 and raise MSRV to 1.56.1. 180 [#67](https://github.com/serialport/serialport-rs/pull/67), 181 [#75](https://github.com/serialport/serialport-rs/pull/75), 182 [#78](https://github.com/serialport/serialport-rs/pull/78) 183### Fixed 184* Skip attempts to set baud rate 0 on macOS. 185 [#58](https://github.com/serialport/serialport-rs/pull/58) 186* Fix getting actual result value from `tiocmget`. 187 [#61](https://github.com/serialport/serialport-rs/pull/61/files) 188* Fix serial number retrieval procedure on macOS. 189 [#65](https://github.com/serialport/serialport-rs/pull/65) 190* Fix port name retrieval procedure for Unicode names on Windows. 191 [#63](https://github.com/serialport/serialport-rs/pull/63) 192* Fix compilation for OpenBSD due to missing use declaration. 193 [#68](https://github.com/serialport/serialport-rs/pull/68) 194* A number of memory leaks have been addressed when using serialport-rs. 195 [#98](https://github.com/serialport/serialport-rs/pull/98) 196 197## [4.2.0] - 2022-06-02 198### Added 199* Add `serde` support behind a feature flag. 200 [#51](https://github.com/serialport/serialport-rs/pull/51) 201### Changed 202* Request exclusive access when opening a POSIX serial port by default. 203 [#44](https://github.com/serialport/serialport-rs/pull/44) 204* Updated `nix` dependency to 0.24.1 and limited features. 205 [#46](https://github.com/serialport/serialport-rs/pull/46) 206* Derive the `Clone` trait for `Error`. 207 [#53](https://github.com/serialport/serialport-rs/pull/53) 208* Enumerate callout devices in addition to dial-in devices on macOS. 209 [#54](https://github.com/serialport/serialport-rs/pull/54) 210* Revert to edition 2018 to allow for use with older compiler versions. 211### Fixed 212* Set port timeout to a non-zero value before performing loopback test. 213 [#45](https://github.com/serialport/serialport-rs/pull/45) 214 215## [4.1.0] - 2022-04-04 216### Added 217* impl `SerialPort` for `&mut T`. This allows a `&mut T (where T: SerialPort)` 218 to be used in a context where `impl SerialPort` is expected. 219 [!114](https://gitlab.com/susurrus/serialport-rs/-/merge_requests/114) 220### Changed 221* Updated `nix` dependency to 0.23.1. 222* Remove useless call to tcflush on open. 223 [#40](https://github.com/serialport/serialport-rs/pull/40) 224### Fixed 225* Improved support for recent versions of macOS. 226 [!104](https://gitlab.com/susurrus/serialport-rs/-/merge_requests/104) 227* Fix filehandle leak in open() on Windows. 228 [#36](https://github.com/serialport/serialport-rs/pull/36) 229* Make sure fd is properly closed if initialization fails. 230 [#39](https://github.com/serialport/serialport-rs/pull/39) 231 [#41](https://github.com/serialport/serialport-rs/pull/41) 232 233## [4.0.1] - 2021-04-17 234### Changed 235* Update maintenance status to looking for a new maintainer. 236### Fixed 237* Properly initialize DCB structure on Windows. This fixes some non-functional 238 devices. 239 [!97](https://gitlab.com/susurrus/serialport-rs/-/merge_requests/97) 240 241## [4.0.0] - 2020-12-17 242### Added 243* Added `send_break()` to `TTYPort`. 244 [!69](https://gitlab.com/susurrus/serialport-rs/merge_requests/69) 245* Enable `available_ports()` for Linux musl targets and those without the 246 `libudev` feature enabled by scanning `/sys/` for ports. 247 [!72](https://gitlab.com/susurrus/serialport-rs/merge_requests/72) 248* `ENOENT` and `EACCES` errors are now exposed as `NotFound` and 249 `PermissionDenied` errors on Linux. 250 [!80](https://gitlab.com/susurrus/serialport-rs/merge_requests/80) 251* `try_clone_native()` was added to `COMPort` and `TTYPort` to complement 252 `SerialPort::try_clone()` but returning the concrete type instead. 253 [!85](https://gitlab.com/susurrus/serialport-rs/merge_requests/85) 254* Added `set_break()` and `clear_break()` to `SerialPort`. 255 [!70](https://gitlab.com/susurrus/serialport-rs/merge_requests/70) 256 257### Changed 258* Minimum supported Rust version is now 1.36.0 to support the `mem::MaybeUninit` 259 feature. 260* The platform-specific `TTYPort`/`BreakDuration` and `COMPort` are now at the 261 root level rather than under the `posix` and `windows` submodules 262 respectively. 263* Opening `SerialPort` s now uses the builder pattern through 264 `serialport::new()`. See the README for concrete examples. 265 [!73](https://gitlab.com/susurrus/serialport-rs/merge_requests/73) 266* `SerialPorts`s are no longer opened with a default timeout of 1ms. 267* Under linux, the `manufacturer` and `product` fields of `UsbPortInfo` now take 268 their values from the `ID_VENDOR_FROM_DATABASE` and `ID_MODEL_FROM_DATABASE` 269 udev properties respectively, instead of the `ID_VENDOR` and `ID_MODEL` 270 properties that were used before. When the `_FROM_DATABASE` values are not 271 available, it falls back to the old behavior. 272 [!86](https://gitlab.com/susurrus/serialport-rs/merge_requests/86) 273* POSIX ports are no longer opened in exclusive mode. After opening they can be 274 made exclusive via `TTYPort::set_exclusive()`. 275 [!98](https://gitlab.com/susurrus/serialport-rs/merge_requests/98) 276 277### Fixed 278* Raised the version specification for `bitflags` to 1.0.4. Previously it was 279 set to 1.0.0, but this version of `bitflags` is actually incompatible with 280 Rust 2018 style macro imports that `serialport-rs` requires. 281 [!83](https://gitlab.com/susurrus/serialport-rs/merge_requests/83) 282 283### Removed 284* Removed the `serialport::prelude` module. Types should be explicitly imported 285 or can be glob-imported from the root like `use serialport::*`. 286 [!82](https://gitlab.com/susurrus/serialport-rs/merge_requests/82) 287 288## [3.3.0] - 2019-06-12 289### Added 290* Added support for arbitrary baud rates on macOS and iOS. 291 292### Changed 293* Minimum supported Rust version is now 1.31 to support using the 2018 edition 294 of Rust. 295 296### Fixed 297* Upgraded `sparc64-unknown-linux-gnu` to Tier 2 support. 298 299## [3.2.0] - 2019-01-01 300### Added 301* Port enumeration is now supported on FreeBSD. 302 303### Changed 304* Minimum supported Rust version changed to 1.24.1. 305* Made `aarch64-unknown-linux-musl` a Tier-2 supported target. 306 307### Fixed 308* Fixed software flow control for POSIX systems. 309 [!54](https://gitlab.com/susurrus/serialport-rs/merge_requests/54) 310 311### Removed 312* Removed support for `x86_64-unknown-linux-gnux32`. 313 314## [3.1.0] - 2018-11-02 315### Added 316* Added `bytes_to_read()`, `bytes_to_write()`, and `clear()` to `SerialPort`. 317 Also added example scripts for using them. 318* Added Tier 2 support for: 319 * `armv5te-unknown-linux-musleabi` 320* Added "libudev" feature to allow for disabling linking to `libudev` on Linux. 321 322## [3.0.0] - 2018-07-14 323### Added 324* Arbitrary baud rates are now supported on BSDs, Linux, and Windows. 325* Added Tier 1 support for `{i586|i686|x86_64}-unknown-linux-musl`. 326* Added Tier 2 support for: 327 * `{arm|armv7}-linux-androideabi` 328 * `i686-linux-android` 329 * `{i686|x86_64}-unknown-freebsd` 330 * `arm-unknown-linux-musleabi` 331 * `armv7-unknown-linux-musleabihf` 332 * `{mips64|mips64el}-unknown-linux-gnuabi64` 333 * `armv5te-unknown-linux-gnueabi` 334 * `{aarch64|mips|mipsel|powerpc64|powerpc64le|powerpc|s390x}-unknown-linux-gnu` 335 * `{mips|mipsel}-unknown-linux-musl` 336 * `x86_64-unknown-netbsd` 337* Added Tier 3 support for: 338 * `{aarch64|x86_64}-linux-android` 339 * `aarch64-unknown-linux-musl` 340 * `sparc64-unknown-linux-gnu`, 341 * `x86_64-unknown-linux-gnux32` 342 343### Changed 344* Most port configuration methods now return a `Result<()>`. 345* Renamed `SerialPort::port_name()` to `name()`. 346 347### Fixed 348* On Windows, the `port_name` field on `SerialPortInfo` included an extraneous 349 trailing nul byte character. 350 351### Removed 352* The `BaudRate` enum was removed in favor of a `u32`. 353 354## [2.3.0] - 2018-03-13 355### Added 356* Added `examples/hardware_check.rs` for use in debugging library or driver 357 issues when using physical serial ports. 358* Added `SerialPort::try_clone` which allows for cloning a port for full-duplex 359 reading and writing. 360 361### Changed 362* Removed configuration caching for serial ports. The underlying implementations 363 for all platforms cached a configuration struct so that modifying the port 364 settings involved a single switch into kernel space. This has been removed so 365 now two system calls are needed for every configuration change. This is 366 probably a slight performance regression, but should allow the new 367 `SerialPort::try_clone` interface to work as people expect. 368 369### Fixed 370* `TTYPort::into_raw_fd` will now work as expected. It previously closed the 371 port so the returned file descriptor would be invalid. 372* 921600 baud is now supported on NetBSD and FreeBSD. 373 374## 2.2.0 - 2018-03-13 375Unreleased, happened due to a user error using `cargo-release`. 376 377## [2.1.0] - 2018-02-14 378### Added 379* `impl FromRawHandle` for `COMPort`. 380 381### Changed 382* Specific IO-related errors are now returned instead of mapping every IO error 383 to Unknown. This makes it possible to catch things like time-out errors. 384* Changed all baud rates to be reported as the discrete `BaudRate::Baud*` types 385 rather than as the `BaudRate::BaudOther(*)` type. 386 387### Fixed 388* Modem-type USB serial devices are now enumerated on macOS. This now allows 389 connected Arduinos to be detected. 390* Compilation on FreeBSD and NetBSD was fixed by removing the 921600 baud rates. 391 These will be re-added in a future release. 392 393## [2.0.0] - 2017-12-18 394### Added 395* USB device information is now returned in calls to `available_ports()`. 396* Serial port enumeration is now supported on Mac. 397* Serial port enumeration now attempts to return the interface used for the port 398 (USB, PCI, Bluetooth, Unknown). 399* `BaudRate::standard_rates()` provides a vector of cross-platform baud rates. 400* `SerialPort` trait is now `Send`. 401 402### Changed 403* Software license has changed from LGPLv3+ to MPL-2.0. This makes it possible 404 to use this library in any Rust project if it's unmodified. 405* Mac is now a Tier 2 supported platform. 406* Removed `BaudRate::from_speed(usize)` and `BaudRate::speed -> usize` in favor 407 of the `From<u32>` and `Into<u32>` traits. 408* Removed `available_baud_rates` in favor of `BaudRate::platform_rates()` as 409 this has a more clear semantic meaning. The returned list of baud rates is now 410 also correct for all supported platforms. 411* Removed `termios` dependency in favor of `nix`. This is a big step towards 412 supporting additional platforms. 413 414### Fixed 415* Stop bits are now specified properly (had been reversed). Thanks to 416 @serviushack. (MR#9) 417* `TTYPort::pair()` is now thread-safe. 418* `TTYPort::open()` no longer leaks file descriptors if it errors. Thanks to 419 @daniel. (MR#12) 420* Fixed compilation when targeting Android. 421 422## [1.0.1] - 2017-02-20 423### Fixed 424* `read()` now properly blocks for at least one character. 425* Compilation now works on Mac. 426 427## [1.0.0] - 2017-02-13 428### Changed 429* Various documentation/README updates. 430* Minor formatting fixes (from rustfmt). 431 432### Fixed 433* Platform-specific examples are now only built on appropriate platforms. 434 435## [0.9.0] - 2017-02-09 436### Added 437* `impl Debug` for `COMPort`. 438* `exclusive()` and `set_exclusive()` for `TTYPort`. 439* `port_name()` for `SerialPort`. 440* `impl FromRawFd` and `impl IntoRawFd` for `TTYPort`. 441* `pair()` for `TTYPort`. 442 443## [0.3.0] - 2017-01-28 444### Added 445* `open_with_settings()` to support initializing the port with custom settings. 446* `SerialPortSettings` is now publically usable being exported in the prelude, 447 having all public and commented fields, and a `Default` impl. 448 449### Changed 450* `TTYPort/COMPort::open()` now take a `SerialPortSettings` argument and return 451 concrete types. 452* `serialport::open()` now initializes the port to reasonable defaults. 453* Removed all instances of `try!()` for `?`. 454* `SerialPort::set_all()` now borrows `SerialPortSettings`. 455 456## [0.2.4] - 2017-01-26 457### Added 458* Report an Unimplemented error for unsupported unix targets. 459 460### Changed 461* Minor changes suggested by Clippy. 462* Reworked Cargo.toml to more easily support additional targets. 463 464### Fixed 465* AppVeyor badge should now be properly displayed. 466 467## [0.2.3] - 2017-01-21 468### Added 469* Specify AppVeyor build status badge for crates.io. 470 471## [0.2.2] - 2017-01-21 472* No changes, purely a version increment to push new crate metadata to 473 crates.io. 474 475## [0.2.1] - 2017-01-21 476### Added 477* Specify category for crates.io. 478 479## [0.2.0] - 2017-01-07 480### Added 481* Added a changelog. 482* Added a getter/setter pair for all settings at once. 483* An error is thrown if settings weren't correctly applied on POSIX. 484 485## [0.1.1] - 2016-12-23 486### Changed 487* Fixed compilation on x86_64-pc-windows-gnu target. 488* Added contributors to README. 489* Clarified license terms in the README. 490 491## [0.1.0] - 2016-12-22 492### Added 493* Initial release. 494 495 496[Unreleased]: https://github.com/serialport/serialport-rs/compare/v4.7.0...HEAD 497[4.7.0]: https://github.com/serialport/serialport-rs/compare/v4.6.1...v4.7.0 498[4.6.1]: https://github.com/serialport/serialport-rs/compare/v4.6.0...v4.6.1 499[4.6.0]: https://github.com/serialport/serialport-rs/compare/v4.5.1...v4.6.0 500[4.5.1]: https://github.com/serialport/serialport-rs/compare/v4.5.0...v4.5.1 501[4.5.0]: https://github.com/serialport/serialport-rs/compare/v4.4.0...v4.5.0 502[4.4.0]: https://github.com/serialport/serialport-rs/compare/v4.3.0...v4.4.0 503[4.3.0]: https://github.com/serialport/serialport-rs/compare/v4.2.2...v4.3.0 504[4.2.2]: https://github.com/serialport/serialport-rs/compare/v4.2.1...v4.2.2 505[4.2.1]: https://github.com/serialport/serialport-rs/compare/v4.2.0...v4.2.1 506[4.2.0]: https://github.com/serialport/serialport-rs/compare/v4.1.0...v4.2.0 507[4.1.0]: https://github.com/serialport/serialport-rs/compare/v4.0.1...v4.1.0 508[4.0.1]: https://github.com/serialport/serialport-rs/compare/v4.0.0...v4.0.1 509[4.0.0]: https://github.com/serialport/serialport-rs/compare/v3.3.0...v4.0.0 510[3.3.0]: https://github.com/serialport/serialport-rs/compare/v3.2.0...v3.3.0 511[3.2.0]: https://github.com/serialport/serialport-rs/compare/v3.1.0...v3.2.0 512[3.1.0]: https://github.com/serialport/serialport-rs/compare/v3.0.0...v3.1.0 513[3.0.0]: https://github.com/serialport/serialport-rs/compare/v2.3.0...v3.0.0 514[2.3.0]: https://github.com/serialport/serialport-rs/compare/v2.1.0...v2.3.0 515[2.1.0]: https://github.com/serialport/serialport-rs/compare/v2.0.0...v2.1.0 516[2.0.0]: https://github.com/serialport/serialport-rs/compare/v1.0.1...v2.0.0 517[1.0.1]: https://github.com/serialport/serialport-rs/compare/v1.0.0...v1.0.1 518[1.0.0]: https://github.com/serialport/serialport-rs/compare/v0.9.0...v1.0.0 519[0.9.0]: https://github.com/serialport/serialport-rs/compare/v0.3.0...v0.9.0 520[0.3.0]: https://github.com/serialport/serialport-rs/compare/v0.2.4...v0.3.0 521[0.2.4]: https://github.com/serialport/serialport-rs/compare/v0.2.3...v0.2.4 522[0.2.3]: https://github.com/serialport/serialport-rs/compare/v0.2.2...v0.2.3 523[0.2.2]: https://github.com/serialport/serialport-rs/compare/v0.2.1...v0.2.2 524[0.2.1]: https://github.com/serialport/serialport-rs/compare/v0.2.0...v0.2.1 525[0.2.0]: https://github.com/serialport/serialport-rs/compare/v0.1.1...v0.2.0 526[0.1.1]: https://github.com/serialport/serialport-rs/compare/v0.1.0...v0.1.1 527[0.1.0]: https://github.com/serialport/serialport-rs/releases/tag/v0.1.0 528