Skip to content

Commit 87642c7

Browse files
committed
Inlined call to 'write' and removed the function
1 parent fc30b2b commit 87642c7

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

serial.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,15 @@ func (sh *serialhub) run() {
101101
sh.mu.Unlock()
102102
case wr := <-sh.write:
103103
// if user sent in the commands as one text mode line
104-
write(wr)
104+
switch wr.buffer {
105+
case "send":
106+
wr.p.sendBuffered <- wr.d
107+
case "sendnobuf":
108+
wr.p.sendNoBuf <- []byte(wr.d)
109+
case "sendraw":
110+
wr.p.sendRaw <- wr.d
111+
}
112+
// no default since we alredy verified in spWrite()
105113
}
106114
}
107115
}
@@ -120,18 +128,6 @@ func (sh *serialhub) FindPortByName(portname string) (*serport, bool) {
120128
return nil, false
121129
}
122130

123-
func write(wr writeRequest) {
124-
switch wr.buffer {
125-
case "send":
126-
wr.p.sendBuffered <- wr.d
127-
case "sendnobuf":
128-
wr.p.sendNoBuf <- []byte(wr.d)
129-
case "sendraw":
130-
wr.p.sendRaw <- wr.d
131-
}
132-
// no default since we alredy verified in spWrite()
133-
}
134-
135131
// List broadcasts a Json representation of the ports found
136132
func (sp *SerialPortList) List() {
137133
sp.portsLock.Lock()

0 commit comments

Comments
 (0)