Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hedhyw/go-serial-detector
A go library for determining active serial ports.
https://github.com/hedhyw/go-serial-detector
go go-library golang linux procfs serial serial-ports sysfs udev
Last synced: 2 months ago
JSON representation
A go library for determining active serial ports.
- Host: GitHub
- URL: https://github.com/hedhyw/go-serial-detector
- Owner: hedhyw
- License: apache-2.0
- Created: 2018-05-18T15:36:51.000Z (over 6 years ago)
- Default Branch: development
- Last Pushed: 2022-01-11T04:06:17.000Z (almost 3 years ago)
- Last Synced: 2024-10-12T03:11:51.008Z (3 months ago)
- Topics: go, go-library, golang, linux, procfs, serial, serial-ports, sysfs, udev
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 14
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go-Serial-Detector
This is a package that allows you to list active serial ports:
- `/dev/ttyS*`;
- `/dev/ttyUSB*`.In linux systems information is obtained from `udev`, `sysfs` or `procfs`.
# OS support
This package currently supports only linux systems.
# Usage
```golang
import (
"log""github.com/hedhyw/Go-Serial-Detector/pkg/v1/serialdet"
)if list, err := serialdet.List(); err == nil {
for _, p := range list {
// p.Description():
// returns short information about serial port.
// p.Path():
// returns path to device, for example: "/dev/ttyUSB1".
log.Print(p.Description(), " ", p.Path())
}
}```
# How to get
`go get github.com/hedhyw/Go-Serial-Detector/pkg/v1/serialdet`