stty/README.md
2025-05-18 22:14:54 +03:00

37 lines
No EOL
920 B
Markdown

### The "STTY" package
This package provides simplified way to invoke **stty** utility to perform some
tasks by means of it. For now the only a few number of functions are implemented:
- set tty baudrate
- check tty baudrate
- test if selected baudrate is available for some tty
- test if a given file is a tty
-------------
### Usage
1. Download the package by **go get** command:
```shell
go get code.foilhatguy.casa/pub/stty
```
2. Import package to your golang code:
```go
import (
"code.foilhatguy.casa/pub/stty"
)
```
3. Test if some file is a tty:
```go
err := stty.ValidateTtyFile("/dev/ttyUSB0")
```
4. Use stty object to perform some tasks. For instance, test if baudrate of 9600
is available at **/dev/ttyUSB0**:
```go
err := stty.CMD().TestBaudRate("/dev/ttyUSB0", 9600)
```
If **stty** is not available, all methods of object returned by CMD() function
will return ERR_TTY_MISSING error.