Merge branch 'v0' into v1
This commit is contained in:
@@ -18,7 +18,6 @@ env:
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- env: TEST_OS=freebsd TEST_ARCH=amd64
|
||||
- env: TEST_OS=dragonfly TEST_ARCH=amd64
|
||||
|
||||
before_install:
|
||||
|
||||
58
serial_freebsd.go
Normal file
58
serial_freebsd.go
Normal file
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// Copyright 2014-2016 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 "go.bug.st/serial.v1"
|
||||
|
||||
import "syscall"
|
||||
|
||||
const devFolder = "/dev"
|
||||
const regexFilter = "^(cu|tty)\\..*"
|
||||
|
||||
// termios manipulation functions
|
||||
|
||||
var baudrateMap = map[int]int{
|
||||
0: syscall.B9600, // Default to 9600
|
||||
50: syscall.B50,
|
||||
75: syscall.B75,
|
||||
110: syscall.B110,
|
||||
134: syscall.B134,
|
||||
150: syscall.B150,
|
||||
200: syscall.B200,
|
||||
300: syscall.B300,
|
||||
600: syscall.B600,
|
||||
1200: syscall.B1200,
|
||||
1800: syscall.B1800,
|
||||
2400: syscall.B2400,
|
||||
4800: syscall.B4800,
|
||||
9600: syscall.B9600,
|
||||
19200: syscall.B19200,
|
||||
38400: syscall.B38400,
|
||||
57600: syscall.B57600,
|
||||
115200: syscall.B115200,
|
||||
230400: syscall.B230400,
|
||||
}
|
||||
|
||||
var databitsMap = map[int]int{
|
||||
0: syscall.CS8, // Default to 8 bits
|
||||
5: syscall.CS5,
|
||||
6: syscall.CS6,
|
||||
7: syscall.CS7,
|
||||
8: syscall.CS8,
|
||||
}
|
||||
|
||||
const tcCMSPAR int = 0 // may be CMSPAR or PAREXT
|
||||
const tcIUCLC int = 0
|
||||
|
||||
func termiosMask(data int) uint32 {
|
||||
return uint32(data)
|
||||
}
|
||||
|
||||
// syscall wrappers
|
||||
|
||||
//sys ioctl(fd int, req uint64, data uintptr) (err error)
|
||||
|
||||
const ioctlTcgetattr = syscall.TIOCGETA
|
||||
const ioctlTcsetattr = syscall.TIOCSETA
|
||||
@@ -4,7 +4,7 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
|
||||
// +build linux darwin
|
||||
// +build linux darwin freebsd
|
||||
|
||||
package serial // import "go.bug.st/serial.v1"
|
||||
|
||||
|
||||
21
syscall_freebsd.go
Normal file
21
syscall_freebsd.go
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Copyright 2014-2016 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.
|
||||
//
|
||||
|
||||
// This file is machine generated by the command:
|
||||
// mksyscall.pl serial_darwin.go
|
||||
// The generated stub is modified to make it compile under the "serial" package
|
||||
|
||||
package serial // import "go.bug.st/serial.v1"
|
||||
|
||||
import "syscall"
|
||||
|
||||
func ioctl(fd int, req uint64, data uintptr) (err error) {
|
||||
_, _, e1 := syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(data))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user