mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6746c2b654 | |||
| 8d59f89438 | |||
| 5753160e91 | |||
| 622cd9d943 | |||
| 2daa7f0811 | |||
| 05c53df0ed |
+6
-1
@@ -6,7 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
# [2.0.0] - 2020-09-21
|
# [2.0.4] - 2020-09-24
|
||||||
|
### Changed
|
||||||
|
- Better and more verbose error handling and logging in many places.
|
||||||
|
- Fix timeout for client waiting on reply for graphics switching
|
||||||
|
|
||||||
|
# [2.0.2] - 2020-09-21
|
||||||
### Changed
|
### Changed
|
||||||
- graphics options via CLI are now a command block:
|
- graphics options via CLI are now a command block:
|
||||||
+ `asusctl graphics`
|
+ `asusctl graphics`
|
||||||
|
|||||||
Generated
+3
-3
@@ -29,7 +29,7 @@ checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asus-nb"
|
name = "asus-nb"
|
||||||
version = "2.0.2"
|
version = "2.0.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ctrl-gfx",
|
"ctrl-gfx",
|
||||||
"dbus",
|
"dbus",
|
||||||
@@ -46,7 +46,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asus-nb-ctrl"
|
name = "asus-nb-ctrl"
|
||||||
version = "2.0.3"
|
version = "2.0.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asus-nb",
|
"asus-nb",
|
||||||
"ctrl-gfx",
|
"ctrl-gfx",
|
||||||
@@ -69,7 +69,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asus-notify"
|
name = "asus-notify"
|
||||||
version = "1.0.1"
|
version = "2.0.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asus-nb",
|
"asus-nb",
|
||||||
"asus-nb-ctrl",
|
"asus-nb-ctrl",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "asus-nb-ctrl"
|
name = "asus-nb-ctrl"
|
||||||
version = "2.0.3"
|
version = "2.0.4"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
|||||||
@@ -23,15 +23,14 @@ pub struct Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
/// `load` will attempt to read the config, but if it is not found it
|
/// `load` will attempt to read the config, and panic if the dir is missing
|
||||||
/// will create a new default config and write that out.
|
|
||||||
pub fn load(mut self, supported_led_modes: &[u8]) -> Self {
|
pub fn load(mut self, supported_led_modes: &[u8]) -> Self {
|
||||||
let mut file = OpenOptions::new()
|
let mut file = OpenOptions::new()
|
||||||
.read(true)
|
.read(true)
|
||||||
.write(true)
|
.write(true)
|
||||||
.create(true)
|
.create(true)
|
||||||
.open(&CONFIG_PATH)
|
.open(&CONFIG_PATH)
|
||||||
.unwrap(); // okay to cause panic here
|
.expect(&format!("The file {} or directory /etc/asusd/ is missing", CONFIG_PATH)); // okay to cause panic here
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
if let Ok(l) = file.read_to_string(&mut buf) {
|
if let Ok(l) = file.read_to_string(&mut buf) {
|
||||||
if l == 0 {
|
if l == 0 {
|
||||||
|
|||||||
@@ -152,7 +152,12 @@ impl crate::CtrlTask for CtrlKbdBacklight {
|
|||||||
let mut file = OpenOptions::new()
|
let mut file = OpenOptions::new()
|
||||||
.read(true)
|
.read(true)
|
||||||
.open(&self.bright_node)
|
.open(&self.bright_node)
|
||||||
.map_err(|err| RogError::Path((&self.bright_node).into(), err))?;
|
.map_err(|err| {
|
||||||
|
match err.kind() {
|
||||||
|
std::io::ErrorKind::NotFound => RogError::MissingLedBrightNode((&self.bright_node).into(), err),
|
||||||
|
_ => RogError::Path((&self.bright_node).into(), err),
|
||||||
|
}
|
||||||
|
})?;
|
||||||
let mut buf = [0u8; 1];
|
let mut buf = [0u8; 1];
|
||||||
file.read_exact(&mut buf)
|
file.read_exact(&mut buf)
|
||||||
.map_err(|err| RogError::Read("buffer".into(), err))?;
|
.map_err(|err| RogError::Read("buffer".into(), err))?;
|
||||||
|
|||||||
@@ -126,7 +126,10 @@ fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
|
|
||||||
for ctrl in tasks.iter() {
|
for ctrl in tasks.iter() {
|
||||||
if let Ok(mut lock) = ctrl.try_lock() {
|
if let Ok(mut lock) = ctrl.try_lock() {
|
||||||
lock.do_task().ok();
|
lock.do_task().map_err(|err| {
|
||||||
|
warn!("do_task error: {}", err);
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::fmt;
|
|
||||||
use std::convert::From;
|
|
||||||
use intel_pstate::PStateError;
|
use intel_pstate::PStateError;
|
||||||
use rog_fan_curve::CurveError;
|
use rog_fan_curve::CurveError;
|
||||||
|
use std::convert::From;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum RogError {
|
pub enum RogError {
|
||||||
@@ -19,6 +19,7 @@ pub enum RogError {
|
|||||||
FanCurve(CurveError),
|
FanCurve(CurveError),
|
||||||
DoTask(String),
|
DoTask(String),
|
||||||
MissingFunction(String),
|
MissingFunction(String),
|
||||||
|
MissingLedBrightNode(String, std::io::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for RogError {
|
impl fmt::Display for RogError {
|
||||||
@@ -39,6 +40,7 @@ impl fmt::Display for RogError {
|
|||||||
RogError::FanCurve(err) => write!(f, "Custom fan-curve error: {}", err),
|
RogError::FanCurve(err) => write!(f, "Custom fan-curve error: {}", err),
|
||||||
RogError::DoTask(deets) => write!(f, "Task error: {}", deets),
|
RogError::DoTask(deets) => write!(f, "Task error: {}", deets),
|
||||||
RogError::MissingFunction(deets) => write!(f, "Missing functionality: {}", deets),
|
RogError::MissingFunction(deets) => write!(f, "Missing functionality: {}", deets),
|
||||||
|
RogError::MissingLedBrightNode(path, error) => write!(f, "Led node at {} is missing, please check you have the required patch or dkms module installed: {}", path, error),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use config::Config;
|
|||||||
use crate::error::RogError;
|
use crate::error::RogError;
|
||||||
use zbus::ObjectServer;
|
use zbus::ObjectServer;
|
||||||
|
|
||||||
pub static VERSION: &str = "2.0.3";
|
pub static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
pub trait Reloadable {
|
pub trait Reloadable {
|
||||||
fn reload(&mut self) -> Result<(), RogError>;
|
fn reload(&mut self) -> Result<(), RogError>;
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ fn do_gfx(
|
|||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
if let Some(mode) = command.mode {
|
if let Some(mode) = command.mode {
|
||||||
println!("Updating settings, please wait...");
|
println!("Updating settings, please wait...");
|
||||||
println!("If this takes longer than 30s, ctrl+c then check journalctl");
|
println!("If this takes longer than 30s, ctrl+c then check `journalctl -b -u asusd`");
|
||||||
|
|
||||||
writer.write_gfx_mode(mode)?;
|
writer.write_gfx_mode(mode)?;
|
||||||
let res = writer.wait_gfx_changed()?;
|
let res = writer.wait_gfx_changed()?;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "asus-nb"
|
name = "asus-nb"
|
||||||
version = "2.0.2"
|
version = "2.0.4"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
|||||||
+13
-13
@@ -37,7 +37,7 @@ impl CtrlSignals {
|
|||||||
let proxy = connection.with_proxy(
|
let proxy = connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Gfx",
|
"/org/asuslinux/Gfx",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
|
|
||||||
let gfx_vendor_signal = Arc::new(Mutex::new(None));
|
let gfx_vendor_signal = Arc::new(Mutex::new(None));
|
||||||
@@ -68,7 +68,7 @@ impl CtrlSignals {
|
|||||||
let proxy = connection.with_proxy(
|
let proxy = connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Profile",
|
"/org/asuslinux/Profile",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
|
|
||||||
let profile_signal = Arc::new(Mutex::new(None));
|
let profile_signal = Arc::new(Mutex::new(None));
|
||||||
@@ -87,7 +87,7 @@ impl CtrlSignals {
|
|||||||
let proxy = connection.with_proxy(
|
let proxy = connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Led",
|
"/org/asuslinux/Led",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
|
|
||||||
let ledmode_signal = Arc::new(Mutex::new(None));
|
let ledmode_signal = Arc::new(Mutex::new(None));
|
||||||
@@ -108,7 +108,7 @@ impl CtrlSignals {
|
|||||||
let proxy = connection.with_proxy(
|
let proxy = connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Charge",
|
"/org/asuslinux/Charge",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
|
|
||||||
let charge_signal = Arc::new(Mutex::new(None));
|
let charge_signal = Arc::new(Mutex::new(None));
|
||||||
@@ -168,7 +168,7 @@ impl AuraDbusClient {
|
|||||||
|
|
||||||
pub fn wait_gfx_changed(&self) -> Result<String, Box<dyn Error>> {
|
pub fn wait_gfx_changed(&self) -> Result<String, Box<dyn Error>> {
|
||||||
loop {
|
loop {
|
||||||
self.connection.process(Duration::from_micros(500))?;
|
self.connection.process(Duration::from_millis(1))?;
|
||||||
if let Ok(lock) = self.signals.gfx_action_signal.lock() {
|
if let Ok(lock) = self.signals.gfx_action_signal.lock() {
|
||||||
if let Some(stuff) = lock.as_ref() {
|
if let Some(stuff) = lock.as_ref() {
|
||||||
return Ok(stuff.to_string());
|
return Ok(stuff.to_string());
|
||||||
@@ -185,7 +185,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Led",
|
"/org/asuslinux/Led",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
proxy.set_led_mode(&serde_json::to_string(&mode)?)?;
|
proxy.set_led_mode(&serde_json::to_string(&mode)?)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -224,7 +224,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Led",
|
"/org/asuslinux/Led",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
proxy.set_led_mode(&serde_json::to_string(mode)?)?;
|
proxy.set_led_mode(&serde_json::to_string(mode)?)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -235,7 +235,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Gfx",
|
"/org/asuslinux/Gfx",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
let x = proxy.power()?;
|
let x = proxy.power()?;
|
||||||
Ok(x)
|
Ok(x)
|
||||||
@@ -246,7 +246,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Gfx",
|
"/org/asuslinux/Gfx",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
let x = proxy.vendor()?;
|
let x = proxy.vendor()?;
|
||||||
Ok(x)
|
Ok(x)
|
||||||
@@ -257,7 +257,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Gfx",
|
"/org/asuslinux/Gfx",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(30),
|
||||||
);
|
);
|
||||||
proxy.set_vendor(<&str>::from(&vendor))?;
|
proxy.set_vendor(<&str>::from(&vendor))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -268,7 +268,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Profile",
|
"/org/asuslinux/Profile",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
proxy.set_profile(&serde_json::to_string(&ProfileEvent::ChangeMode(level))?)?;
|
proxy.set_profile(&serde_json::to_string(&ProfileEvent::ChangeMode(level))?)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -282,7 +282,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Profile",
|
"/org/asuslinux/Profile",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
proxy.set_profile(&serde_json::to_string(cmd)?)?;
|
proxy.set_profile(&serde_json::to_string(cmd)?)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -293,7 +293,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Charge",
|
"/org/asuslinux/Charge",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
proxy.set_limit(level)?;
|
proxy.set_limit(level)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "asus-notify"
|
name = "asus-notify"
|
||||||
version = "1.0.1"
|
version = "2.0.4"
|
||||||
authors = ["Luke D Jones <luke@ljones.dev>"]
|
authors = ["Luke D Jones <luke@ljones.dev>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use std::error::Error;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
println!("Version 1.0.1");
|
println!("Version {}", env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
let mut cfg = Config::read_new()?;
|
let mut cfg = Config::read_new()?;
|
||||||
let mut last_profile = String::new();
|
let mut last_profile = String::new();
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ pub mod system;
|
|||||||
const PRIME_DISCRETE_PATH: &str = "/etc/prime-discrete";
|
const PRIME_DISCRETE_PATH: &str = "/etc/prime-discrete";
|
||||||
const MODPROBE_PATH: &str = "/etc/modprobe.d/asusd.conf";
|
const MODPROBE_PATH: &str = "/etc/modprobe.d/asusd.conf";
|
||||||
const INITRAMFS_PATH: &str = "/usr/sbin/update-initramfs";
|
const INITRAMFS_PATH: &str = "/usr/sbin/update-initramfs";
|
||||||
//const DRACUT_PATH: &str = "/usr/bin/dracut";
|
// const DRACUT_PATH: &str = "/usr/bin/dracut";
|
||||||
|
|
||||||
static MODPROBE_NVIDIA: &[u8] = MODPROBE_HYBRID;
|
static MODPROBE_NVIDIA: &[u8] = MODPROBE_HYBRID;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user