Compare commits

..

4 Commits

Author SHA1 Message Date
Luke D. Jones 93d472fe74 Use correct defaults for GfxMode and GfxPower 2022-12-07 12:31:52 +13:00
Luke D. Jones 5469c73f11 Adjust gitlab pipeline to ignore checks for tags 2022-12-07 11:55:09 +13:00
Luke D. Jones ad95765954 Add missing files 2022-12-07 11:50:17 +13:00
Luke D. Jones e42a5bc3e9 ROGCC: don't require supergfxd to be running
Prep fixes for new tag and release
2022-12-07 11:47:27 +13:00
12 changed files with 161 additions and 118 deletions
+7 -2
View File
@@ -17,7 +17,7 @@ cache:
- target/release/.cargo-lock
before_script:
- apt-get update -qq && apt-get install -y -qq libudev-dev libgtk-3-dev
- apt-get update -qq && apt-get install -y -qq libudev-dev libgtk-3-dev grep
stages:
- format
@@ -26,13 +26,16 @@ stages:
- release
format:
image: rust:latest
except:
- tags
script:
- echo "nightly" > rust-toolchain
- rustup component add rustfmt
- cargo fmt --check
check:
except:
- tags
script:
- rustup component add clippy
- cargo check
@@ -41,6 +44,8 @@ check:
- cargo install cargo-cranky && cargo cranky
test:
except:
- tags
script:
- cargo test
+6
View File
@@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [v4.5.4]
### Changed
- ROGCC:: Allow ROGCC to run without supergfxd
- ROGCC: Tray/notifs now reads dGPU status directly via supergfx crate (supergfxd not required)
- Add rust-toolchain to force minimum rust version
## [v4.5.3]
### Changed
- Adjust how fan graph in ROGCC works, deny incorrect graphs
Generated
+9 -9
View File
@@ -149,7 +149,7 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]]
name = "asusctl"
version = "4.5.3"
version = "4.5.4"
dependencies = [
"daemon",
"gif",
@@ -727,7 +727,7 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
[[package]]
name = "daemon"
version = "4.5.3"
version = "4.5.4"
dependencies = [
"async-trait",
"concat-idents",
@@ -750,7 +750,7 @@ dependencies = [
[[package]]
name = "daemon-user"
version = "4.5.3"
version = "4.5.4"
dependencies = [
"dirs",
"rog_anime",
@@ -2593,7 +2593,7 @@ dependencies = [
[[package]]
name = "rog-control-center"
version = "4.5.3"
version = "4.5.4"
dependencies = [
"daemon",
"dirs",
@@ -2624,7 +2624,7 @@ dependencies = [
[[package]]
name = "rog_anime"
version = "4.5.3"
version = "4.5.4"
dependencies = [
"gif",
"glam",
@@ -2639,7 +2639,7 @@ dependencies = [
[[package]]
name = "rog_aura"
version = "4.5.3"
version = "4.5.4"
dependencies = [
"serde",
"serde_derive",
@@ -2650,7 +2650,7 @@ dependencies = [
[[package]]
name = "rog_dbus"
version = "4.5.3"
version = "4.5.4"
dependencies = [
"rog_anime",
"rog_aura",
@@ -2661,7 +2661,7 @@ dependencies = [
[[package]]
name = "rog_platform"
version = "4.5.3"
version = "4.5.4"
dependencies = [
"concat-idents",
"inotify",
@@ -2677,7 +2677,7 @@ dependencies = [
[[package]]
name = "rog_profiles"
version = "4.5.3"
version = "4.5.4"
dependencies = [
"serde",
"serde_derive",
+1 -1
View File
@@ -2,7 +2,7 @@
members = ["asusctl", "daemon", "daemon-user", "rog-platform", "rog-dbus", "rog-anime", "rog-aura", "rog-profiles", "rog-control-center"]
[workspace.package]
version = "4.5.3"
version = "4.5.4"
[workspace.dependencies]
async-trait = "^0.1"
-1
View File
@@ -11,7 +11,6 @@ mocking = []
[dependencies]
egui = { git = "https://github.com/flukejones/egui", branch = "wayland_dark_theme" }
eframe= { git = "https://github.com/flukejones/egui", branch = "wayland_dark_theme" }
#eframe= { git = "https://github.com/emilk/egui", default-features = false, features = ["dark-light", "default_fonts", "wgpu"] }
libappindicator = "0.7" # Tray icon
gtk = "0.15.5"
+1 -1
View File
@@ -6,7 +6,7 @@ use std::{
};
//use log::{error, info, warn};
use crate::{error::Error, notify::EnabledNotifications};
use crate::{error::Error, update_and_notify::EnabledNotifications};
const CFG_DIR: &str = "rog";
const CFG_FILE_NAME: &str = "rog-control-center.cfg";
+1 -1
View File
@@ -13,11 +13,11 @@ pub mod config;
pub mod error;
#[cfg(feature = "mocking")]
pub mod mocking;
pub mod notify;
pub mod pages;
pub mod startup_error;
pub mod system_state;
pub mod tray;
pub mod update_and_notify;
pub mod widgets;
#[cfg(feature = "mocking")]
+4 -4
View File
@@ -1,12 +1,12 @@
use eframe::{IconData, NativeOptions};
use log::{error, info, LevelFilter};
use rog_aura::layouts::KeyLayout;
use rog_control_center::notify::EnabledNotifications;
use rog_control_center::tray::init_tray;
use rog_control_center::update_and_notify::EnabledNotifications;
use rog_control_center::{
config::Config, error::Result, get_ipc_file, notify::start_notifications, on_tmp_dir_exists,
print_versions, startup_error::AppErrorShow, system_state::SystemState, RogApp,
RogDbusClientBlocking, SHOWING_GUI, SHOW_GUI,
config::Config, error::Result, get_ipc_file, on_tmp_dir_exists, print_versions,
startup_error::AppErrorShow, system_state::SystemState, update_and_notify::start_notifications,
RogApp, RogDbusClientBlocking, SHOWING_GUI, SHOW_GUI,
};
use rog_platform::supported::SupportedFunctions;
use std::sync::Mutex;
+7 -3
View File
@@ -12,7 +12,7 @@ use supergfxctl::{
zbus_proxy::DaemonProxyBlocking as GfxProxyBlocking,
};
use crate::{error::Result, notify::EnabledNotifications, RogDbusClientBlocking};
use crate::{error::Result, update_and_notify::EnabledNotifications, RogDbusClientBlocking};
use log::error;
#[derive(Clone, Debug, Default)]
@@ -219,6 +219,7 @@ impl AnimeState {
#[derive(Clone, Debug)]
pub struct GfxState {
pub has_supergfx: bool,
pub mode: GfxMode,
pub power_status: GfxPower,
}
@@ -226,8 +227,9 @@ pub struct GfxState {
impl GfxState {
pub fn new(_supported: &SupportedFunctions, dbus: &GfxProxyBlocking<'_>) -> Result<Self> {
Ok(Self {
mode: dbus.mode()?,
power_status: dbus.power()?,
has_supergfx: dbus.mode().is_ok(),
mode: dbus.mode().unwrap_or(GfxMode::None),
power_status: dbus.power().unwrap_or(GfxPower::Unknown),
})
}
}
@@ -235,6 +237,7 @@ impl GfxState {
impl Default for GfxState {
fn default() -> Self {
Self {
has_supergfx: false,
mode: GfxMode::None,
power_status: GfxPower::Unknown,
}
@@ -401,6 +404,7 @@ impl Default for SystemState {
drag_delta: Default::default(),
},
gfx_state: GfxState {
has_supergfx: false,
mode: GfxMode::None,
power_status: GfxPower::Unknown,
},
+19 -3
View File
@@ -351,6 +351,7 @@ impl ROGTray {
fn rebuild_and_update(
&mut self,
supported: &SupportedFunctions,
has_supergfx: bool,
current_gfx_mode: GfxMode,
charge_limit: u8,
panel_od: bool,
@@ -359,7 +360,9 @@ impl ROGTray {
self.menu_add_base();
self.menu_add_charge_limit(supported, charge_limit);
self.menu_add_panel_od(supported, panel_od);
self.menu_add_gpu(supported, current_gfx_mode);
if has_supergfx {
self.menu_add_gpu(supported, current_gfx_mode);
}
self.menu_update();
}
}
@@ -371,6 +374,12 @@ pub fn init_tray(
let (send, recv) = channel();
let _send = Arc::new(Mutex::new(send));
let has_supergfx = if let Ok(lock) = states.try_lock() {
lock.gfx_state.has_supergfx
} else {
false
};
std::thread::spawn(move || {
if gtk::init()
.map_err(|e| {
@@ -396,7 +405,7 @@ pub fn init_tray(
return;
}
};
tray.rebuild_and_update(&supported, GfxMode::Hybrid, 100, false);
tray.rebuild_and_update(&supported, has_supergfx, GfxMode::Hybrid, 100, false);
tray.set_icon(TRAY_APP_ICON);
info!("Started ROGTray");
@@ -405,6 +414,7 @@ pub fn init_tray(
if lock.tray_should_update {
tray.rebuild_and_update(
&supported,
has_supergfx,
lock.gfx_state.mode,
lock.power_state.charge_limit,
lock.bios.panel_overdrive,
@@ -419,7 +429,13 @@ pub fn init_tray(
GfxPower::AsusMuxDiscreet | GfxPower::Active => {
tray.set_icon("asus_notif_red");
}
GfxPower::Unknown => tray.set_icon("gpu-integrated"),
GfxPower::Unknown => {
if has_supergfx {
tray.set_icon("gpu-integrated");
} else {
tray.set_icon("asus_notif_red");
}
}
};
}
}
@@ -1,5 +1,9 @@
//! `update_and_notify` is responsible for both notifications *and* updating stored statuses
//! about the system state. This is done through either direct, intoify, zbus notifications
//! or similar methods.
use crate::{config::Config, error::Result, system_state::SystemState};
use log::{error, info, trace};
use log::{error, info, trace, warn};
use notify_rust::{Hint, Notification, NotificationHandle, Urgency};
use rog_dbus::{
zbus_anime::AnimeProxy, zbus_led::LedProxy, zbus_platform::RogBiosProxy,
@@ -12,8 +16,10 @@ use std::{
fmt::Display,
process::Command,
sync::{Arc, Mutex},
time::Duration,
};
use supergfxctl::{pci_device::GfxPower, zbus_proxy::DaemonProxy as SuperProxy};
use tokio::time::sleep;
use zbus::export::futures_util::{future, StreamExt};
const NOTIF_HEADER: &str = "ROG Control";
@@ -271,103 +277,101 @@ pub fn start_notifications(
};
});
recv_notif!(
SuperProxy,
receive_notify_gfx,
last_notification,
enabled_notifications,
page_states,
(gfx_state.mode),
(mode),
"Gfx mode changed to",
do_notification
);
// recv_notif!(
// SuperProxy,
// receive_notify_action,
// bios_notified,
// last_gfx_action_notif,
// enabled_notifications,
// [action],
// "Gfx mode change requires",
// do_gfx_action_notif
// );
tokio::spawn(async move {
let conn = zbus::Connection::system()
.await
.map_err(|e| {
error!("zbus signal: receive_notify_action: {e}");
e
})
.unwrap();
let proxy = SuperProxy::new(&conn)
.await
.map_err(|e| {
error!("zbus signal: receive_notify_action: {e}");
e
})
.unwrap();
if let Ok(mut p) = proxy.receive_notify_action().await {
info!("Started zbus signal thread: receive_notify_action");
while let Some(e) = p.next().await {
if let Ok(out) = e.args() {
let action = out.action();
do_gfx_action_notif("Gfx mode change requires", &format!("{action:?}",))
.map_err(|e| {
error!("zbus signal: do_gfx_action_notif: {e}");
e
})
.unwrap();
}
}
};
});
let notifs_enabled1 = enabled_notifications;
let last_notif = last_notification;
tokio::spawn(async move {
let conn = zbus::Connection::system()
.await
.map_err(|e| {
error!("zbus signal: receive_notify_gfx_status: {e}");
e
})
.unwrap();
let proxy = SuperProxy::new(&conn)
.await
.map_err(|e| {
error!("zbus signal: receive_notify_gfx_status: {e}");
e
})
.unwrap();
if let Ok(mut p) = proxy.receive_notify_gfx_status().await {
info!("Started zbus signal thread: receive_notify_gfx_status");
while let Some(e) = p.next().await {
if let Ok(out) = e.args() {
let status = out.status;
if status != GfxPower::Unknown {
if let Ok(config) = notifs_enabled1.lock() {
if config.all_enabled && config.receive_notify_gfx_status {
// Required check because status cycles through active/unknown/suspended
if let Ok(ref mut lock) = last_notif.lock() {
notify!(
do_gpu_status_notif("dGPU status changed:", &status),
lock
);
if let Ok(lock) = page_states.try_lock() {
use supergfxctl::pci_device::Device;
let dev = Device::find().unwrap();
let mut found_dgpu = false; // just for logging
for dev in dev {
if dev.is_dgpu() {
let notifs_enabled1 = enabled_notifications.clone();
let last_notif = last_notification.clone();
let page_states1 = page_states.clone();
// Plain old thread is perfectly fine since most of this is potentially blocking
tokio::spawn(async move {
let mut last_status = GfxPower::Unknown;
loop {
if let Ok(status) = dev.get_runtime_status() {
if status != GfxPower::Unknown && status != last_status {
if let Ok(config) = notifs_enabled1.lock() {
if config.all_enabled && config.receive_notify_gfx_status {
// Required check because status cycles through active/unknown/suspended
if let Ok(ref mut lock) = last_notif.lock() {
notify!(
do_gpu_status_notif(
"dGPU status changed:",
&status
),
lock
);
}
}
}
if let Ok(mut lock) = page_states1.lock() {
lock.gfx_state.power_status = status;
lock.set_notified();
}
last_status = status;
}
}
if let Ok(mut lock) = page_states.lock() {
lock.gfx_state.power_status = status;
lock.set_notified();
sleep(Duration::from_millis(500)).await;
}
});
found_dgpu = true;
break;
}
}
if !found_dgpu {
warn!("Did not find a dGPU on this system, dGPU status won't be avilable");
}
if lock.gfx_state.has_supergfx {
recv_notif!(
SuperProxy,
receive_notify_gfx,
last_notification,
enabled_notifications,
page_states,
(gfx_state.mode),
(mode),
"Gfx mode changed to",
do_notification
);
tokio::spawn(async move {
let conn = zbus::Connection::system()
.await
.map_err(|e| {
error!("zbus signal: receive_notify_action: {e}");
e
})
.unwrap();
let proxy = SuperProxy::new(&conn)
.await
.map_err(|e| {
error!("zbus signal: receive_notify_action: {e}");
e
})
.unwrap();
if let Ok(mut p) = proxy.receive_notify_action().await {
info!("Started zbus signal thread: receive_notify_action");
while let Some(e) = p.next().await {
if let Ok(out) = e.args() {
let action = out.action();
do_gfx_action_notif(
"Gfx mode change requires",
&format!("{action:?}",),
)
.map_err(|e| {
error!("zbus signal: do_gfx_action_notif: {e}");
e
})
.unwrap();
}
}
}
}
};
});
};
});
}
}
Ok(())
}
+9
View File
@@ -0,0 +1,9 @@
# If you see this, run "rustup self update" to get rustup 1.23 or newer.
# NOTE: above comment is for older `rustup` (before TOML support was added),
# which will treat the first line as the toolchain name, and therefore show it
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
[toolchain]
channel = "1.65.0"
components = [ "rustfmt", "clippy" ]