1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-22 08:22:04 +03:00

Trying to fix macosx system_profiler parser

This commit is contained in:
Federico Fissore
2013-10-21 18:34:38 +02:00
parent 0732d5afcd
commit 59de784e9f
3 changed files with 175 additions and 5 deletions

View File

@ -51,7 +51,14 @@ public class SystemProfilerParser {
if ((matcher = serialNumberRegex.matcher(line)).matches()) {
device.put(SERIAL_NUMBER, matcher.group(1));
} else if ((matcher = locationRegex.matcher(line)).matches()) {
device.put(DEVICE_PATH, devicePrefix + matcher.group(1).substring(2, 6) + "1");
String devicePath = devicePrefix;
String suffix = matcher.group(1).substring(2, 6);
try {
devicePath = devicePath + (Integer.parseInt(suffix) + 1);
} catch (NumberFormatException e) {
devicePath = devicePath + suffix + "1";
}
device.put(DEVICE_PATH, devicePath);
} else if ((matcher = pidRegex.matcher(line)).matches()) {
device.put(PID, matcher.group(1));
} else if ((matcher = vidRegex.matcher(line)).matches()) {