Don't set wifi debug mode if it isn't changing.

Since set_wifi_debug_mode always restarts iwd which
has unintentional consequences on oled deck (destroys and recreates
the network interface) but not on lcd deck first check
if previous mode is different than wanted mode before doing
anything.

See https://gitlab.steamos.cloud/holo/holo/-/merge_requests/747/diffs#2790dcf348b51beca93939ee9fd81f87566d57c9_0_29
for more information.
This commit is contained in:
Jeremy Whiting 2024-11-12 09:25:03 -07:00
parent 2f4cfb1e66
commit 1a491db6fe

View file

@ -12,7 +12,7 @@ use std::ffi::OsStr;
use tokio::fs::File; use tokio::fs::File;
use tokio::sync::mpsc::Sender; use tokio::sync::mpsc::Sender;
use tokio::sync::oneshot; use tokio::sync::oneshot;
use tracing::error; use tracing::{error, info};
use zbus::zvariant::{self, Fd}; use zbus::zvariant::{self, Fd};
use zbus::{fdo, interface, Connection, SignalContext}; use zbus::{fdo, interface, Connection, SignalContext};
@ -318,6 +318,12 @@ impl SteamOSManager {
Ok(mode) => mode, Ok(mode) => mode,
Err(e) => return Err(fdo::Error::InvalidArgs(e.to_string())), Err(e) => return Err(fdo::Error::InvalidArgs(e.to_string())),
}; };
if self.wifi_debug_mode == wanted_mode {
info!("Not changing wifi debug mode since it's already set to {wanted_mode}");
return Ok(());
}
let buffer_size = match options let buffer_size = match options
.get("buffer_size") .get("buffer_size")
.map(zbus::zvariant::Value::downcast_ref) .map(zbus::zvariant::Value::downcast_ref)