mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
This changes out how the current graphics switching works, enabling asusd to stop/start the display-manager to enable/disable PCI devices and add/remove drivers as required. All existing graphics modes and commands still work as normal. G-Sync enable is now only through the bios setting, and on reboot will set all relevant settings to Nvidia mode.
43 lines
1.5 KiB
Rust
43 lines
1.5 KiB
Rust
use std::error;
|
|
use std::fmt;
|
|
|
|
use crate::error::RogError;
|
|
|
|
#[derive(Debug)]
|
|
pub enum GfxError {
|
|
ParseVendor,
|
|
Path(String, std::io::Error),
|
|
Read(String, std::io::Error),
|
|
Write(String, std::io::Error),
|
|
Module(String, std::io::Error),
|
|
Bus(String, std::io::Error),
|
|
Command(String, std::io::Error),
|
|
Modprobe(String),
|
|
DisplayManager(String),
|
|
}
|
|
|
|
impl fmt::Display for GfxError {
|
|
// This trait requires `fmt` with this exact signature.
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
match self {
|
|
GfxError::ParseVendor => write!(f, "Could not parse vendor name"),
|
|
GfxError::Path(path, error) => write!(f, "Path {}: {}", path, error),
|
|
GfxError::Read(path, error) => write!(f, "Read {}: {}", path, error),
|
|
GfxError::Write(path, error) => write!(f, "Write {}: {}", path, error),
|
|
GfxError::Module(func, error) => write!(f, "Module error: {}: {}", func, error),
|
|
GfxError::Bus(func, error) => write!(f, "Bus error: {}: {}", func, error),
|
|
GfxError::Command(func, error) => write!(f, "Command exec error: {}: {}", func, error),
|
|
GfxError::Modprobe(detail) => write!(f, "Modprobe error: {}", detail),
|
|
GfxError::DisplayManager(detail) => write!(f, "Display manager: {}", detail),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl error::Error for GfxError {}
|
|
|
|
impl From<GfxError> for RogError {
|
|
fn from(err: GfxError) -> Self {
|
|
RogError::GfxSwitching(err)
|
|
}
|
|
}
|