1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 11:29:53 +03:00
This commit is contained in:
Andi Kanzler 2024-02-10 18:08:17 -03:00
parent 939f5af04b
commit f24ccfc637
96 changed files with 16438 additions and 8058 deletions

View file

@ -124,22 +124,25 @@ var Ser2TCP = {
},
getDevices: function(callback) {
chrome.serial.getDevices((devices_array) => {
SerialPort.list().then((ports, error) => {
var devices = [];
devices_array.forEach((device) => {
if (GUI.operating_system == 'Windows') {
var m = device.path.match(/COM\d?\d/g)
if (error) {
GUI.log("Unable to list serial ports.");
} else {
ports.forEach((device) => {
if (GUI.operating_system == 'Windows') {
var m = device.path.match(/COM\d?\d/g)
if (m)
devices.push(m[0]);
} else {
if (device.displayName != null) {
var m = device.path.match(/\/dev\/.*/)
if (m)
devices.push(m[0]);
devices.push(m[0]);
} else {
if (device.displayName != null) {
var m = device.path.match(/\/dev\/.*/)
if (m)
devices.push(m[0]);
}
}
}
});
});
}
callback(devices);
});
},