uintptr (ttyfd), uintptr (TCGETS),
uintptr (unsafe.Pointer (dst)));
- if err := os.NewSyscallError ("SYS_IOCTL", errno); err != nil {
+ if err := os.NewSyscallError ("SYS_IOCTL", errno); errno!=0 && err != nil {
return err
}
if r1 != 0 {
- return errors.New("Error")
+ // return errors.New("Error")
}
return nil
uintptr (ttyfd), uintptr (TCSETS),
uintptr (unsafe.Pointer (src)));
- if err := os.NewSyscallError ("SYS_IOCTL", errno); err != nil {
+ if err := os.NewSyscallError ("SYS_IOCTL", errno); errno!=0 &&err != nil {
return err
}
)
defer func () {
- if err != nil { fmt.Println (err) }
+ if err != nil { fmt.Printf ("SetRaw Error: %v\n",err) }
} ();
if err = getTermios (&orig_termios); err != nil { return }
import "io"
import "termios"
import "flag"
+import "regexp"
var cmdHandler = map[string]func([]string,string,*bufio.ReadWriter ) {
"test":handleCmdTest,
//rw.Flush()
return "",nil
}
- return line,nil
+ reg := regexp.MustCompile("\r")
+ safe := reg.ReplaceAllString(line, "")
+ return safe,nil
}
func connToReadWriter(c io.Reader,cw io.Writer) (*bufio.ReadWriter) {
fmt.Printf("Error in read from serial: %v\n",err.Error())
os.Exit(1)
}
- fmt.Printf("Serial: Read %v\n",s);
+ //fmt.Printf("Serial: Read %v\n",s);
c<-s
}
}
func SerialHandler(serial_i chan string) {
for {
- fmt.Printf("Serial said: %v\n",<-serial_i);
+ fmt.Printf("Serial Read: %s\n",<-serial_i);
}
}
func main() {