Compare commits

...

9 Commits

Author SHA1 Message Date
Luke D Jones 6746c2b654 Update changelog 2020-09-24 09:04:49 +12:00
Luke D Jones 8d59f89438 Add verbose error for LED node missing 2020-09-24 08:18:10 +12:00
Luke D Jones 5753160e91 Don't throw away do_task error, log it 2020-09-24 08:10:05 +12:00
Luke D Jones 622cd9d943 Fix timeout for GFX switching 2020-09-24 08:00:37 +12:00
Luke D Jones 2daa7f0811 Git internal version from crate version 2020-09-23 22:12:47 +12:00
Luke D Jones 05c53df0ed Better description of config panic 2020-09-23 21:24:25 +12:00
Luke D Jones a7419cbc4c Remove many unwraps or change to maps 2020-09-23 20:47:33 +12:00
Luke D Jones 67ad38a7e6 Ditch the gsync line in screen settings file. Oops
- Add force option to `systemctl reboot`. Be careful.
2020-09-23 16:51:46 +12:00
Luke Jones e572ae2c62 Update Makefile 2020-09-23 02:32:25 +00:00
22 changed files with 112 additions and 71 deletions
+6 -1
View File
@@ -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
+4 -4
View File
@@ -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.2" 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",
@@ -189,7 +189,7 @@ dependencies = [
[[package]] [[package]]
name = "ctrl-gfx" name = "ctrl-gfx"
version = "2.1.0" version = "2.1.1"
dependencies = [ dependencies = [
"log", "log",
"sysfs-class", "sysfs-class",
-2
View File
@@ -44,7 +44,6 @@ install: all
install -D -m 0755 "target/release/$(BIN_N)" "$(DESTDIR)$(bindir)/$(BIN_N)" install -D -m 0755 "target/release/$(BIN_N)" "$(DESTDIR)$(bindir)/$(BIN_N)"
install -D -m 0644 "data/$(PMRULES)" "$(DESTDIR)/lib/udev/rules.d/$(PMRULES)" install -D -m 0644 "data/$(PMRULES)" "$(DESTDIR)/lib/udev/rules.d/$(PMRULES)"
install -D -m 0644 "data/$(BIN_D).rules" "$(DESTDIR)/lib/udev/rules.d/99-$(BIN_D).rules" install -D -m 0644 "data/$(BIN_D).rules" "$(DESTDIR)/lib/udev/rules.d/99-$(BIN_D).rules"
install -D -m 0644 "data/$(PMRULES).rules" "$(DESTDIR)/lib/udev/rules.d/$(PMRULES).rules"
install -D -m 0644 "data/$(LEDCFG)" "$(DESTDIR)$(sysconfdir)/asusd/$(LEDCFG)" install -D -m 0644 "data/$(LEDCFG)" "$(DESTDIR)$(sysconfdir)/asusd/$(LEDCFG)"
install -D -m 0644 "data/$(BIN_D).conf" "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN_D).conf" install -D -m 0644 "data/$(BIN_D).conf" "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN_D).conf"
install -D -m 0644 "data/$(X11CFG)" "$(DESTDIR)$(sysconfdir)/X11/xorg.conf.d/$(X11CFG)" install -D -m 0644 "data/$(X11CFG)" "$(DESTDIR)$(sysconfdir)/X11/xorg.conf.d/$(X11CFG)"
@@ -60,7 +59,6 @@ uninstall:
rm -f "$(DESTDIR)$(bindir)/$(BIN_N)" rm -f "$(DESTDIR)$(bindir)/$(BIN_N)"
rm -f "$(DESTDIR)/lib/udev/rules.d/$(PMRULES)" rm -f "$(DESTDIR)/lib/udev/rules.d/$(PMRULES)"
rm -f "$(DESTDIR)/lib/udev/rules.d/99-$(BIN_D).rules" rm -f "$(DESTDIR)/lib/udev/rules.d/99-$(BIN_D).rules"
rm -f "$(DESTDIR)/lib/udev/rules.d/$(PMRULES).rules"
rm -f "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN_D).conf" rm -f "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN_D).conf"
rm -f "$(DESTDIR)$(sysconfdir)/X11/xorg.conf.d/$(X11CFG)" rm -f "$(DESTDIR)$(sysconfdir)/X11/xorg.conf.d/$(X11CFG)"
rm -f "$(DESTDIR)/lib/systemd/system/$(BIN_D).service" rm -f "$(DESTDIR)/lib/systemd/system/$(BIN_D).service"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "asus-nb-ctrl" name = "asus-nb-ctrl"
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>"]
+2 -3
View File
@@ -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 {
+5 -1
View File
@@ -40,7 +40,11 @@ impl crate::ZbusAdd for CtrlAnimeDisplay {
fn add_to_server(self, server: &mut zbus::ObjectServer) { fn add_to_server(self, server: &mut zbus::ObjectServer) {
server server
.at(&"/org/asuslinux/Anime".try_into().unwrap(), self) .at(&"/org/asuslinux/Anime".try_into().unwrap(), self)
.unwrap(); .map_err(|err| {
warn!("CtrlAnimeDisplay: add_to_server {}", err);
err
})
.ok();
} }
} }
+17 -3
View File
@@ -26,8 +26,18 @@ trait Dbus {
impl Dbus for CtrlCharge { impl Dbus for CtrlCharge {
fn set_limit(&mut self, limit: u8) { fn set_limit(&mut self, limit: u8) {
if let Ok(mut config) = self.config.try_lock() { if let Ok(mut config) = self.config.try_lock() {
self.set(limit, &mut config).unwrap(); self.set(limit, &mut config)
self.notify_charge(limit).unwrap(); .map_err(|err| {
warn!("CtrlCharge: set_limit {}", err);
err
})
.ok();
self.notify_charge(limit)
.map_err(|err| {
warn!("CtrlCharge: set_limit {}", err);
err
})
.ok();
} }
} }
@@ -46,7 +56,11 @@ impl crate::ZbusAdd for CtrlCharge {
fn add_to_server(self, server: &mut zbus::ObjectServer) { fn add_to_server(self, server: &mut zbus::ObjectServer) {
server server
.at(&"/org/asuslinux/Charge".try_into().unwrap(), self) .at(&"/org/asuslinux/Charge".try_into().unwrap(), self)
.unwrap(); .map_err(|err| {
warn!("CtrlCharge: add_to_server {}", err);
err
})
.ok();
} }
} }
+6 -2
View File
@@ -79,7 +79,11 @@ impl crate::ZbusAdd for DbusFanAndCpu {
fn add_to_server(self, server: &mut zbus::ObjectServer) { fn add_to_server(self, server: &mut zbus::ObjectServer) {
server server
.at(&"/org/asuslinux/Profile".try_into().unwrap(), self) .at(&"/org/asuslinux/Profile".try_into().unwrap(), self)
.unwrap(); .map_err(|err| {
warn!("DbusFanAndCpu: {}", err);
err
})
.ok();
} }
} }
@@ -311,7 +315,7 @@ impl CtrlFanAndCPU {
let boost = if mode_config.turbo { "1" } else { "0" }; // opposite of Intel let boost = if mode_config.turbo { "1" } else { "0" }; // opposite of Intel
file.write_all(boost.as_bytes()) file.write_all(boost.as_bytes())
.map_err(|err| RogError::Write(AMD_BOOST_PATH.into(), err))?; .map_err(|err| RogError::Write(AMD_BOOST_PATH.into(), err))?;
info!("AMD CPU Turbo: {}", boost); info!("AMD CPU Turbo: {}", boost);
} }
Ok(()) Ok(())
+29 -17
View File
@@ -42,7 +42,7 @@ impl crate::ZbusAdd for DbusKbdBacklight {
fn add_to_server(self, server: &mut zbus::ObjectServer) { fn add_to_server(self, server: &mut zbus::ObjectServer) {
server server
.at(&"/org/asuslinux/Led".try_into().unwrap(), self) .at(&"/org/asuslinux/Led".try_into().unwrap(), self)
.unwrap(); .ok();
} }
} }
@@ -58,10 +58,11 @@ impl DbusKbdBacklight {
.unwrap_or_else(|err| warn!("{}", err)); .unwrap_or_else(|err| warn!("{}", err));
} }
_ => { _ => {
let json = serde_json::to_string(&data).unwrap(); if let Ok(json) = serde_json::to_string(&data) {
ctrl.do_command(data, &mut cfg) ctrl.do_command(data, &mut cfg)
.unwrap_or_else(|err| warn!("{}", err)); .unwrap_or_else(|err| warn!("{}", err));
self.notify_led(&json).unwrap(); self.notify_led(&json).ok();
}
} }
} }
} }
@@ -151,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))?;
@@ -233,8 +239,11 @@ impl CtrlKbdBacklight {
RogError::Udev("parent_with_subsystem_devtype failed".into(), err) RogError::Udev("parent_with_subsystem_devtype failed".into(), err)
})? })?
{ {
if parent.attribute_value("idProduct").unwrap() == id_product { if parent
// && device.parent().unwrap().sysnum().unwrap() == 3 .attribute_value("idProduct")
.ok_or(RogError::NotFound("LED idProduct".into()))?
== id_product
{
if let Some(dev_node) = device.devnode() { if let Some(dev_node) = device.devnode() {
info!("Using device at: {:?} for LED control", dev_node); info!("Using device at: {:?} for LED control", dev_node);
return Ok(dev_node.to_string_lossy().to_string()); return Ok(dev_node.to_string_lossy().to_string());
@@ -264,13 +273,17 @@ impl CtrlKbdBacklight {
RogError::Udev("match_property failed".into(), err) RogError::Udev("match_property failed".into(), err)
})?; })?;
for device in enumerator.scan_devices().map_err(|err| { for device in enumerator
warn!("{}", err); .scan_devices()
err .map_err(|err| {
}).map_err(|err| { warn!("{}", err);
warn!("{}", err); err
RogError::Udev("scan_devices failed".into(), err) })
})? { .map_err(|err| {
warn!("{}", err);
RogError::Udev("scan_devices failed".into(), err)
})?
{
if let Some(dev_node) = device.devnode() { if let Some(dev_node) = device.devnode() {
if let Some(inum) = device.property_value("ID_USB_INTERFACE_NUM") { if let Some(inum) = device.property_value("ID_USB_INTERFACE_NUM") {
if let Some(iface) = iface { if let Some(iface) = iface {
@@ -298,8 +311,7 @@ impl CtrlKbdBacklight {
fn write_bytes(&self, message: &[u8]) -> Result<(), RogError> { fn write_bytes(&self, message: &[u8]) -> Result<(), RogError> {
if let Some(led_node) = &self.led_node { if let Some(led_node) = &self.led_node {
if let Ok(mut file) = OpenOptions::new().write(true).open(led_node) { if let Ok(mut file) = OpenOptions::new().write(true).open(led_node) {
file.write_all(message).unwrap(); return file.write_all(message).map_err(|err| RogError::Write("write_bytes".into(), err));
return Ok(());
} }
} }
Err(RogError::NotSupported) Err(RogError::NotSupported)
+4 -1
View File
@@ -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().unwrap(); lock.do_task().map_err(|err| {
warn!("do_task error: {}", err);
})
.ok();
} }
} }
}); });
+5 -3
View File
@@ -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),
} }
} }
} }
@@ -55,4 +57,4 @@ impl From<CurveError> for RogError {
fn from(err: CurveError) -> Self { fn from(err: CurveError) -> Self {
RogError::FanCurve(err) RogError::FanCurve(err)
} }
} }
+1 -1
View File
@@ -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.2"; 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>;
+2 -2
View File
@@ -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()?;
@@ -119,7 +119,7 @@ fn do_gfx(
); );
do_gfx_action( do_gfx_action(
command.force, command.force,
Command::new("systemctl").arg("reboot"), Command::new("systemctl").arg("reboot -i"),
"Reboot Linux PC", "Reboot Linux PC",
"Please reboot when ready", "Please reboot when ready",
)?; )?;
+1 -1
View File
@@ -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>"]
+15 -15
View File
@@ -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,9 +235,9 @@ 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().unwrap(); let x = proxy.power()?;
Ok(x) Ok(x)
} }
@@ -246,9 +246,9 @@ 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().unwrap(); 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 -1
View File
@@ -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"
+2
View File
@@ -6,6 +6,8 @@ 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 {}", 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
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "ctrl-gfx" name = "ctrl-gfx"
version = "2.1.0" version = "2.1.1"
license = "MPL-2.0" license = "MPL-2.0"
readme = "README.md" readme = "README.md"
authors = ["Luke <luke@ljones.dev>"] authors = ["Luke <luke@ljones.dev>"]
+8 -9
View File
@@ -37,15 +37,11 @@ use std::convert::TryInto;
#[dbus_interface(name = "org.asuslinux.Daemon")] #[dbus_interface(name = "org.asuslinux.Daemon")]
impl Dbus for CtrlGraphics { impl Dbus for CtrlGraphics {
fn vendor(&self) -> String { fn vendor(&self) -> String {
Self::get_vendor() Self::get_vendor().unwrap_or_else(|err| format!("Get vendor failed: {}", err))
.map_err(|err| format!("Get vendor failed: {}", err))
.unwrap()
} }
fn power(&self) -> String { fn power(&self) -> String {
Self::get_runtime_status() Self::get_runtime_status().unwrap_or_else(|err| format!("Get power status failed: {}", err))
.map_err(|err| format!("Get power status failed: {}", err))
.unwrap()
} }
fn set_vendor(&mut self, vendor: String) { fn set_vendor(&mut self, vendor: String) {
@@ -149,7 +145,11 @@ impl CtrlGraphics {
pub fn add_to_server(self, server: &mut zbus::ObjectServer) { pub fn add_to_server(self, server: &mut zbus::ObjectServer) {
server server
.at(&"/org/asuslinux/Gfx".try_into().unwrap(), self) .at(&"/org/asuslinux/Gfx".try_into().unwrap(), self)
.unwrap(); .map_err(|err| {
warn!("CtrlGraphics: add_to_server {}", err);
err
})
.ok();
} }
pub fn reload(&mut self) -> Result<(), Box<dyn Error>> { pub fn reload(&mut self) -> Result<(), Box<dyn Error>> {
@@ -328,8 +328,7 @@ impl CtrlGraphics {
// } // }
pub fn get_runtime_status() -> Result<String, GfxError> { pub fn get_runtime_status() -> Result<String, GfxError> {
const PATH: &str = "/sys/bus/pci/devices/0000:01:00.0/power/runtime_status"; const PATH: &str = "/sys/bus/pci/devices/0000:01:00.0/power/runtime_status";
let buf = std::fs::read_to_string(PATH) let buf = std::fs::read_to_string(PATH).map_err(|err| GfxError::Read(PATH.into(), err))?;
.map_err(|err| GfxError::Read(PATH.into(), err))?;
Ok(buf) Ok(buf)
} }
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -121,7 +121,7 @@ impl GraphicsDevice {
warn!("{}: Already removed", func.id()); warn!("{}: Already removed", func.id());
} }
} }
info!("Remmoved all gfx devices"); info!("Removed all gfx devices");
Ok(()) Ok(())
} }
} }
-1
View File
@@ -1,5 +1,4 @@
Section "ServerLayout" Section "ServerLayout"
Identifier "layout" Identifier "layout"
Option "AllowNVIDIAGPUScreens" Option "AllowNVIDIAGPUScreens"
Option "metamodes" "nvidia-auto-select +0+0 {AllowGSYNC=On, AllowGSYNCCompatible=On}"
EndSection EndSection