Support usb discovery on Mac
This commit is contained in:
Родитель
ca340a9f85
Коммит
01c78ea4de
|
@ -153,9 +153,9 @@ var onDeviceDiscovered = function(record) {
|
||||||
break;
|
break;
|
||||||
case 'usb-uart':
|
case 'usb-uart':
|
||||||
console.log(
|
console.log(
|
||||||
rpad(record.com_name, 22),
|
rpad(record.com_name, 28),
|
||||||
rpad(record.device_name_or_manufacturer, 40),
|
rpad(record.device_name_or_manufacturer, 40),
|
||||||
rpad(deviceInfoStr || '?', 48)
|
rpad(deviceInfoStr || '?', 46)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -194,7 +194,7 @@ function cmd_list_usb_uart() {
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log('USB Devices:');
|
console.log('USB Devices:');
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log(rpad('COM Port', 22), rpad('Device Name\\Manufacturer', 40), rpad('Device Type (Friendly Name)', 48));
|
console.log(rpad('COM Port', 28), rpad('Device Name\\Manufacturer', 40), rpad('Device Type (Friendly Name)', 46));
|
||||||
console.log('');
|
console.log('');
|
||||||
UsbUartTransport.beginDiscovery(onDeviceDiscovered);
|
UsbUartTransport.beginDiscovery(onDeviceDiscovered);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
# for Intel Edison
|
# for Intel Edison
|
||||||
USB\VID_8087&PID_0A9E&MI_02\ Intel Edison Virtual Com Port edison
|
USB\VID_8087&PID_0A9E&MI_02\ Intel Edison Virtual Com Port edison
|
||||||
USB\VID_8087&PID_0A9E\ Intel Edison USB Composite Device edison
|
USB\VID_8087&PID_0A9E\ Intel Edison USB Composite Device edison
|
||||||
|
FTDIBUS\VID_0403+PID_6001+ USB Serial Port edison
|
||||||
# for Huzzah Feather ESP8266
|
# for Huzzah Feather ESP8266
|
||||||
USB\VID_10C4&PID_EA60\ Silicon Labs CP210x USB to UART Bridge huzzah
|
USB\VID_10C4&PID_EA60\ Silicon Labs CP210x USB to UART Bridge huzzah
|
||||||
# for Adafruit Feather M0
|
# for Adafruit Feather M0
|
||||||
|
@ -21,3 +22,14 @@ usb-Silicon_Labs_CP2104_USB_to_UART_Bridge_Controller_ Silicon Labs CP210x USB t
|
||||||
usb-Adafruit_Feather_ USB Serial Device adafruit_feather_m0_usb
|
usb-Adafruit_Feather_ USB Serial Device adafruit_feather_m0_usb
|
||||||
# for SparkFun ESP8266 Thing
|
# for SparkFun ESP8266 Thing
|
||||||
usb-FTDI_FT231X_USB_UART_ USB Serial Port thingdev
|
usb-FTDI_FT231X_USB_UART_ USB Serial Port thingdev
|
||||||
|
|
||||||
|
# for Mac
|
||||||
|
# for Intel Edison
|
||||||
|
usb-VID_8087&PID_0a9e Intel Edison Virtual Com Port edison
|
||||||
|
usb-VID_0403&PID_6001 USB Serial Port edison
|
||||||
|
# for Huzzah Feather ESP8266
|
||||||
|
usb-VID_10c4&PID_ea60 Silicon Labs CP210x USB to UART Bridge huzzah
|
||||||
|
# for Adafruit Feather M0
|
||||||
|
usb-VID_239a&PID_800b USB Serial Device adafruit_feather_m0_usb
|
||||||
|
# for SparkFun ESP8266 Thing
|
||||||
|
usb-VID_0403&PID_6015 USB Serial Port thingdev
|
||||||
|
|
|
|
@ -9,9 +9,13 @@ exports.beginDiscovery = function beginDiscovery(callback) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ports.forEach(function(port) {
|
ports.forEach(function(port) {
|
||||||
var deviceName = UsbLookup.resolveUsbName(port.pnpId);
|
var pnpId = port.pnpId;
|
||||||
|
if(!pnpId && port.vendorId && port.productId){
|
||||||
|
pnpId = 'usb-VID_' + port.vendorId.split('0x')[1] + '&PID_' + port.productId.split('0x')[1];
|
||||||
|
}
|
||||||
|
var deviceName = UsbLookup.resolveUsbName(pnpId);
|
||||||
|
var deviceType = UsbLookup.resolveDeviceType(pnpId);
|
||||||
var deviceNameOrManufacturer = deviceName ? deviceName : port.manufacturer;
|
var deviceNameOrManufacturer = deviceName ? deviceName : port.manufacturer;
|
||||||
var deviceType = UsbLookup.resolveDeviceType(port.pnpId);
|
|
||||||
(function(com_name, device_name_or_manufacturer, device_type) {
|
(function(com_name, device_name_or_manufacturer, device_type) {
|
||||||
if(com_name && device_name_or_manufacturer) {
|
if(com_name && device_name_or_manufacturer) {
|
||||||
var record = {
|
var record = {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче