Skip to content

Commit ebac06c

Browse files
Match port properties case insensitively in board list
This allows both uppercase and lowercase properties (e.g. vid and pid) from boards.txt and matches what the Java IDE does: https://github.com/arduino/Arduino/blob/5e30bec23/arduino-core/src/cc/arduino/packages/BoardPort.java#L185
1 parent 0bf48ae commit ebac06c

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

arduino/cores/packagemanager/identify.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package packagemanager
1717

1818
import (
1919
"fmt"
20+
"strings"
2021

2122
"github.com/arduino/arduino-cli/arduino/cores"
2223
properties "github.com/arduino/go-properties-orderedmap"
@@ -34,7 +35,7 @@ func (pm *PackageManager) IdentifyBoard(idProps *properties.Map) []*cores.Board
3435
if !ok {
3536
return false, false
3637
}
37-
if v1 != v2 {
38+
if !strings.EqualFold(v1, v2) {
3839
return true, false
3940
}
4041
}

arduino/cores/packagemanager/package_manager_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,4 +316,7 @@ func TestIdentifyBoard(t *testing.T) {
316316
require.Equal(t, "[test:avr:c]", fmt.Sprintf("%v", identify("0x9999", "0x0004")))
317317
// https://github.com/arduino/arduino-cli/issues/456
318318
require.Equal(t, "[test:avr:d]", fmt.Sprintf("%v", identify("0x9999", "0x0005")))
319+
// Check mixed case
320+
require.Equal(t, "[test:avr:e]", fmt.Sprintf("%v", identify("0xAB00", "0xcd00")))
321+
require.Equal(t, "[test:avr:e]", fmt.Sprintf("%v", identify("0xab00", "0xCD00")))
319322
}

arduino/cores/packagemanager/testdata/custom_hardware/test/avr/boards.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ c.pid.1=0x0004
1515
d.name=Board D
1616
d.vid.1=0x9999
1717
d.pid.1=0x0005
18+
19+
e.name=Board E
20+
e.vid.1=0xAB00
21+
e.pid.1=0xcd00

0 commit comments

Comments
 (0)