Skip to content

Match port properties (e.g. USB vid/pid) case insensitively against board.txt values (in e.g. board list) #945

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
Sep 15, 2020
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
3 changes: 2 additions & 1 deletion arduino/cores/packagemanager/identify.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package packagemanager

import (
"fmt"
"strings"

"github.com/arduino/arduino-cli/arduino/cores"
properties "github.com/arduino/go-properties-orderedmap"
Expand All @@ -34,7 +35,7 @@ func (pm *PackageManager) IdentifyBoard(idProps *properties.Map) []*cores.Board
if !ok {
return false, false
}
if v1 != v2 {
if !strings.EqualFold(v1, v2) {
return true, false
}
}
Expand Down
3 changes: 3 additions & 0 deletions arduino/cores/packagemanager/package_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,4 +316,7 @@ func TestIdentifyBoard(t *testing.T) {
require.Equal(t, "[test:avr:c]", fmt.Sprintf("%v", identify("0x9999", "0x0004")))
// https://github.com/arduino/arduino-cli/issues/456
require.Equal(t, "[test:avr:d]", fmt.Sprintf("%v", identify("0x9999", "0x0005")))
// Check mixed case
require.Equal(t, "[test:avr:e]", fmt.Sprintf("%v", identify("0xAB00", "0xcd00")))
require.Equal(t, "[test:avr:e]", fmt.Sprintf("%v", identify("0xab00", "0xCD00")))
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ c.pid.1=0x0004
d.name=Board D
d.vid.1=0x9999
d.pid.1=0x0005

e.name=Board E
e.vid.1=0xAB00
e.pid.1=0xcd00