1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-21 07:15:15 +03:00

Merge pull request #2392 from haslinghuis/fix-2389

Check for legacy devices
This commit is contained in:
Michael Keller 2021-02-08 23:57:18 +13:00 committed by GitHub
commit e7c30f3b4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -242,12 +242,14 @@ PortHandler.selectPort = function(ports) {
for (let i = 0; i < ports.length; i++) { for (let i = 0; i < ports.length; i++) {
const portName = ports[i].displayName; const portName = ports[i].displayName;
if (portName) { if (portName) {
if (portName.includes('STM') || portName.includes('CP210')) { const pathSelect = ports[i].path;
const pathSelect = ports[i].path; const isWindows = (OS === 'Windows');
if (OS === 'Windows' || (OS !== 'Windows' && pathSelect.includes('tty'))) { const isTty = pathSelect.includes('tty');
this.portPickerElement.val(pathSelect); const deviceRecognized = portName.includes('STM') || portName.includes('CP210');
console.log(`Porthandler detected device ${portName} on port: ${pathSelect}`); const legacyDeviceRecognized = portName.includes('usb');
} if (isWindows && deviceRecognized || isTty && (deviceRecognized || legacyDeviceRecognized)) {
this.portPickerElement.val(pathSelect);
console.log(`Porthandler detected device ${portName} on port: ${pathSelect}`);
} }
} }
} }