Moved generated code into a separate file
This commit is contained in:
@@ -258,6 +258,8 @@ func setTermSettingsStopBits(bits StopBits, settings *syscall.Termios) error {
|
|||||||
|
|
||||||
// native syscall wrapper functions
|
// native syscall wrapper functions
|
||||||
|
|
||||||
|
//sys ioctl(fd int, req uint64, data uintptr) (err error)
|
||||||
|
|
||||||
func (port *linuxSerialPort) acquireExclusiveAccess() error {
|
func (port *linuxSerialPort) acquireExclusiveAccess() error {
|
||||||
return ioctl(port.handle, syscall.TIOCEXCL, 0)
|
return ioctl(port.handle, syscall.TIOCEXCL, 0)
|
||||||
}
|
}
|
||||||
@@ -276,13 +278,4 @@ func (port *linuxSerialPort) setTermSettings(settings *syscall.Termios) error {
|
|||||||
return ioctl(port.handle, syscall.TCSETS, uintptr(unsafe.Pointer(settings)))
|
return ioctl(port.handle, syscall.TCSETS, uintptr(unsafe.Pointer(settings)))
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint64, data uintptr) (err error)
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// vi:ts=2
|
// vi:ts=2
|
||||||
|
|||||||
21
syscall_linux.go
Normal file
21
syscall_linux.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
//
|
||||||
|
// Copyright 2014 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_linux.go
|
||||||
|
// The generated stub is modified to make it compile under the "serial" package
|
||||||
|
|
||||||
|
package serial
|
||||||
|
|
||||||
|
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