This commit is contained in:
Dong Zhao 2016-09-13 19:36:57 +08:00
Родитель ca340a9f85
Коммит 01c78ea4de
3 изменённых файлов: 21 добавлений и 5 удалений

Просмотреть файл

@ -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

1 # USB mapping
4 USB\VID_8087&PID_0A9E&MI_02\ Intel Edison Virtual Com Port edison
5 USB\VID_8087&PID_0A9E\ Intel Edison USB Composite Device edison
6 # for Huzzah Feather ESP8266 FTDIBUS\VID_0403+PID_6001+ USB Serial Port edison
7 # for Huzzah Feather ESP8266
8 USB\VID_10C4&PID_EA60\ Silicon Labs CP210x USB to UART Bridge huzzah
9 # for Adafruit Feather M0
10 USB\VID_239A&PID_800B&MI_00\ USB Serial Device adafruit_feather_m0_usb
22 usb-FTDI_FT231X_USB_UART_ USB Serial Port thingdev
23 # for Mac
24 # for Intel Edison
25 usb-VID_8087&PID_0a9e Intel Edison Virtual Com Port edison
26 usb-VID_0403&PID_6001 USB Serial Port edison
27 # for Huzzah Feather ESP8266
28 usb-VID_10c4&PID_ea60 Silicon Labs CP210x USB to UART Bridge huzzah
29 # for Adafruit Feather M0
30 usb-VID_239a&PID_800b USB Serial Device adafruit_feather_m0_usb
31 # for SparkFun ESP8266 Thing
32 usb-VID_0403&PID_6015 USB Serial Port thingdev
33
34
35

Просмотреть файл

@ -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 = {