1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

partly revert commit 3c16ac02 to pass legacy tests

all this code will be replaced/removed as soon as the native library is fully validated
This commit is contained in:
Martino Facchin 2016-01-07 15:47:04 +01:00
parent d3f96c6143
commit 4fa57be5c7
3 changed files with 3 additions and 9 deletions

View File

@ -12,13 +12,8 @@ public class UDevAdmParser {
Object vid = properties.get("ID_VENDOR_ID");
Object pid = properties.get("ID_MODEL_ID");
Object serial = properties.get("ID_SERIAL_SHORT");
if (vid == null || pid == null)
return null;
if (serial == null) {
serial = "";
}
return ("0x" + vid + "_0x" + pid).toUpperCase() + "_" + serial;
return ("0x" + vid + "_0x" + pid).toUpperCase();
}
}

View File

@ -81,7 +81,7 @@ public class SystemProfilerParser {
String computedDevicePathMinusChar = computedDevicePath.substring(0, computedDevicePath.length() - 1);
String serialMinusChar = serial.substring(0, serial.length() - 1);
if (computedDevicePath.equalsIgnoreCase(serial) || computedDevicePathMinusChar.equalsIgnoreCase(serialMinusChar)) {
return (device.get(VID) + "_" + device.get(PID)).toUpperCase() + "_" + device.get(SERIAL_NUMBER);
return (device.get(VID) + "_" + device.get(PID)).toUpperCase();
}
}
device = new HashMap<>();

View File

@ -59,9 +59,8 @@ public class ListComPortsParser {
String vidPidPart = lineParts[lineParts.length - 1];
Matcher vidMatcher = vidRegExp.matcher(vidPidPart);
Matcher pidMatcher = pidRegExp.matcher(vidPidPart);
String iSerial = vidPidPart.substring(vidPidPart.lastIndexOf("\\")+1);
if (vidMatcher.find() && pidMatcher.find()) {
return ("0x" + vidMatcher.group(1) + "_0x" + pidMatcher.group(1)).toUpperCase() + "_" + iSerial;
return ("0x" + vidMatcher.group(1) + "_0x" + pidMatcher.group(1)).toUpperCase();
}
}
}