Skip to content

Fix bug about non arduino boards not showing up #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions seriallist_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ func removeNonArduinoBoards(ports []OsSerialPort) []OsSerialPort {
//log.Println(string(cmdOutput))
cmdOutSlice := strings.Split(string(cmdOutput), "\n")

var arduino_ports []OsSerialPort
var other_ports []OsSerialPort

// how many lines is the output? boards attached = lines/8
for i := 0; i < len(cmdOutSlice)/8; i++ {

Expand Down Expand Up @@ -62,22 +59,17 @@ func removeNonArduinoBoards(ports []OsSerialPort) []OsSerialPort {
if !strings.Contains(port.Name, "/cu") {
port.RelatedNames = append(port.RelatedNames, archBoardName)
port.FriendlyName = strings.Trim(boardName, "\n")
arduino_ports = append(arduino_ports, port)
} else {
other_ports = append(other_ports, port)
}
}
}
}

arduino_ports = append(arduino_ports, other_ports...)

// additional remove phase
arduino_ports = Filter(arduino_ports, func(port OsSerialPort) bool {
ports = Filter(ports, func(port OsSerialPort) bool {
return !strings.Contains(port.Name, "Blue") && !strings.Contains(port.Name, "/cu")
})

return arduino_ports
return ports
}

func getList() ([]OsSerialPort, os.SyscallError) {
Expand Down
9 changes: 1 addition & 8 deletions seriallist_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ func removeNonArduinoBoards(ports []OsSerialPort) []OsSerialPort {
cmdOutSlice = append(cmdOutSlice, re.FindString(element))
}

var arduino_ports, other_ports []OsSerialPort

for _, element := range cmdOutSlice {

if element == "" {
Expand All @@ -60,16 +58,11 @@ func removeNonArduinoBoards(ports []OsSerialPort) []OsSerialPort {
if strings.Contains(element, strings.Trim(cmdOutput2S, "\n")) && cmdOutput2S != "" {
port.RelatedNames = append(port.RelatedNames, archBoardName)
port.FriendlyName = strings.Trim(boardName, "\n")
arduino_ports = append(arduino_ports, port)
} else {
other_ports = append(other_ports, port)
}
}
}

arduino_ports = append(arduino_ports, other_ports...)

return arduino_ports
return ports
}

func getList() ([]OsSerialPort, os.SyscallError) {
Expand Down