Improve network management (#1478)

This PR changes the way that photonvision interacts with nmcli to control networking on the coprocessor. Instead of modifying an existing connection, Photonvision adds new connections for DHCP and Static IP configurations. It then activiates the proper one at startup and any time that the network configuration is changed.


It also now uses the interface name and not the connection name and checks that the interface is available before making any changes. If the saved interface is not found, it updates the stored interface name and applies the network settings to the current interface. This should minimize the failure to control the network if the network interface wasn't available when PhotonVision first booted.

One other benefit of not altering the default configuration is that, if PhotonVision fails to run for any reason, the device can be accessed using the original networking configuration.

The code has been tested on an OrangePi5 and and a Raspberry Pi 4.

Addresses: #1261
This commit is contained in:
Craig Schardt
2024-10-20 20:23:50 -07:00
committed by GitHub
parent b38de6b506
commit 8ff0d93c1f
7 changed files with 261 additions and 114 deletions

View File

@@ -78,7 +78,7 @@ export const useSettingsStore = defineStore("settings", {
return this.general.gpuAcceleration !== undefined;
},
networkInterfaceNames(): string[] {
return this.network.networkInterfaceNames.map((i) => i.connName);
return this.network.networkInterfaceNames.map((i) => i.devName);
}
},
actions: {