Merge pull request #113 from cmaglie/fix-ppc64lebuild
Fixed build for linux/ppc64le
This commit is contained in:
1
.github/workflows/test.yaml
vendored
1
.github/workflows/test.yaml
vendored
@@ -46,6 +46,7 @@ jobs:
|
||||
- "openbsd amd64"
|
||||
- "openbsd 386"
|
||||
- "openbsd arm"
|
||||
- "linux ppc64le"
|
||||
|
||||
runs-on: "ubuntu-latest"
|
||||
|
||||
|
||||
@@ -83,15 +83,3 @@ func setTermSettingsBaudrate(speed int, settings *unix.Termios) (error, bool) {
|
||||
settings.Ospeed = toTermiosSpeedType(baudrate)
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func (port *unixPort) setSpecialBaudrate(speed uint32) error {
|
||||
settings, err := unix.IoctlGetTermios(port.handle, unix.TCGETS2)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
settings.Cflag &^= unix.CBAUD
|
||||
settings.Cflag |= unix.BOTHER
|
||||
settings.Ispeed = speed
|
||||
settings.Ospeed = speed
|
||||
return unix.IoctlSetTermios(port.handle, unix.TCSETS2, settings)
|
||||
}
|
||||
|
||||
24
serial_specialbaudrate_linux.go
Normal file
24
serial_specialbaudrate_linux.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// +build linux
|
||||
// +build !ppc64le
|
||||
|
||||
//
|
||||
// Copyright 2014-2021 Cristian Maglie. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
|
||||
package serial
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
func (port *unixPort) setSpecialBaudrate(speed uint32) error {
|
||||
settings, err := unix.IoctlGetTermios(port.handle, unix.TCGETS2)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
settings.Cflag &^= unix.CBAUD
|
||||
settings.Cflag |= unix.BOTHER
|
||||
settings.Ispeed = speed
|
||||
settings.Ospeed = speed
|
||||
return unix.IoctlSetTermios(port.handle, unix.TCSETS2, settings)
|
||||
}
|
||||
12
serial_specialbaudrate_linux_ppc64le.go
Normal file
12
serial_specialbaudrate_linux_ppc64le.go
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Copyright 2014-2021 Cristian Maglie. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
|
||||
package serial
|
||||
|
||||
func (port *unixPort) setSpecialBaudrate(speed uint32) error {
|
||||
// TODO: unimplemented
|
||||
return &PortError{code: InvalidSpeed}
|
||||
}
|
||||
Reference in New Issue
Block a user