1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-23 16:25:19 +03:00

Filter list of Linux devices to more sane set (front page and SITL)

This commit is contained in:
Jonathan Hudson 2024-04-27 18:42:14 +01:00
parent 9c66cd9c0e
commit 3d3f5aac8e
2 changed files with 24 additions and 14 deletions

View file

@ -138,19 +138,20 @@ var Ser2TCP = {
var devices = [];
if (error) {
GUI.log("Unable to list serial ports.");
} else {
} 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]);
/* Limit to: USB serial, RFCOMM (BT), 6 legacy devices */
if (device.pnpId ||
device.path.match(/rfcomm\d*/) ||
device.path.match(/ttyS[0-5]$/)) {
devices.push(device.path);
}
}
}
});
}
callback(devices);
@ -231,7 +232,7 @@ var SITLProcess = {
if (err)
console.log(err);
});
} else {
alert(GUI.operating_system);
return;