@@ -236,14 +236,29 @@ public synchronized Map<String, Object> resolveDeviceByVendorIdProductId(String
236
236
List <String > vids = new LinkedList <>(board .getPreferences ().subTree ("vid" , 1 ).values ());
237
237
if (!vids .isEmpty ()) {
238
238
List <String > pids = new LinkedList <>(board .getPreferences ().subTree ("pid" , 1 ).values ());
239
+ List <String > descriptors = new LinkedList <>(board .getPreferences ().subTree ("descriptor" , 1 ).values ());
239
240
for (int i = 0 ; i < vids .size (); i ++) {
240
241
String vidPid = vids .get (i ) + "_" + pids .get (i );
241
242
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
+ }
242
255
Map <String , Object > boardData = new HashMap <>();
243
256
boardData .put ("board" , board );
244
257
boardData .put ("vid" , vids .get (i ));
245
258
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 ]);
247
262
return boardData ;
248
263
}
249
264
}
0 commit comments