diff --git a/src/js/port_handler.js b/src/js/port_handler.js index 298dffc9..2b534420 100644 --- a/src/js/port_handler.js +++ b/src/js/port_handler.js @@ -3,8 +3,8 @@ const TIMEOUT_CHECK = 500 ; // With 250 it seems that it produces a memory leak and slowdown in some versions, reason unknown const usbDevices = { filters: [ - {'vendorId': 1155, 'productId': 57105}, - {'vendorId': 10473, 'productId': 393}, + {'vendorId': 1155, 'productId': 57105}, // STM Device in DFU Mode || Digital Radio in USB mode + {'vendorId': 10473, 'productId': 393}, // GD32 DFU Bootloader ] }; const PortHandler = new function () { diff --git a/src/js/serial.js b/src/js/serial.js index 009634cd..a555f1a6 100644 --- a/src/js/serial.js +++ b/src/js/serial.js @@ -15,6 +15,14 @@ const serial = { transmitting: false, outputBuffer: [], + serialDevices: [ + {'vendorId': 1027, 'productId': 24577}, // FT232R USB UART + {'vendorId': 1155, 'productId': 22336}, // STM Electronics Virtual COM Port + {'vendorId': 4292, 'productId': 60000}, // CP210x + {'vendorId': 4292, 'productId': 60001}, // CP210x + {'vendorId': 4292, 'productId': 60002}, // CP210x + ], + connect: function (path, options, callback) { const self = this; const testUrl = path.match(/^tcp:\/\/([A-Za-z0-9\.-]+)(?:\:(\d+))?$/); @@ -258,13 +266,21 @@ const serial = { } }, getDevices: function (callback) { + const self = this; + chrome.serial.getDevices(function (devices_array) { const devices = []; devices_array.forEach(function (device) { - devices.push({ - path: device.path, - displayName: device.displayName, - }); + const isFC = self.serialDevices.some(el => el.vendorId === device.vendorId) && self.serialDevices.some(el => el.productId === device.productId); + + if (isFC) { + devices.push({ + path: device.path, + displayName: device.displayName, + vendorId: device.vendorId, + productId: device.productId, + }); + } }); callback(devices);