serialport
A cross-platform low-level serial port library.
4.9.0
18M downloads/mo
#2251 most downloaded on crates.io
serialport/serialport-rs
What this package is like to depend on
Last release 5 months ago
16 Mar 2026
Release timing varies
gaps range from 5 weeks to 7 months
Nearly every release is documented
notes for 33 of 33 stable releases
4 versions withdrawn
withdrawn after publishing
10 years old
37 releases · first in 2016
3 releases in the last 12 months
see the full history below
Release timeline
37 releases · Dec 2016 to Mar 2026
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Releases
latest 37-
4.9.016 Mar 2026Release notes
Open source →Added
- Add
exclusiveconfiguration option toSerialPortBuilderto control whether ports are opened with exclusive access locks. #319
Changed
- Enumerate serial-base subsystem on Linux without libudev support too. Some of these newly enumerated ports may show up with a different type than with libudev, but they will be finally enumerated at all. #311
- Enable arbitrary baud rates for Linux musl targets by directly using
termios2and the correspondingioctlsTCGETS2andTCSETS2from nix and the libc crate. There is no support form musl fortermios2and we are directly talking to the kernel and bypassing it here. #316
Fixed
- Always propagate errors out of termios getter/setter implementations.
- Wrap slave port file descriptors in
TTYPort::pairin aDrop-safeOwnedFdto avoid file descriptor leaks on early returns. - Enable arbitrary baud rates for Linux musl targets by using the
termios2(TCGETS2/TCSETS2+BOTHER) path now that requiredlibcsymbols are available. #316 - Unpin dependencies with MSRV incompatible Rust version bump. This caused issues with dependency resolution for many users building with newer Rust versions. See Dependencies on how to pin them in your project when building with older Rust versions. #324 #307 #304 #300 #231
- Add
-
4.8.107 Oct 2025 -
4.8.007 Oct 2025Release notes
Open source → -
4.7.325 Aug 2025 -
4.7.216 May 2025 withdrawnRelease notes
Open source →Fixed
- Set data terminal ready (DTR) on best-effort for not failing in the situation where we can't detect whether to apply this setting reliably. #268
-
4.7.126 Mar 2025 withdrawn -
4.7.013 Jan 2025 withdrawnRelease notes
Open source →Changed
- Enumerate ports from more subsystems on Linux without libudev. #238
- Set data terminal ready (DTR) signal when opening a port by default and allow to customize this behavior through the builder. #239
Fixed
- Retry flushing data on
EINTRup to the ports read/write timeout. #225
-
4.6.101 Dec 2024Release notes
Open source →Fixed
- Pin subdependency
libcto maintain compatibility with MSRV 1.59.0. #229
- Pin subdependency
-
4.6.022 Oct 2024Release notes
Open source →Added
- Add recommendation on how to interpret
UsbPortInfo::interface_number. #219 - Add support for retrieving USB port info on Linux without libudev. #220
Changed
- Switched from core-foundation-sys to core-foundation for more conveniently working with Core Foundation types for enumeration on macOS. #218
- Refactored output from example
list_ports(alignment and order) for easily comparing different runs. #220
Fixed
- Add recommendation on how to interpret
-
4.5.120 Sep 2024 -
4.5.005 Aug 2024Release notes
Open source →Added
- Add
IntoRawHandleimplementation forCOMPort#199 - Add MODALIAS as additional source of information for USB devices on Linux #170
Changed
- Replace using regex crate for parsing device identification strings for
available_portson Windows. This is now done by some bespoke code to significantly reduce build times. #201 - Switch from ANSI to Unicode/UTF-16 string API on Windows. #89
Fixed
- Add
-
4.4.027 Jun 2024Release notes
Open source →Added
- Add conversions between
DataBits,StopBitstypes and their numeric representations. - Add
FromStrimplementation forFlowControl. #163
Changed
- Several changes for CI hygiene.
Fixed
- Fix a bug where
available_ports()returned disabled devices on Windows. #144 - Fix a bug on Windows where the
WriteTotalTimeoutConstantfield hasn't been configured properly when theset_timeoutmethod is called. #124 - Fix a longstanding bug on Windows where timeouts of length zero
(
Duration::ZERO) actually resulted in waiting indefinitely. #79 - Fix missing modem ports from
available_ports()on Windows. #81 #84 - Fix MSRV incompatibility with sub-dependency of clap. #186
- Add conversions between
-
4.3.012 Dec 2023Release notes
Open source →Changed
- Raise MSRV from 1.56.1 to 1.59.0 and Rust edition from 2018 to 2021. #137
- Update
bitflagsdependency to 2.4.0. #127 - Open serial devices with
O_CLOEXEC(Posix). This will close the device handles when starting a child process. In particular this means that a serial device can be reopened after making SW update of a Tauri application. #130 - Prefer USB device manufacturer and model information from the actual USB device over the information from udev's database. #137
Fixed
- Fixes a bug on Windows where composite devices would show a incorrect serial number. #141
- Fixes a bug on Linux without udev where
available_ports()returned wrong device file paths. #122 - Fixes a bug on Windows where some USB device serial numbers were truncated. #131
- Switches to maintained sys crates for CoreFoundation and IOKit on macOS. #112, #136
-
4.2.205 Aug 2023Release notes
Open source →Fixed
- Fixes a bug on the Raspberry Pi 4, which results in USB-devices being detected as PCI-devices. #113
-
4.2.122 May 2023Release notes
Open source →Added
- Add support for reporting the USB device interface (feature-gated by usbserialinfo-interface). #47, #101
- Add example for loopback testing with real hardware. #69
- Implement
fmt::Debugandfmt::DisplayforSerialPortand related enums. #91
Changed
- Migrated from unmaintainted dependency
machtomach2. - Update dependency
nixfrom 0.24.1 to 0.26.0 and raise MSRV to 1.56.1. #67, #75, #78
Fixed
- Skip attempts to set baud rate 0 on macOS. #58
- Fix getting actual result value from
tiocmget. #61 - Fix serial number retrieval procedure on macOS. #65
- Fix port name retrieval procedure for Unicode names on Windows. #63
- Fix compilation for OpenBSD due to missing use declaration. #68
- A number of memory leaks have been addressed when using serialport-rs. #98
-
4.2.002 Jun 2022 withdrawnRelease notes
Open source →Added
- Add
serdesupport behind a feature flag. #51
Changed
- Request exclusive access when opening a POSIX serial port by default. #44
- Updated
nixdependency to 0.24.1 and limited features. #46 - Derive the
Clonetrait forError. #53 - Enumerate callout devices in addition to dial-in devices on macOS. #54
- Revert to edition 2018 to allow for use with older compiler versions.
Fixed
- Set port timeout to a non-zero value before performing loopback test. #45
- Add
-
4.1.004 Apr 2022Release notes
Open source →Added
- impl
SerialPortfor&mut T. This allows a&mut T (where T: SerialPort)to be used in a context whereimpl SerialPortis expected. !114
Changed
- Updated
nixdependency to 0.23.1. - Remove useless call to tcflush on open. #40
Fixed
- impl
-
4.0.117 Apr 2021Release notes
Open source →Changed
- Update maintenance status to looking for a new maintainer.
Fixed
- Properly initialize DCB structure on Windows. This fixes some non-functional devices. !97
-
4.0.018 Dec 2020Release notes
Open source →Added
- Added
send_break()toTTYPort. !69 - Enable
available_ports()for Linux musl targets and those without thelibudevfeature enabled by scanning/sys/for ports. !72 ENOENTandEACCESerrors are now exposed asNotFoundandPermissionDeniederrors on Linux. !80try_clone_native()was added toCOMPortandTTYPortto complementSerialPort::try_clone()but returning the concrete type instead. !85- Added
set_break()andclear_break()toSerialPort. !70
Changed
- Minimum supported Rust version is now 1.36.0 to support the
mem::MaybeUninitfeature. - The platform-specific
TTYPort/BreakDurationandCOMPortare now at the root level rather than under theposixandwindowssubmodules respectively. - Opening
SerialPorts now uses the builder pattern throughserialport::new(). See the README for concrete examples. !73 SerialPortss are no longer opened with a default timeout of 1ms.- Under linux, the
manufacturerandproductfields ofUsbPortInfonow take their values from theID_VENDOR_FROM_DATABASEandID_MODEL_FROM_DATABASEudev properties respectively, instead of theID_VENDORandID_MODELproperties that were used before. When the_FROM_DATABASEvalues are not available, it falls back to the old behavior. !86 - POSIX ports are no longer opened in exclusive mode. After opening they can be
made exclusive via
TTYPort::set_exclusive(). !98
Fixed
- Raised the version specification for
bitflagsto 1.0.4. Previously it was set to 1.0.0, but this version ofbitflagsis actually incompatible with Rust 2018 style macro imports thatserialport-rsrequires. !83
Removed
- Removed the
serialport::preludemodule. Types should be explicitly imported or can be glob-imported from the root likeuse serialport::*. !82
- Added
-
3.3.013 Jun 2019Release notes
Open source →Added
- Added support for arbitrary baud rates on macOS and iOS.
Changed
- Minimum supported Rust version is now 1.31 to support using the 2018 edition of Rust.
Fixed
- Upgraded
sparc64-unknown-linux-gnuto Tier 2 support.
-
3.2.002 Jan 2019Release notes
Open source →Added
- Port enumeration is now supported on FreeBSD.
Changed
- Minimum supported Rust version changed to 1.24.1.
- Made
aarch64-unknown-linux-musla Tier-2 supported target.
Fixed
- Fixed software flow control for POSIX systems. !54
Removed
- Removed support for
x86_64-unknown-linux-gnux32.
-
3.1.002 Nov 2018Release notes
Open source →Added
- Added
bytes_to_read(),bytes_to_write(), andclear()toSerialPort. Also added example scripts for using them. - Added Tier 2 support for:
armv5te-unknown-linux-musleabi
- Added "libudev" feature to allow for disabling linking to
libudevon Linux.
- Added
-
3.0.015 Jul 2018Release notes
Open source →Added
- Arbitrary baud rates are now supported on BSDs, Linux, and Windows.
- Added Tier 1 support for
{i586|i686|x86_64}-unknown-linux-musl. - Added Tier 2 support for:
{arm|armv7}-linux-androideabii686-linux-android{i686|x86_64}-unknown-freebsdarm-unknown-linux-musleabiarmv7-unknown-linux-musleabihf{mips64|mips64el}-unknown-linux-gnuabi64armv5te-unknown-linux-gnueabi{aarch64|mips|mipsel|powerpc64|powerpc64le|powerpc|s390x}-unknown-linux-gnu{mips|mipsel}-unknown-linux-muslx86_64-unknown-netbsd
- Added Tier 3 support for:
{aarch64|x86_64}-linux-androidaarch64-unknown-linux-muslsparc64-unknown-linux-gnu,x86_64-unknown-linux-gnux32
Changed
- Most port configuration methods now return a
Result<()>. - Renamed
SerialPort::port_name()toname().
Fixed
- On Windows, the
port_namefield onSerialPortInfoincluded an extraneous trailing nul byte character.
Removed
- The
BaudRateenum was removed in favor of au32.
-
2.3.014 Mar 2018Release notes
Open source →Added
- Added
examples/hardware_check.rsfor use in debugging library or driver issues when using physical serial ports. - Added
SerialPort::try_clonewhich allows for cloning a port for full-duplex reading and writing.
Changed
- Removed configuration caching for serial ports. The underlying implementations
for all platforms cached a configuration struct so that modifying the port
settings involved a single switch into kernel space. This has been removed so
now two system calls are needed for every configuration change. This is
probably a slight performance regression, but should allow the new
SerialPort::try_cloneinterface to work as people expect.
Fixed
TTYPort::into_raw_fdwill now work as expected. It previously closed the port so the returned file descriptor would be invalid.- 921600 baud is now supported on NetBSD and FreeBSD.
- Added
-
2.1.015 Feb 2018Release notes
Open source →Added
impl FromRawHandleforCOMPort.
Changed
- Specific IO-related errors are now returned instead of mapping every IO error to Unknown. This makes it possible to catch things like time-out errors.
- Changed all baud rates to be reported as the discrete
BaudRate::Baud*types rather than as theBaudRate::BaudOther(*)type.
Fixed
- Modem-type USB serial devices are now enumerated on macOS. This now allows connected Arduinos to be detected.
- Compilation on FreeBSD and NetBSD was fixed by removing the 921600 baud rates. These will be re-added in a future release.
-
2.0.019 Dec 2017Release notes
Open source →Added
- USB device information is now returned in calls to
available_ports(). - Serial port enumeration is now supported on Mac.
- Serial port enumeration now attempts to return the interface used for the port (USB, PCI, Bluetooth, Unknown).
BaudRate::standard_rates()provides a vector of cross-platform baud rates.SerialPorttrait is nowSend.
Changed
- Software license has changed from LGPLv3+ to MPL-2.0. This makes it possible to use this library in any Rust project if it's unmodified.
- Mac is now a Tier 2 supported platform.
- Removed
BaudRate::from_speed(usize)andBaudRate::speed -> usizein favor of theFrom<u32>andInto<u32>traits. - Removed
available_baud_ratesin favor ofBaudRate::platform_rates()as this has a more clear semantic meaning. The returned list of baud rates is now also correct for all supported platforms. - Removed
termiosdependency in favor ofnix. This is a big step towards supporting additional platforms.
Fixed
- Stop bits are now specified properly (had been reversed). Thanks to @serviushack. (MR#9)
TTYPort::pair()is now thread-safe.TTYPort::open()no longer leaks file descriptors if it errors. Thanks to @daniel. (MR#12)- Fixed compilation when targeting Android.
- USB device information is now returned in calls to
-
1.0.121 Feb 2017Release notes
Open source →Fixed
read()now properly blocks for at least one character.- Compilation now works on Mac.
-
1.0.014 Feb 2017Release notes
Open source →Changed
- Various documentation/README updates.
- Minor formatting fixes (from rustfmt).
Fixed
- Platform-specific examples are now only built on appropriate platforms.
-
0.9.009 Feb 2017Release notes
Open source →Added
impl DebugforCOMPort.exclusive()andset_exclusive()forTTYPort.port_name()forSerialPort.impl FromRawFdandimpl IntoRawFdforTTYPort.pair()forTTYPort.
-
0.3.028 Jan 2017Release notes
Open source →Added
open_with_settings()to support initializing the port with custom settings.SerialPortSettingsis now publically usable being exported in the prelude, having all public and commented fields, and aDefaultimpl.
Changed
TTYPort/COMPort::open()now take aSerialPortSettingsargument and return concrete types.serialport::open()now initializes the port to reasonable defaults.- Removed all instances of
try!()for?. SerialPort::set_all()now borrowsSerialPortSettings.
-
0.2.426 Jan 2017Release notes
Open source →Added
- Report an Unimplemented error for unsupported unix targets.
Changed
- Minor changes suggested by Clippy.
- Reworked Cargo.toml to more easily support additional targets.
Fixed
- AppVeyor badge should now be properly displayed.
-
0.2.321 Jan 2017 -
0.2.221 Jan 2017Release notes
Open source →- No changes, purely a version increment to push new crate metadata to crates.io.
-
0.2.121 Jan 2017 -
0.2.007 Jan 2017Release notes
Open source →Added
- Added a changelog.
- Added a getter/setter pair for all settings at once.
- An error is thrown if settings weren't correctly applied on POSIX.
-
0.1.124 Dec 2016Release notes
Open source →Changed
- Fixed compilation on x86_64-pc-windows-gnu target.
- Added contributors to README.
- Clarified license terms in the README.
-
0.1.023 Dec 2016