Skip to content

Revert "Fix bug about non arduino boards not showing up" #10

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 25, 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: 10 additions & 2 deletions seriallist_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ 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 @@ -59,17 +62,22 @@ 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
ports = Filter(ports, func(port OsSerialPort) bool {
arduino_ports = Filter(arduino_ports, func(port OsSerialPort) bool {
return !strings.Contains(port.Name, "Blue") && !strings.Contains(port.Name, "/cu")
})

return ports
return arduino_ports
}

func getList() ([]OsSerialPort, os.SyscallError) {
Expand Down
9 changes: 8 additions & 1 deletion seriallist_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ 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 @@ -58,11 +60,16 @@ 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)
}
}
}

return ports
arduino_ports = append(arduino_ports, other_ports...)

return arduino_ports
}

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