Skip to content

Commit

Permalink
feat: Added some additional serial port baud rates
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonRust committed Jan 10, 2025
0 parents commit 7a70c99
Show file tree
Hide file tree
Showing 32 changed files with 3,375 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
platform:
- x64
- x86

environment:
matrix:
- RUST_VERSION: stable
VENDOR: gnu
- RUST_VERSION: stable
VENDOR: msvc
- RUST_VERSION: 1.16.0
VENDOR: gnu
- RUST_VERSION: 1.16.0
VENDOR: msvc
- RUST_VERSION: beta
VENDOR: gnu
- RUST_VERSION: beta
VENDOR: msvc

install:
- ps: |
if ($env:PLATFORM -eq "x86") {
$arch = "i686"
}
else {
$arch = "x86_64"
}
if ($env:RUST_VERSION -eq "stable") {
Start-FileDownload "https://static.rust-lang.org/dist/channel-rust-stable" -FileName "channel-rust-stable"
$installer = Get-Content "channel-rust-stable" | Select-String -Pattern "$arch-pc-windows-${env:VENDOR}.exe"
}
else {
$installer = "rust-${env:RUST_VERSION}-$arch-pc-windows-${env:VENDOR}.exe"
}
Start-FileDownload "https://static.rust-lang.org/dist/$installer" -FileName rust-install.exe
- rust-install.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
- SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin
- rustc -V
- cargo -V

build: false

test_script:
- "cargo build --verbose --package serial-core"
- "cargo test --verbose --package serial-core"
- "cargo build --verbose --package serial-windows"
- "cargo test --verbose --package serial-windows"
- "cargo build --verbose --package serial"
- "cargo test --verbose --package serial"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
Cargo.lock
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
language: rust
os:
- linux
- osx
rust:
- 1.16.0
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
script:
- "cargo build --verbose --package serial-core"
- "cargo test --verbose --package serial-core"
- "cargo build --verbose --package serial-unix"
- "cargo test --verbose --package serial-unix"
- "cargo build --verbose --package serial"
- "cargo test --verbose --package serial"
144 changes: 144 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Change Log

## 0.4.0 (2017-07-01)
### Changed
* Split implementation into multiple crates:
* [`serial-core`](serial-core) contains core abstractions.
* [`serial-unix`](serial-unix) provides Unix implementation.
* [`serial-windows`](serial-windows) provides Windows implementation.
* [`serial`](serial) provides cross-platform interface.
* Renamed `serial::posix` module to `serial::unix`.

### Removed
* Removed implementation of `Default` for `PortSettings`.

### Fixed
* Fixed bugs in the Windows implementation that did not reset parity, binary, or DTR control
settings.

## 0.3.4 (2016-06-01)
### Fixed
* ([#16](https://github.com/dcuddeback/serial-rs/issues/16))
Added missing `Send` implementation for Windows COM ports.
* ([#18](https://github.com/dcuddeback/serial-rs/issues/18))
Fixed bug to allow opening non-standard Windows COM ports by name.
* ([#27](https://github.com/dcuddeback/serial-rs/issues/18))
Added missing `Debug` implementation for Unix TTY port settings.

## 0.3.3 (2016-03-20)
### Added
* Added support for OpenBSD.
* ([#10](https://github.com/dcuddeback/serial-rs/issues/10))
Added support for OS-specific baud rates for termios-based serial ports.
* ([#10](https://github.com/dcuddeback/serial-rs/issues/10))
Added `BaudRate::from_speed()` constructor.

## 0.3.2 (2015-11-05)
### Changed
* Upgraded `libc` dependency to v0.2.

## 0.3.0 (2015-10-15)
### Added
* Added support for FreeBSD.

### Changed
* Replaced dependence on `time` crate with `std::time`.
* Minimum supported version of Rust is now 1.3.0.

## 0.2.1 (2015-10-03)
### Added
* ([#7](https://github.com/dcuddeback/serial-rs/issues/7))
Added `SystemPort` type alias for native serial port type.

## 0.2.0 (2015-06-21)
### Added
* Added `SerialDevice` trait as implementation trait for new serial port types. All types that
implement `SerialDevice` will automatically implement `SerialPort`.
* Added new `ErrorKind` variant: `NoDevice`.

### Changed
* Changed `reconfigure()` method to be object-safe and moved from `SerialPortExt` to `SerialPort`.
* Changed return type of `serial::open()` from `io::Result` to `serial::Result`.
* Improved usefulness of errors returned by many methods by explicitly handling system error codes
and using system error descriptions.

### Removed
* Removed methods from `SerialPort` trait that required knowledge of the port's `Settings` type.
Removed methods are `read_settings()` and `write_settings()`. They are still available via
`SerialDevice`.
* Removed `SerialPortExt` trait.

### Fixed
* ([#4](https://github.com/dcuddeback/serial-rs/issues/4))
Made `SerialPort` usable as a trait object. `SerialPort` objects can now be boxed as
`Box<SerialPort>`.

## 0.1.3 (2015-06-06)
### Added
* Added support for control signals to `SerialPort` trait. RTS and DTR control signals are settable.
CTS, DSR, RI, and CD signals are readable.
* Implemented control signals for Unix TTY devices.
* Implemented control signals for Windows COM ports.

## 0.1.2 (2015-06-02)
### Fixed
* ([#5](https://github.com/dcuddeback/serial-rs/issues/5))
Fixed bug that kept PTY devices created with `socat` locked after closing device.

## 0.1.1 (2015-05-26)
### Added
* When opening Unix TTY ports, they are now locked for exclusive access with `TIOCEXL` ioctl.

## 0.1.0 (2015-05-25)
### Added
* Added support for stable release channel.
* Added `serial::Error` type to represent errors.
* Added `SerialPort::configure()` method to configure port directly from a `PortSettings` object.
* Implemented `AsRawFd` for Unix TTY ports.
* Implemented `AsRawHandle` for Windows COM ports.

### Changed
* Renamed `SerialPort::settings()` to `SerialPort::read_settings()`.
* Renamed `SerialPort::apply_settings()` to `SerialPort::write_settings()`.
* Changed `io::Result` return types to `serial::Result`.
* Returning `serial::Result` from `SerialPort::set_timeout()` to allow function to perform I/O.
* Changed return type of `SerialPortSettings` getter methods to `Option<T>`, so undetermined
settings can be represented as `None`.
* Changed return type of `SerialPortSettings::set_baud_rate()` to `serial::Result` to allow the
method to return an error for unsupported baud rates.

### Removed
* Removed uncommon baud rates: 50, 75, 134, 150, 200, 1800, and 230400 (still available with
`BaudOther`).

## 0.0.5 (2015-04-17)
### Added
* Added support for Windows COM ports.
* Added cross-platform function `serial::open()` for opening system serial ports.

### Changed
* Return `io::Result` from `SerialPort::settings()`.

## 0.0.4 (2015-04-12)
### Changed
* Replaced use of built-in `libc` crate with `libc` package from crates.io.
* ([#1](https://github.com/dcuddeback/serial-rs/issues/1))
Replaced use of unstable `std::time` module with `time` package from crates.io.

### Fixed
* Updated to support Rust 1.0.0-beta compiler.

## 0.0.3 (2015-04-03)
### Fixed
* Updated to support latest Rust nightly compiler.

## 0.0.2 (2015-03-29)
### Changed
* Migrated to new `std::io` module form `std::old_io`.

### Fixed
* Updated to support latest Rust nightly compiler.

## 0.0.1 (2015-03-28)
### Added
* Basic support for Unix TTY devices.
13 changes: 13 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[workspace]
members = ["serial-rs-core", "serial-rs-unix", "serial-rs-windows", "serial-rs"]
resolver = "2"

[workspace.package]
version = "0.4.1"
edition = "2021"
rust-version = "1.74.0"
license = "MIT"
categories = ["hardware-support", "os"]
homepage = "https://github.com/EchoRust/serial-rs"
keywords = ["dotenv", "env", "environment", "settings", "config"]
repository = "https://github.com/EchoRust/serial-rs"
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2015 David Cuddeback

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Serial-rs

A well-maintained fork of the [Serial](https://github.com/dcuddeback/serial-rs) crate.

The serial port crates provide Rust interfaces for working with serial ports. Serial ports are
defined as traits to support extension through custom implementations.

**NOTE**: With the release of `serial-rs` v0.4, the implementation is now split into several crates.
While the new organization is still experimental, the `serial-rs` crate reexports many of the types so
that it's mostly backward-compatible with v0.3.

* [Change Log](CHANGELOG.md)

## Usage
### In Libraries
Libraries should link to [`serial-rs-core`](serial-rs-core/).

### In Executables
Executables should choose a serial port implementation.
A cross platform implementation is provided in the [`serial-rs`](serial-rs/) crate.

## Contributors
* [dcuddeback](https://github.com/dcuddeback)
* [willem66745](https://github.com/willem66745)
* [apoloval](https://github.com/apoloval)
* [Leon](https://github.com/LyonRust)

## License
Copyright © 2015 David Cuddeback

Distributed under the [MIT License](LICENSE).
18 changes: 18 additions & 0 deletions serial-rs-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "serial-rs-core"
version = "0.4.1"
edition = "2021"
authors = [
"David Cuddeback <[email protected]>",
"Leon <[email protected]>",
]
description = "Rust abstractions for serial ports."
homepage = "https://github.com/EchoRust/serial-rs"
repository = "https://github.com/EchoRust/serial-rs"
license = "MIT"
readme = "README.md"
keywords = ["serial", "hardware", "system", "RS232"]
categories = ["hardware-support"]

[dependencies]
libc = "0.2"
1 change: 1 addition & 0 deletions serial-rs-core/LICENSE
Loading

0 comments on commit 7a70c99

Please sign in to comment.