Precompile port-filter regexp

This commit is contained in:
Cristian Maglie
2024-02-20 15:24:08 +01:00
parent bcd8695df4
commit 14e5ea68ce
5 changed files with 29 additions and 14 deletions

View File

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