Skip to content

Commit 0d8e12d

Browse files
author
Federico Fissore
committed
OSX workaround for board autodetection #223
1 parent c4823cc commit 0d8e12d

File tree

3 files changed

+158
-6
lines changed

3 files changed

+158
-6
lines changed

app/src/processing/app/macosx/SystemProfilerParser.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,8 @@ public String extractVIDAndPID(String output, String serial) throws IOException
5252
device.put(SERIAL_NUMBER, matcher.group(1));
5353
} else if ((matcher = locationRegex.matcher(line)).matches()) {
5454
String devicePath = devicePrefix;
55-
String suffix = matcher.group(1).substring(2, 6);
56-
try {
57-
devicePath = devicePath + (Integer.parseInt(suffix) + 1);
58-
} catch (NumberFormatException e) {
59-
devicePath = devicePath + suffix + "1";
60-
}
55+
String suffix = matcher.group(1).substring(2, 6).replaceAll("0", "");
56+
devicePath = devicePath + suffix + "1";
6157
device.put(DEVICE_PATH, devicePath);
6258
} else if ((matcher = pidRegex.matcher(line)).matches()) {
6359
device.put(PID, matcher.group(1));

app/test/processing/app/macosx/SystemProfilerParserTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,10 @@ public void shouldCorrectlyParse() throws Exception {
3838

3939
assertEquals("0X2341_0X8041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodem1421"));
4040
assertEquals("0X2341_0X8041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodem1421"));
41+
42+
output = TestHelper.inputStreamToString(SystemProfilerParserTest.class.getResourceAsStream("system_profiler_output7.txt"));
43+
44+
assertEquals("0X2341_0X8036", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodem24131"));
45+
assertEquals("0X2341_0X8036", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodem24131"));
4146
}
4247
}
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
USB:
2+
3+
USB Hi-Speed Bus:
4+
5+
Host Controller Location: Built-in USB
6+
Host Controller Driver: AppleUSBEHCI
7+
PCI Device ID: 0x0d9d
8+
PCI Revision ID: 0x00a2
9+
PCI Vendor ID: 0x10de
10+
Bus Number: 0x26
11+
12+
Internal Memory Card Reader:
13+
14+
Product ID: 0x8403
15+
Vendor ID: 0x05ac (Apple Inc.)
16+
Version: 98,33
17+
Serial Number: 9833
18+
Speed: Up to 480 Mb/sec
19+
Manufacturer: Apple
20+
Location ID: 0x26100000 / 2
21+
Current Available (mA): 500
22+
Current Required (mA): 500
23+
24+
USB Hi-Speed Bus:
25+
26+
Host Controller Location: Built-in USB
27+
Host Controller Driver: AppleUSBEHCI
28+
PCI Device ID: 0x0d9d
29+
PCI Revision ID: 0x00a2
30+
PCI Vendor ID: 0x10de
31+
Bus Number: 0x24
32+
33+
USB 2.0 Hub:
34+
35+
Product ID: 0x0101
36+
Vendor ID: 0x1a40 (TERMINUS TECHNOLOGY INC.)
37+
Version: 1,11
38+
Speed: Up to 480 Mb/sec
39+
Location ID: 0x24100000 / 3
40+
Current Available (mA): 500
41+
Current Required (mA): 100
42+
43+
FT230X Basic UART:
44+
45+
Product ID: 0x6015
46+
Vendor ID: 0x0403 (Future Technology Devices International Limited)
47+
Version: 10,00
48+
Serial Number: DN0031EV
49+
Speed: Up to 12 Mb/sec
50+
Manufacturer: FTDI
51+
Location ID: 0x24120000 / 7
52+
Current Available (mA): 500
53+
Current Required (mA): 90
54+
55+
Arduino Leonardo:
56+
57+
Product ID: 0x8036
58+
Vendor ID: 0x2341
59+
Version: 1,00
60+
Speed: Up to 12 Mb/sec
61+
Manufacturer: Arduino LLC
62+
Location ID: 0x24130000 / 6
63+
Current Available (mA): 500
64+
Current Required (mA): 500
65+
66+
USB Receiver:
67+
68+
Product ID: 0xc521
69+
Vendor ID: 0x046d (Logitech Inc.)
70+
Version: 57,01
71+
Speed: Up to 1.5 Mb/sec
72+
Manufacturer: Logitech
73+
Location ID: 0x24140000 / 5
74+
Current Available (mA): 500
75+
Current Required (mA): 98
76+
77+
Built-in iSight:
78+
79+
Product ID: 0x8507
80+
Vendor ID: 0x05ac (Apple Inc.)
81+
Version: 4,35
82+
Serial Number: 8JA9E1A6TDCLNL00
83+
Speed: Up to 480 Mb/sec
84+
Manufacturer: Apple Inc.
85+
Location ID: 0x24600000 / 2
86+
Current Available (mA): 500
87+
Current Required (mA): 500
88+
89+
USB Bus:
90+
91+
Host Controller Location: Built-in USB
92+
Host Controller Driver: AppleUSBOHCI
93+
PCI Device ID: 0x0d9c
94+
PCI Revision ID: 0x00a1
95+
PCI Vendor ID: 0x10de
96+
Bus Number: 0x06
97+
98+
BRCM2046 Hub:
99+
100+
Product ID: 0x4500
101+
Vendor ID: 0x0a5c (Broadcom Corp.)
102+
Version: 1,00
103+
Speed: Up to 12 Mb/sec
104+
Manufacturer: Apple Inc.
105+
Location ID: 0x06600000 / 4
106+
Current Available (mA): 500
107+
Current Required (mA): 0
108+
109+
Bluetooth USB Host Controller:
110+
111+
Product ID: 0x8213
112+
Vendor ID: 0x05ac (Apple Inc.)
113+
Version: 2,06
114+
Serial Number: C8BCC8B0B471
115+
Speed: Up to 12 Mb/sec
116+
Manufacturer: Apple Inc.
117+
Location ID: 0x06610000 / 5
118+
Current Available (mA): 500
119+
Current Required (mA): 0
120+
121+
IR Receiver:
122+
123+
Product ID: 0x8242
124+
Vendor ID: 0x05ac (Apple Inc.)
125+
Version: 0,16
126+
Speed: Up to 1.5 Mb/sec
127+
Manufacturer: Apple Computer, Inc.
128+
Location ID: 0x06500000 / 3
129+
Current Available (mA): 500
130+
Current Required (mA): 100
131+
132+
Apple Internal Keyboard / Trackpad:
133+
134+
Product ID: 0x0237
135+
Vendor ID: 0x05ac (Apple Inc.)
136+
Version: 0,90
137+
Speed: Up to 12 Mb/sec
138+
Manufacturer: Apple Inc.
139+
Location ID: 0x06300000 / 2
140+
Current Available (mA): 500
141+
Current Required (mA): 40
142+
143+
USB Bus:
144+
145+
Host Controller Location: Built-in USB
146+
Host Controller Driver: AppleUSBOHCI
147+
PCI Device ID: 0x0d9c
148+
PCI Revision ID: 0x00a1
149+
PCI Vendor ID: 0x10de
150+
Bus Number: 0x04
151+

0 commit comments

Comments
 (0)