@@ -38,9 +38,9 @@ type OsSerialPort struct {
38
38
}
39
39
40
40
// enumerateSerialPorts will return the OS serial port
41
- func enumerateSerialPorts () ([]OsSerialPort , error ) {
41
+ func enumerateSerialPorts () ([]* OsSerialPort , error ) {
42
42
// will timeout in 2 seconds
43
- arrPorts := []OsSerialPort {}
43
+ arrPorts := []* OsSerialPort {}
44
44
ports , err := enumerator .GetDetailedPortsList ()
45
45
if err != nil {
46
46
return arrPorts , err
@@ -53,14 +53,19 @@ func enumerateSerialPorts() ([]OsSerialPort, error) {
53
53
vidString := fmt .Sprintf ("0x%s" , vid )
54
54
pidString := fmt .Sprintf ("0x%s" , pid )
55
55
if vid != "0000" && pid != "0000" {
56
- arrPorts = append (arrPorts , OsSerialPort {Name : element .Name , IDVendor : vidString , IDProduct : pidString , ISerial : element .SerialNumber })
56
+ arrPorts = append (arrPorts , & OsSerialPort {
57
+ Name : element .Name ,
58
+ IDVendor : vidString ,
59
+ IDProduct : pidString ,
60
+ ISerial : element .SerialNumber ,
61
+ })
57
62
}
58
63
}
59
64
}
60
65
61
66
// see if we should filter the list
62
67
if portsFilter != nil {
63
- arrPorts = slices .DeleteFunc (arrPorts , func (port OsSerialPort ) bool {
68
+ arrPorts = slices .DeleteFunc (arrPorts , func (port * OsSerialPort ) bool {
64
69
match := portsFilter .MatchString (port .Name )
65
70
if ! match {
66
71
log .Debugf ("ignoring port not matching filter. port: %v\n " , port )
0 commit comments