mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 09:23:19 +01:00
Try remove nouveau
This commit is contained in:
@@ -431,7 +431,10 @@ fn handle_profile(
|
||||
println!("Available profiles are {:?}", profile_names);
|
||||
}
|
||||
if cmd.active_name {
|
||||
println!("Active profile: {:?}", dbus.proxies().profile().active_profile_name()?);
|
||||
println!(
|
||||
"Active profile: {:?}",
|
||||
dbus.proxies().profile().active_profile_name()?
|
||||
);
|
||||
}
|
||||
if cmd.active_data {
|
||||
println!("Active profile:");
|
||||
|
||||
@@ -2,7 +2,7 @@ use rog_types::{aura_modes::AuraEffect, gfx_vendors::GfxVendors, profile::Profil
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use crate::config::{Config};
|
||||
use crate::config::Config;
|
||||
|
||||
/// for parsing old v2.1.2 config
|
||||
#[allow(dead_code)]
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use crate::error::RogError;
|
||||
use crate::{
|
||||
config::{Config},
|
||||
GetSupported,
|
||||
};
|
||||
use crate::{config::Config, GetSupported};
|
||||
use log::{info, warn};
|
||||
use rog_types::profile::{FanLevel, ProfileEvent, Profile};
|
||||
use rog_types::profile::{FanLevel, Profile, ProfileEvent};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::Write;
|
||||
@@ -97,7 +94,9 @@ impl DbusFanAndCpu {
|
||||
return Ok(cfg.active_profile.clone());
|
||||
}
|
||||
}
|
||||
Err(Error::Failed("Failed to get active profile name".to_string()))
|
||||
Err(Error::Failed(
|
||||
"Failed to get active profile name".to_string(),
|
||||
))
|
||||
}
|
||||
|
||||
// TODO: Profile can't implement Type because of Curve
|
||||
@@ -113,7 +112,9 @@ impl DbusFanAndCpu {
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(Error::Failed("Failed to get active profile details".to_string()))
|
||||
Err(Error::Failed(
|
||||
"Failed to get active profile details".to_string(),
|
||||
))
|
||||
}
|
||||
|
||||
/// Fetch all profile data
|
||||
@@ -126,18 +127,16 @@ impl DbusFanAndCpu {
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(Error::Failed("Failed to get all profile details".to_string()))
|
||||
Err(Error::Failed(
|
||||
"Failed to get all profile details".to_string(),
|
||||
))
|
||||
}
|
||||
|
||||
fn profile_names(&self) -> zbus::fdo::Result<Vec<String>> {
|
||||
if let Ok(ctrl) = self.inner.try_lock() {
|
||||
if let Ok(mut cfg) = ctrl.config.try_lock() {
|
||||
cfg.read();
|
||||
let profile_names = cfg
|
||||
.power_profiles
|
||||
.keys()
|
||||
.cloned()
|
||||
.collect::<Vec<String>>();
|
||||
let profile_names = cfg.power_profiles.keys().cloned().collect::<Vec<String>>();
|
||||
return Ok(profile_names);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,10 +34,7 @@ impl fmt::Display for GfxError {
|
||||
f,
|
||||
"Can not switch to vfio mode if the modules are built in to kernel"
|
||||
),
|
||||
GfxError::MissingModule(m) => write!(
|
||||
f,
|
||||
"The module {} is missing", m
|
||||
),
|
||||
GfxError::MissingModule(m) => write!(f, "The module {} is missing", m),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@ use ctrl_gfx::error::GfxError;
|
||||
use ctrl_gfx::*;
|
||||
use ctrl_rog_bios::CtrlRogBios;
|
||||
use log::{error, info, warn};
|
||||
use logind_zbus::{ManagerProxy, SessionProxy, types::{SessionClass, SessionInfo, SessionState, SessionType}};
|
||||
use logind_zbus::{
|
||||
types::{SessionClass, SessionInfo, SessionState, SessionType},
|
||||
ManagerProxy, SessionProxy,
|
||||
};
|
||||
use rog_types::gfx_vendors::{GfxRequiredUserAction, GfxVendors};
|
||||
use std::sync::mpsc;
|
||||
use std::{io::Write, ops::Add, path::Path, time::Instant};
|
||||
@@ -323,10 +326,7 @@ impl CtrlGraphics {
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
if output
|
||||
.stderr
|
||||
.ends_with("is builtin.\n".as_bytes())
|
||||
{
|
||||
if output.stderr.ends_with("is builtin.\n".as_bytes()) {
|
||||
return Err(GfxError::VfioBuiltin.into());
|
||||
}
|
||||
if output.stderr.ends_with("Permission denied\n".as_bytes()) {
|
||||
@@ -339,7 +339,9 @@ impl CtrlGraphics {
|
||||
warn!("GFX: It may be safe to ignore the above error, run `lsmod |grep {}` to confirm modules loaded", driver);
|
||||
return Ok(());
|
||||
}
|
||||
if String::from_utf8_lossy(&output.stderr).contains(&format!("Module {} not found", driver)) {
|
||||
if String::from_utf8_lossy(&output.stderr)
|
||||
.contains(&format!("Module {} not found", driver))
|
||||
{
|
||||
return Err(GfxError::MissingModule(driver.into()).into());
|
||||
}
|
||||
if count >= MAX_TRIES {
|
||||
@@ -445,6 +447,7 @@ impl CtrlGraphics {
|
||||
}
|
||||
}
|
||||
GfxVendors::Vfio => {
|
||||
Self::do_driver_action("nouveau", "rmmod")?;
|
||||
for driver in NVIDIA_DRIVERS.iter() {
|
||||
Self::do_driver_action(driver, "rmmod")?;
|
||||
}
|
||||
@@ -452,6 +455,7 @@ impl CtrlGraphics {
|
||||
Self::do_driver_action("vfio-pci", "modprobe")?;
|
||||
}
|
||||
GfxVendors::Integrated => {
|
||||
Self::do_driver_action("nouveau", "rmmod")?;
|
||||
for driver in VFIO_DRIVERS.iter() {
|
||||
Self::do_driver_action(driver, "rmmod")?;
|
||||
}
|
||||
@@ -539,7 +543,7 @@ impl CtrlGraphics {
|
||||
info!("GFX thread: display-manager started");
|
||||
|
||||
let v: &str = vendor.into();
|
||||
info!("GFX: Graphics mode changed to {} successfully", v);
|
||||
info!("GFX thread: Graphics mode changed to {} successfully", v);
|
||||
Ok(format!("Graphics mode changed to {} successfully", v))
|
||||
}
|
||||
|
||||
@@ -609,6 +613,7 @@ impl CtrlGraphics {
|
||||
let devices = self.nvidia.clone();
|
||||
let bus = self.bus.clone();
|
||||
Self::do_vendor_tasks(vendor, &devices, &bus)?;
|
||||
info!("GFX: Graphics mode changed to {}", <&str>::from(vendor));
|
||||
}
|
||||
// TODO: undo if failed? Save last mode, catch errors...
|
||||
Ok(action_required)
|
||||
|
||||
@@ -3,7 +3,6 @@ use rog_fan_curve::{Curve, Fan};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::str::FromStr;
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct Profile {
|
||||
pub min_percentage: u8,
|
||||
|
||||
Reference in New Issue
Block a user