uutils / uutils/coreutils

stty: support arbitrary baudrate (at least on linux) as GNU coreutils 9.8

Open
#8,719 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - stty
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

Feature request: implement the arbitrary serial baudrate settable with the stty tool like done in just-released GNU coreutils 9.8.

Glibc 2.42 + GNU coreutils 9.8 implemented setting arbitrary serial baudrate with the stty tool via
https://github.com/bminor/glibc/commit/5cf101a85aae0d703cdd8ed7b25fe288e41fdacb and https://github.com/coreutils/coreutils/commit/357fda90d15fd3f7dba61e1ab322b183a48d0081

This effectively means that commands like stty -F /dev/ttyS0 28800 and stty -F /dev/ttyXXXX 250000 now works (asusimng underlying hardware controller support those speeds).
It would be good to have this feature in rust uutils-coreutils too for compatibility and for practical reasons listed below.

This was a long-waited feature for relatively modern (compared to other tty features)) ) industrial applications. Usage examples:

  • Some non-standard devices operating on speeds like 250000
  • Some industrial handware vendors produce x86-64 PCs having extended 16650A-like hardware serial controllers (based on IT87xxx: Super I/O with UARTs or similar) that perform some non-stanadrd speed translation: with a "High-speed mode" setting in MoBo BIOS enabled, the 115200 limit of the "registers API" between kernel and 16650A is overcomed by treating the programmatically set speed 28800 as physical speed 28800*8=230400. So to get 230400 physical speed, the 28800 speed is set programmatically (all software and kernel sees it as 28800). That's strange design, but it is already produced in hardware for many years. And configuring 28800 speed just via stty without need coding python/C would be very helpful step to make this all a bit less mysterious.

This seems to be a bit related to glibc's baudrate API incomatibilities in https://github.com/uutils/coreutils/issues/8474

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing stty implementation and compare the linked glibc and GNU coreutils 9.8 commits to understand the arbitrary-baudrate behavior on Linux. Done means stty -F /dev/ttyS0 28800 and stty -F /dev/ttyXXXX 250000 work compatibly where the underlying system supports those speeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust
Domain
cli, operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.