summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-03-25 00:35:43 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-03-25 00:35:43 (GMT)
commite9d6068037e7ff2b8c7a006fb01b482b0b7de409 (patch)
treefa0c556f6be9ab531ee83c356cf966d255f1af15
parent5554f1b3f82340fe0157b4094e23bbb669829b5d (diff)
some cleanup
-rw-r--r--src/rhctl/serial_port.go10
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