mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-26 01:35:28 +03:00
Auto merged - #2677 at Wed, 08 Dec 2021 11:17:12 GMT
[BUG-FIX] Fix Port Detection using VID/PID
This commit is contained in:
commit
9b080c3d64
5 changed files with 47 additions and 6 deletions
|
@ -105,6 +105,10 @@
|
||||||
"message": "Set connection timeout to allow longer initialisation on device plugin or reboot",
|
"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"
|
"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": {
|
"cordovaForceComputerUI": {
|
||||||
"message": "Use computers interface instead of phones interface"
|
"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 TIMEOUT_CHECK = 500 ; // With 250 it seems that it produces a memory leak and slowdown in some versions, reason unknown
|
||||||
|
|
||||||
const usbDevices = { filters: [
|
const usbDevices = { filters: [
|
||||||
{'vendorId': 1155, 'productId': 57105},
|
{'vendorId': 1155, 'productId': 57105}, // STM Device in DFU Mode || Digital Radio in USB mode
|
||||||
{'vendorId': 10473, 'productId': 393},
|
{'vendorId': 10473, 'productId': 393}, // GD32 DFU Bootloader
|
||||||
] };
|
] };
|
||||||
|
|
||||||
const PortHandler = new function () {
|
const PortHandler = new function () {
|
||||||
|
|
|
@ -15,6 +15,14 @@ const serial = {
|
||||||
transmitting: false,
|
transmitting: false,
|
||||||
outputBuffer: [],
|
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) {
|
connect: function (path, options, callback) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const testUrl = path.match(/^tcp:\/\/([A-Za-z0-9\.-]+)(?:\:(\d+))?$/);
|
const testUrl = path.match(/^tcp:\/\/([A-Za-z0-9\.-]+)(?:\:(\d+))?$/);
|
||||||
|
@ -258,13 +266,24 @@ const serial = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getDevices: function (callback) {
|
getDevices: function (callback) {
|
||||||
|
const self = this;
|
||||||
|
|
||||||
chrome.serial.getDevices(function (devices_array) {
|
chrome.serial.getDevices(function (devices_array) {
|
||||||
const devices = [];
|
const devices = [];
|
||||||
|
let showAllSerialDevices = false;
|
||||||
|
|
||||||
devices_array.forEach(function (device) {
|
devices_array.forEach(function (device) {
|
||||||
devices.push({
|
ConfigStorage.get('showAllSerialDevices', res => showAllSerialDevices = res.showAllSerialDevices);
|
||||||
path: device.path,
|
const isKnownSerialDevice = self.serialDevices.some(el => el.vendorId === device.vendorId) && self.serialDevices.some(el => el.productId === device.productId);
|
||||||
displayName: device.displayName,
|
|
||||||
});
|
if (isKnownSerialDevice || showAllSerialDevices) {
|
||||||
|
devices.push({
|
||||||
|
path: device.path,
|
||||||
|
displayName: device.displayName,
|
||||||
|
vendorId: device.vendorId,
|
||||||
|
productId: device.productId,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
callback(devices);
|
callback(devices);
|
||||||
|
|
|
@ -15,6 +15,7 @@ options.initialize = function (callback) {
|
||||||
TABS.options.initAnalyticsOptOut();
|
TABS.options.initAnalyticsOptOut();
|
||||||
TABS.options.initCliAutoComplete();
|
TABS.options.initCliAutoComplete();
|
||||||
TABS.options.initAutoConnectConnectionTimeout();
|
TABS.options.initAutoConnectConnectionTimeout();
|
||||||
|
TABS.options.initShowAllSerialDevices();
|
||||||
TABS.options.initCordovaForceComputerUI();
|
TABS.options.initCordovaForceComputerUI();
|
||||||
TABS.options.initDarkTheme();
|
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 () {
|
options.initCordovaForceComputerUI = function () {
|
||||||
if (GUI.isCordova() && cordovaUI.canChangeUI) {
|
if (GUI.isCordova() && cordovaUI.canChangeUI) {
|
||||||
ConfigStorage.get('cordovaForceComputerUI', function (result) {
|
ConfigStorage.get('cordovaForceComputerUI', function (result) {
|
||||||
|
|
|
@ -46,6 +46,12 @@
|
||||||
</select>
|
</select>
|
||||||
<span i18n="connectionTimeout"></span>
|
<span i18n="connectionTimeout"></span>
|
||||||
</div>
|
</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 class="cordovaForceComputerUI margin-bottom">
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" class="toggle" />
|
<input type="checkbox" class="toggle" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue