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

working on #223: Auto-detection of serial ports. Mac version ready even if a bit slow

This commit is contained in:
Federico Fissore
2013-01-28 18:21:41 +01:00
parent 776952762f
commit 0d47f22787
11 changed files with 365 additions and 23 deletions

View File

@@ -0,0 +1,21 @@
package processing.app;
import java.io.*;
public class TestHelper {
public static String inputStreamToString(InputStream is) throws IOException {
StringWriter sw = new StringWriter();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line;
try {
while ((line = reader.readLine()) != null) {
sw.append(line).append('\n');
}
return sw.toString();
} finally {
is.close();
}
}
}

View File

@@ -0,0 +1,16 @@
package processing.app.linux;
import org.junit.Test;
import processing.app.TestHelper;
import static org.junit.Assert.assertEquals;
public class UDevAdmParserTest {
@Test
public void shouldCorrectlyParse() throws Exception {
String output = TestHelper.inputStreamToString(UDevAdmParserTest.class.getResourceAsStream("udev_output.txt"));
assertEquals("2341_0036", new UDevAdmParser().extractVIDAndPID(output));
}
}

View File

@@ -0,0 +1,24 @@
DEVLINKS=/dev/arduino_leonardo /dev/serial/by-id/usb-Arduino_LLC_Arduino_Leonardo-if00 /dev/serial/by-path/pci-0000:00:14.0-usb-0:2.3:1.0
DEVNAME=/dev/ttyACM0
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2.3/3-2.3:1.0/tty/ttyACM0
ID_BUS=usb
ID_MM_CANDIDATE=1
ID_MODEL=Arduino_Leonardo
ID_MODEL_ENC=Arduino\x20Leonardo
ID_MODEL_ID=0036
ID_PATH=pci-0000:00:14.0-usb-0:2.3:1.0
ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_3_1_0
ID_REVISION=0001
ID_SERIAL=Arduino_LLC_Arduino_Leonardo
ID_TYPE=generic
ID_USB_DRIVER=cdc_acm
ID_USB_INTERFACES=:020201:0a0000:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=Arduino_LLC
ID_VENDOR_ENC=Arduino\x20LLC
ID_VENDOR_ID=2341
MAJOR=166
MINOR=0
SUBSYSTEM=tty
UDEV_LOG=3
USEC_INITIALIZED=21035594802

View File

@@ -0,0 +1,17 @@
package processing.app.macosx;
import org.junit.Test;
import processing.app.TestHelper;
import static org.junit.Assert.assertEquals;
public class SystemProfilerParserTest {
@Test
public void shouldCorrectlyParse() throws Exception {
String output = TestHelper.inputStreamToString(SystemProfilerParserTest.class.getResourceAsStream("system_profiler_output.txt"));
assertEquals("2341_0044", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodemfa121"));
assertEquals("2341_0044", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodemfa121"));
}
}

View File

@@ -0,0 +1,134 @@
USB:
USB High-Speed Bus:
Host Controller Location: Built-in USB
Host Controller Driver: AppleUSBEHCI
PCI Device ID: 0x1c2d
PCI Revision ID: 0x0005
PCI Vendor ID: 0x8086
Bus Number: 0xfa
Hub:
Product ID: 0x2513
Vendor ID: 0x0424 (SMSC)
Version: b.b3
Speed: Up to 480 Mb/sec
Location ID: 0xfa100000 / 2
Current Available (mA): 500
Current Required (mA): 2
Trans-It Drive:
Capacity: 3.99 GB (3,992,977,408 bytes)
Removable Media: Yes
Detachable Drive: Yes
BSD Name: disk1
Product ID: 0x0622
Vendor ID: 0x0718 (Imation Corp.)
Version: 1.10
Serial Number: 0792181A2BDD
Speed: Up to 480 Mb/sec
Manufacturer: TDKMedia
Location ID: 0xfa130000 / 6
Current Available (mA): 500
Current Required (mA): 300
Partition Map Type: MBR (Master Boot Record)
S.M.A.R.T. status: Not Supported
Volumes:
Untitled:
Capacity: 3.99 GB (3,990,379,520 bytes)
Available: 1.99 GB (1,986,838,528 bytes)
Writable: Yes
File System: MS-DOS FAT32
BSD Name: disk1s1
Mount Point: /Volumes/Untitled
Content: Windows_FAT_32
Arduino Mega ADK:
Product ID: 0x0044
Vendor ID: 0x2341
Version: 0.01
Serial Number: 64936333936351500000
Speed: Up to 12 Mb/sec
Manufacturer: Arduino (www.arduino.cc)
Location ID: 0xfa120000 / 5
Current Available (mA): 500
Current Required (mA): 100
BRCM20702 Hub:
Product ID: 0x4500
Vendor ID: 0x0a5c (Broadcom Corp.)
Version: 1.00
Speed: Up to 12 Mb/sec
Manufacturer: Apple Inc.
Location ID: 0xfa110000 / 3
Current Available (mA): 500
Current Required (mA): 94
Bluetooth USB Host Controller:
Product ID: 0x8281
Vendor ID: 0x05ac (Apple Inc.)
Version: 0.97
Speed: Up to 12 Mb/sec
Manufacturer: Apple Inc.
Location ID: 0xfa113000 / 4
Current Available (mA): 500
Current Required (mA): 0
USB High-Speed Bus:
Host Controller Location: Built-in USB
Host Controller Driver: AppleUSBEHCI
PCI Device ID: 0x7ffc00001c26
PCI Revision ID: 0x7ffc00000005
PCI Vendor ID: 0x7ffc00008086
Bus Number: 0xfd
Hub:
Product ID: 0x2513
Vendor ID: 0x0424 (SMSC)
Version: b.b3
Speed: Up to 480 Mb/sec
Location ID: 0xfd100000 / 2
Current Available (mA): 500
Current Required (mA): 2
USB Multimedia Keyboard:
Product ID: 0xc311
Vendor ID: 0x046d (Logitech Inc.)
Version: 1.30
Speed: Up to 1.5 Mb/sec
Manufacturer: BTC
Location ID: 0xfd120000 / 5
Current Available (mA): 500
Current Required (mA): 100
USB-PS/2 Optical Mouse:
Product ID: 0xc050
Vendor ID: 0x046d (Logitech Inc.)
Version: 27.20
Speed: Up to 1.5 Mb/sec
Manufacturer: Logitech
Location ID: 0xfd130000 / 4
Current Available (mA): 500
Current Required (mA): 98
IR Receiver:
Product ID: 0x8242
Vendor ID: 0x05ac (Apple Inc.)
Version: 0.16
Speed: Up to 1.5 Mb/sec
Manufacturer: Apple Computer, Inc.
Location ID: 0xfd110000 / 3
Current Available (mA): 500
Current Required (mA): 100