feat: add ttyHS support for linux

Signed-off-by: Ancient Xu <ancientxu@gmail.com>
This commit is contained in:
Ancient Xu
2023-08-08 18:17:02 +08:00
parent e381f2c133
commit 10b7b3e7af
2 changed files with 3 additions and 3 deletions

View File

@@ -9,7 +9,7 @@ package serial
import "golang.org/x/sys/unix" import "golang.org/x/sys/unix"
const devFolder = "/dev" const devFolder = "/dev"
const regexFilter = "(ttyS|ttyUSB|ttyACM|ttyAMA|rfcomm|ttyO|ttymxc)[0-9]{1,3}" const regexFilter = "(ttyS|ttyHS|ttyUSB|ttyACM|ttyAMA|rfcomm|ttyO|ttymxc)[0-9]{1,3}"
// termios manipulation functions // termios manipulation functions

View File

@@ -313,8 +313,8 @@ func nativeGetPortsList() ([]string, error) {
portName := devFolder + "/" + f.Name() portName := devFolder + "/" + f.Name()
// Check if serial port is real or is a placeholder serial port "ttySxx" // Check if serial port is real or is a placeholder serial port "ttySxx" or "ttyHSxx"
if strings.HasPrefix(f.Name(), "ttyS") { if strings.HasPrefix(f.Name(), "ttyS") || strings.HasPrefix(f.Name(), "ttyHS") {
port, err := nativeOpen(portName, &Mode{}) port, err := nativeOpen(portName, &Mode{})
if err != nil { if err != nil {
continue continue