diff options
-rw-r--r-- | src/rhctl/serial_port.go | 10 |
1 files changed, 5 insertions, 5 deletions
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 |