in main.go [114:130]
func firstSerialDevice(devPaths []string) string {
serialDeviceNode := func(p string) bool {
if stat, err := os.Stat(p); err == nil {
return stat.Mode()&fs.ModeCharDevice == fs.ModeCharDevice
}
return false
}
for _, devPath := range devPaths {
if serialDeviceNode(devPath) {
return devPath
}
}
// no suitable device found
return ""
}