@@ -147,20 +147,12 @@ func (sp *SerialPortList) Update() {
147
147
// Empty port list if they can not be detected
148
148
ports = []* OsSerialPort {}
149
149
}
150
- list := spListDual (ports )
151
150
152
- serialPorts .portsLock .Lock ()
153
- serialPorts .Ports = list
154
- serialPorts .portsLock .Unlock ()
155
- }
156
-
157
- func spListDual (list []* OsSerialPort ) []SpPortItem {
158
151
// we have a full clean list of ports now. iterate thru them
159
152
// to append the open/close state, baud rates, etc to make
160
153
// a super clean nice list to send back to browser
161
- spl := []SpPortItem {}
162
-
163
- for _ , item := range list {
154
+ list := []SpPortItem {}
155
+ for _ , item := range ports {
164
156
port := SpPortItem {
165
157
Name : item .Name ,
166
158
SerialNumber : item .ISerial ,
@@ -181,9 +173,12 @@ func spListDual(list []*OsSerialPort) []SpPortItem {
181
173
port .Baud = myport .portConf .Baud
182
174
port .BufferAlgorithm = myport .BufferType
183
175
}
184
- spl = append (spl , port )
176
+ list = append (list , port )
185
177
}
186
- return spl
178
+
179
+ serialPorts .portsLock .Lock ()
180
+ serialPorts .Ports = list
181
+ serialPorts .portsLock .Unlock ()
187
182
}
188
183
189
184
func spErr (err string ) {
0 commit comments