Avoid calling GetModemStatusBits on Android. Should fix #1
This commit is contained in:
14
cts.go
Normal file
14
cts.go
Normal file
@@ -0,0 +1,14 @@
|
||||
//go:build !android
|
||||
|
||||
package main
|
||||
|
||||
import "github.com/albenik/go-serial/v2"
|
||||
|
||||
// cts returns the clear-to-send status of a device. On Android it will return true as GetModemStatusBits() fails there.
|
||||
func cts(p *serial.Port) (bool, error) {
|
||||
r, err := p.GetModemStatusBits()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return r.CTS, nil
|
||||
}
|
Reference in New Issue
Block a user