Auto merged - #2677 at Wed, 08 Dec 2021 11:17:12 GMT
[BUG-FIX] Fix Port Detection using VID/PID10.8-maintenance
commit
9b080c3d64
|
@ -105,6 +105,10 @@
|
|||
"message": "Set connection timeout to allow longer initialisation on device plugin or reboot",
|
||||
"description": "Change timeout on auto-connect and reboot so the bus has more time to initialize after being detected by the system"
|
||||
},
|
||||
"showAllSerialDevices": {
|
||||
"message": "Show all serial devices (for manufacturers or development)",
|
||||
"description": "Do not filter serial devices using VID/PID values (for manufacturers or development)"
|
||||
},
|
||||
"cordovaForceComputerUI": {
|
||||
"message": "Use computers interface instead of phones interface"
|
||||
},
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -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,24 @@ const serial = {
|
|||
}
|
||||
},
|
||||
getDevices: function (callback) {
|
||||
const self = this;
|
||||
|
||||
chrome.serial.getDevices(function (devices_array) {
|
||||
const devices = [];
|
||||
let showAllSerialDevices = false;
|
||||
|
||||
devices_array.forEach(function (device) {
|
||||
devices.push({
|
||||
path: device.path,
|
||||
displayName: device.displayName,
|
||||
});
|
||||
ConfigStorage.get('showAllSerialDevices', res => showAllSerialDevices = res.showAllSerialDevices);
|
||||
const isKnownSerialDevice = self.serialDevices.some(el => el.vendorId === device.vendorId) && self.serialDevices.some(el => el.productId === device.productId);
|
||||
|
||||
if (isKnownSerialDevice || showAllSerialDevices) {
|
||||
devices.push({
|
||||
path: device.path,
|
||||
displayName: device.displayName,
|
||||
vendorId: device.vendorId,
|
||||
productId: device.productId,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
callback(devices);
|
||||
|
|
|
@ -15,6 +15,7 @@ options.initialize = function (callback) {
|
|||
TABS.options.initAnalyticsOptOut();
|
||||
TABS.options.initCliAutoComplete();
|
||||
TABS.options.initAutoConnectConnectionTimeout();
|
||||
TABS.options.initShowAllSerialDevices();
|
||||
TABS.options.initCordovaForceComputerUI();
|
||||
TABS.options.initDarkTheme();
|
||||
|
||||
|
@ -133,6 +134,17 @@ options.initAutoConnectConnectionTimeout = function () {
|
|||
});
|
||||
};
|
||||
|
||||
options.initShowAllSerialDevices = function() {
|
||||
const showAllSerialDevicesElement = $('div.showAllSerialDevices input');
|
||||
ConfigStorage.get('showAllSerialDevices', result => {
|
||||
showAllSerialDevicesElement
|
||||
.prop('checked', !!result.showAllSerialDevices)
|
||||
.on('change', () => ConfigStorage.set({ showAllSerialDevices: showAllSerialDevicesElement.is(':checked') }))
|
||||
.trigger('change');
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
options.initCordovaForceComputerUI = function () {
|
||||
if (GUI.isCordova() && cordovaUI.canChangeUI) {
|
||||
ConfigStorage.get('cordovaForceComputerUI', function (result) {
|
||||
|
|
|
@ -46,6 +46,12 @@
|
|||
</select>
|
||||
<span i18n="connectionTimeout"></span>
|
||||
</div>
|
||||
<div class="showAllSerialDevices margin-bottom">
|
||||
<div>
|
||||
<input type="checkbox" class="toggle" />
|
||||
</div>
|
||||
<span class="freelabel" i18n="showAllSerialDevices"></span>
|
||||
</div>
|
||||
<div class="cordovaForceComputerUI margin-bottom">
|
||||
<div>
|
||||
<input type="checkbox" class="toggle" />
|
||||
|
|
Loading…
Reference in New Issue