From e9d6068037e7ff2b8c7a006fb01b482b0b7de409 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 25 Mar 2016 01:35:43 +0100 Subject: some cleanup diff --git a/src/rhctl/serial_port.go b/src/rhctl/serial_port.go index e4b2c46..9f3f3f6 100644 --- a/src/rhctl/serial_port.go +++ b/src/rhctl/serial_port.go @@ -47,7 +47,7 @@ type SerialPort struct { tx chan<- string } -func SerialRead(c chan<- string, port *sio.Port) { +func serialReader(c chan<- string, port *sio.Port) { scanner := bufio.NewScanner(port) scanner.Split(bufio.ScanLines) for scanner.Scan() { @@ -62,7 +62,7 @@ func SerialRead(c chan<- string, port *sio.Port) { } } -func SerialWrite(c <-chan string, port *sio.Port, newline string) { +func serialWriter(c <-chan string, port *sio.Port, newline string) { for data := range c { port.Write([]byte(data + newline)) } @@ -74,10 +74,10 @@ func SerialOpenAndHandle(device string, speed Baudrate, newline string) (port *S if port.port, err = sio.Open(device, uint32(speed)); err != nil { return } - tx := make(chan string, 1) + tx := make(chan string, 10) rx := make(chan string, 20) - go SerialRead(rx, port.port) - go SerialWrite(tx, port.port, newline) + go serialReader(rx, port.port) + go serialWriter(tx, port.port, newline) port.rx = rx port.tx = tx -- cgit v0.10.2