From d8cbf1d1c4e7d6e8f81520e642191c401d697d67 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Fri, 10 May 2024 17:29:07 -0700 Subject: [PATCH] steamosctl: Use WifiBackend as the argument type directly --- src/bin/steamosctl.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/bin/steamosctl.rs b/src/bin/steamosctl.rs index cf75a21..8f8f6ae 100644 --- a/src/bin/steamosctl.rs +++ b/src/bin/steamosctl.rs @@ -9,7 +9,6 @@ use anyhow::Result; use clap::{Parser, Subcommand}; use itertools::Itertools; use std::ops::Deref; -use std::str::FromStr; use steamos_manager::proxy::ManagerProxy; use steamos_manager::wifi::WifiBackend; use zbus::fdo::PropertiesProxy; @@ -88,7 +87,7 @@ enum Commands { /// Set the wifi backend if possible SetWifiBackend { /// Supported backends are iwd, wpa_supplicant - backend: String, + backend: WifiBackend, }, /// Get the wifi backend @@ -223,13 +222,8 @@ async fn main() -> Result<()> { let value = proxy.tdp_limit_min().await?; println!("TDP limit min: {value}"); } - Commands::SetWifiBackend { backend } => match WifiBackend::from_str(backend) { - Ok(b) => { - proxy.set_wifi_backend(b as u32).await?; - } - Err(_) => { - println!("Unknown wifi backend {backend}"); - } + Commands::SetWifiBackend { backend } => { + proxy.set_wifi_backend(*backend as u32).await?; }, Commands::GetWifiBackend => { let backend = proxy.wifi_backend().await?;