diff options
Diffstat (limited to 'src/rhctl/serial_port.go')
-rw-r--r-- | src/rhctl/serial_port.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rhctl/serial_port.go b/src/rhctl/serial_port.go index e8bfd92..e4b2c46 100644 --- a/src/rhctl/serial_port.go +++ b/src/rhctl/serial_port.go @@ -62,14 +62,14 @@ func SerialRead(c chan<- string, port *sio.Port) { } } -func SerialWrite(c <-chan string, port *sio.Port) { +func SerialWrite(c <-chan string, port *sio.Port, newline string) { for data := range c { - port.Write([]byte(data)) + port.Write([]byte(data + newline)) } port.Close() } -func SerialOpenAndHandle(device string, speed Baudrate) (port *SerialPort, err error) { +func SerialOpenAndHandle(device string, speed Baudrate, newline string) (port *SerialPort, err error) { port = &SerialPort{} if port.port, err = sio.Open(device, uint32(speed)); err != nil { return @@ -77,7 +77,7 @@ func SerialOpenAndHandle(device string, speed Baudrate) (port *SerialPort, err e tx := make(chan string, 1) rx := make(chan string, 20) go SerialRead(rx, port.port) - go SerialWrite(tx, port.port) + go SerialWrite(tx, port.port, newline) port.rx = rx port.tx = tx |