Skip to content

Commit 6b06000

Browse files
committed
Add extra field to serial discovery targeting Tian board
1 parent de9bd89 commit 6b06000

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

arduino-core/src/processing/app/Platform.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,29 @@ public synchronized Map<String, Object> resolveDeviceByVendorIdProductId(String
236236
List<String> vids = new LinkedList<>(board.getPreferences().subTree("vid", 1).values());
237237
if (!vids.isEmpty()) {
238238
List<String> pids = new LinkedList<>(board.getPreferences().subTree("pid", 1).values());
239+
List<String> descriptors = new LinkedList<>(board.getPreferences().subTree("descriptor", 1).values());
239240
for (int i = 0; i < vids.size(); i++) {
240241
String vidPid = vids.get(i) + "_" + pids.get(i);
241242
if (vid_pid_iSerial.toUpperCase().contains(vidPid.toUpperCase())) {
243+
if (!descriptors.isEmpty()) {
244+
boolean matched = false;
245+
for (int j = 0; j < descriptors.size(); j++) {
246+
if (vid_pid_iSerial.toUpperCase().contains(descriptors.get(j).toUpperCase())) {
247+
matched = true;
248+
break;
249+
}
250+
}
251+
if (matched == false) {
252+
return null;
253+
}
254+
}
242255
Map<String, Object> boardData = new HashMap<>();
243256
boardData.put("board", board);
244257
boardData.put("vid", vids.get(i));
245258
boardData.put("pid", pids.get(i));
246-
boardData.put("iserial", vid_pid_iSerial.substring(vidPid.length()+1));
259+
String extrafields = vid_pid_iSerial.substring(vidPid.length()+1);
260+
String[] parts = extrafields.split("_");
261+
boardData.put("iserial", parts[0]);
247262
return boardData;
248263
}
249264
}

build/build.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<property name="portable" value="false" />
8787

8888
<property name="ARDUINO-BUILDER-VERSION" value="1.3.21_r1" />
89-
<property name="LIBLISTSERIAL-VERSION" value="1.2.0" />
89+
<property name="LIBLISTSERIAL-VERSION" value="1.3.0" />
9090
<property name="AVRGCC-VERSION" value="4.9.2-atmel3.5.3-arduino2" />
9191
<property name="AVRDUDE-VERSION" value="6.3.0-arduino6" />
9292

build/liblistSerials-1.2.0.zip.sha

-1
This file was deleted.

build/liblistSerials-1.3.0.zip.sha

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
519c768773ce02f75bf2418b49d9adf4609dee16

0 commit comments

Comments
 (0)