Skip to content

Commit

Permalink
gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarmigan Casebolt committed Mar 3, 2011
1 parent cd09eda commit 5fa411c
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions serial_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type SError struct {
msg string
}

func (e SError) String() (string) {
func (e SError) String() string {
return e.msg
}

Expand All @@ -23,7 +23,7 @@ func OpenPort(name string, baud int) (f *os.File, err os.Error) {
if err != nil {
return
}

fd := C.int(f.Fd())

var st C.struct_termios
Expand All @@ -47,7 +47,7 @@ func OpenPort(name string, baud int) (f *os.File, err os.Error) {
st.c_cflag |= (C.CLOCAL | C.CREAD)

// Select raw mode
st.c_lflag &= ^C.tcflag_t(C.ICANON|C.ECHO|C.ECHOE|C.ISIG)
st.c_lflag &= ^C.tcflag_t(C.ICANON | C.ECHO | C.ECHOE | C.ISIG)
st.c_oflag &= ^C.tcflag_t(C.OPOST)

_, err = C.tcsetattr(fd, C.TCSANOW, &st)
Expand All @@ -57,27 +57,27 @@ func OpenPort(name string, baud int) (f *os.File, err os.Error) {
}

fmt.Println("Tweaking", name)
r1, _, e := syscall.Syscall(syscall.SYS_FCNTL,
uintptr(f.Fd()),
uintptr(syscall.F_SETFL),
uintptr(0))
if e != 0 || r1 != 0 {
s := fmt.Sprint("Clearing NONBLOCK syscall error:", e, r1)
r1, _, e := syscall.Syscall(syscall.SYS_FCNTL,
uintptr(f.Fd()),
uintptr(syscall.F_SETFL),
uintptr(0))
if e != 0 || r1 != 0 {
s := fmt.Sprint("Clearing NONBLOCK syscall error:", e, r1)
f.Close()
return nil, SError{s}
}
}

/*
r1, _, e = syscall.Syscall(syscall.SYS_IOCTL,
uintptr(f.Fd()),
uintptr(0x80045402), // IOSSIOSPEED
uintptr(unsafe.Pointer(&baud)));
if e != 0 || r1 != 0 {
s := fmt.Sprint("Baudrate syscall error:", e, r1)
f.Close()
return nil, SError{s}
}
*/
r1, _, e = syscall.Syscall(syscall.SYS_IOCTL,
uintptr(f.Fd()),
uintptr(0x80045402), // IOSSIOSPEED
uintptr(unsafe.Pointer(&baud)));
if e != 0 || r1 != 0 {
s := fmt.Sprint("Baudrate syscall error:", e, r1)
f.Close()
return nil, SError{s}
}
*/

return
}
}

0 comments on commit 5fa411c

Please sign in to comment.