mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Move anime data. Twiddle supergfxctl
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
//! Basic CLI tool to control the `supergfxd` daemon
|
||||
|
||||
use std::{env::args, sync::mpsc::channel};
|
||||
use supergfxctl::{
|
||||
gfx_vendors::{GfxRequiredUserAction, GfxVendors},
|
||||
@@ -59,6 +61,7 @@ fn do_gfx(command: CliStart) -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
|
||||
println!("If anything fails check `journalctl -b -u supergfxd`\n");
|
||||
println!("Note that nvidia-drm.modeset=0 is required in kernel cmdline to enable the nvidia drivers to be unloaded on demand`\n");
|
||||
|
||||
proxy.gfx_write_mode(&mode).map_err(|err|{
|
||||
println!("Graphics mode change error. You may be in an invalid state.");
|
||||
|
||||
@@ -543,7 +543,7 @@ impl CtrlGraphics {
|
||||
// exit if 3 minutes pass
|
||||
if Instant::now().duration_since(start_time).as_secs() > 180 {
|
||||
warn!("{}", THREAD_TIMEOUT_MSG);
|
||||
return Ok(THREAD_TIMEOUT_MSG.into());
|
||||
return Err(GfxError::DisplayManagerTimeout(THREAD_TIMEOUT_MSG.into()));
|
||||
}
|
||||
|
||||
// Don't spin at max speed
|
||||
|
||||
@@ -4,8 +4,6 @@ use std::{error, process::ExitStatus};
|
||||
#[derive(Debug)]
|
||||
pub enum GfxError {
|
||||
ParseVendor,
|
||||
ParsePower,
|
||||
Bus(String, std::io::Error),
|
||||
DisplayManagerAction(String, ExitStatus),
|
||||
DisplayManagerTimeout(String),
|
||||
AsusGsyncModeActive,
|
||||
@@ -26,8 +24,6 @@ impl fmt::Display for GfxError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
GfxError::ParseVendor => write!(f, "Could not parse vendor name"),
|
||||
GfxError::ParsePower => write!(f, "Could not parse dGPU power status"),
|
||||
GfxError::Bus(func, error) => write!(f, "Bus error: {}: {}", func, error),
|
||||
GfxError::DisplayManagerAction(action, status) => {
|
||||
write!(f, "Display-manager action {} failed: {}", action, status)
|
||||
}
|
||||
|
||||
@@ -1,17 +1,28 @@
|
||||
/// The configuration for graphics. This should be saved and loaded on boot.
|
||||
pub mod config;
|
||||
/// Control functions for setting graphics.
|
||||
pub mod controller;
|
||||
/// Error: 404
|
||||
pub mod error;
|
||||
/// Mode names, follows what distros defined as common.
|
||||
pub mod gfx_vendors;
|
||||
/// Special-case functions for check/read/write of key functions on unique laptops
|
||||
/// such as the G-Sync mode available on some ASUS ROG laptops
|
||||
pub mod special;
|
||||
/// System interface helpers.
|
||||
pub mod system;
|
||||
/// Defined DBUS Interface for supergfxctl
|
||||
pub mod zbus_iface;
|
||||
/// Defined DBUS Proxy for supergfxctl
|
||||
pub mod zbus_proxy;
|
||||
|
||||
/// Helper to expose the current crate version to external code
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
/// Generic path that is used to save the daemon config state
|
||||
pub const CONFIG_PATH: &str = "/etc/supergfxd.conf";
|
||||
/// Destination name to be used in the daemon when setting up DBUS connection
|
||||
pub const DBUS_DEST_NAME: &str = "org.supergfxctl.Daemon";
|
||||
/// Interface path name. Should be common across daemon and client.
|
||||
pub const DBUS_IFACE_PATH: &str = "/org/supergfxctl/Gfx";
|
||||
|
||||
const NVIDIA_DRIVERS: [&str; 4] = ["nvidia_drm", "nvidia_modeset", "nvidia_uvm", "nvidia"];
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
//!
|
||||
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
|
||||
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
use std::sync::mpsc::{Sender};
|
||||
|
||||
use zbus::{dbus_proxy, Connection, Message, Result};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user