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