You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
399 B
22 lines
399 B
|
2 months ago
|
//go:build linux
|
||
|
|
|
||
|
|
package serial
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
"io"
|
||
|
|
|
||
|
|
"golang.org/x/sys/unix"
|
||
|
|
)
|
||
|
|
|
||
|
|
func platformSendSerialBreak(device io.ReadWriteCloser) error {
|
||
|
|
provider, ok := device.(interface{ Fd() uintptr })
|
||
|
|
if !ok {
|
||
|
|
return errorsUnsupportedSerialBreak()
|
||
|
|
}
|
||
|
|
if err := unix.IoctlSetInt(int(provider.Fd()), unix.TCSBRK, 0); err != nil {
|
||
|
|
return fmt.Errorf("send serial break: %w", err)
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
}
|