Compare commits

..

3 Commits

Author SHA1 Message Date
Luke D. Jones fbdb0514d2 Prep new release 2024-05-17 10:18:54 +12:00
Luke D. Jones 1f5650d26b Add tests, G513L laptop 2024-05-17 09:41:40 +12:00
Luke D. Jones 14db97c476 Update G513 model DB entry 2024-05-15 10:04:02 +12:00
15 changed files with 197 additions and 54 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ echo '+cargo clippy --all -- -D warnings'
cargo clippy --all -- -D warnings
echo '+cargo test --all'
cargo test --all
cargo test --all --test-threads=1
echo '+cargo cranky'
cargo cranky
cargo cranky
+1 -1
View File
@@ -52,7 +52,7 @@ test:
<<: *rust_cache
script:
- mkdir -p .git/hooks > /dev/null
- cargo test --all
- cargo test --all --test-threads=1
release:
only:
+12
View File
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [v6.0.8]
### Added
- Add G512L laptop DB entry
### Changed
- Add more tests to verify things
### Fix
- asusctl incorrectly assumes fan-curves unsupported. Now fixed.
- try to fix ROGCC using CPU time.
## [v6.0.7]
### Changed
Generated
+15 -15
View File
@@ -123,7 +123,7 @@ checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
[[package]]
name = "asusctl"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"asusd",
"cargo-husky",
@@ -141,14 +141,14 @@ dependencies = [
[[package]]
name = "asusd"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"cargo-husky",
"concat-idents",
"config-traits",
"dmi_id",
"env_logger",
"futures-lite 2.3.0",
"futures-lite 1.13.0",
"inotify",
"log",
"logind-zbus",
@@ -167,7 +167,7 @@ dependencies = [
[[package]]
name = "asusd-user"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"cargo-husky",
"config-traits",
@@ -834,7 +834,7 @@ dependencies = [
[[package]]
name = "config-traits"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"cargo-husky",
"log",
@@ -941,7 +941,7 @@ checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636"
[[package]]
name = "cpuctl"
version = "6.0.7"
version = "6.0.8"
[[package]]
name = "cpufeatures"
@@ -1151,7 +1151,7 @@ dependencies = [
[[package]]
name = "dmi_id"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"log",
"udev 0.8.0",
@@ -3378,7 +3378,7 @@ dependencies = [
[[package]]
name = "rog-control-center"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"asusd",
"betrayer",
@@ -3410,7 +3410,7 @@ dependencies = [
[[package]]
name = "rog_anime"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"cargo-husky",
"dmi_id",
@@ -3427,7 +3427,7 @@ dependencies = [
[[package]]
name = "rog_aura"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"cargo-husky",
"dmi_id",
@@ -3441,7 +3441,7 @@ dependencies = [
[[package]]
name = "rog_dbus"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"asusd",
"cargo-husky",
@@ -3455,7 +3455,7 @@ dependencies = [
[[package]]
name = "rog_platform"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"cargo-husky",
"concat-idents",
@@ -3470,7 +3470,7 @@ dependencies = [
[[package]]
name = "rog_profiles"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"cargo-husky",
"log",
@@ -3484,7 +3484,7 @@ dependencies = [
[[package]]
name = "rog_simulators"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"log",
"rog_anime",
@@ -3494,7 +3494,7 @@ dependencies = [
[[package]]
name = "rog_slash"
version = "6.0.7"
version = "6.0.8"
dependencies = [
"cargo-husky",
"dmi_id",
+1 -1
View File
@@ -1,5 +1,5 @@
[workspace.package]
version = "6.0.7"
version = "6.0.8"
rust-version = "1.77"
license = "MPL-2.0"
readme = "README.md"
+5 -7
View File
@@ -5,7 +5,6 @@ use std::process::Command;
use std::thread::sleep;
use anime_cli::{AnimeActions, AnimeCommand};
use asusd::ctrl_fancurves::FAN_CURVE_ZBUS_NAME;
use aura_cli::{LedPowerCommand1, LedPowerCommand2};
use dmi_id::DMIID;
use fan_curve_cli::FanCurveCommand;
@@ -172,7 +171,7 @@ fn do_parsed(
handle_throttle_profile(&conn, supported_properties, cmd)?
}
Some(CliCommand::FanCurve(cmd)) => {
handle_fan_curve(&conn, supported_interfaces, cmd)?;
handle_fan_curve(&conn, cmd)?;
}
Some(CliCommand::Graphics(_)) => do_gfx(),
Some(CliCommand::Anime(cmd)) => handle_anime(&conn, cmd)?,
@@ -807,13 +806,13 @@ fn handle_throttle_profile(
fn handle_fan_curve(
conn: &Connection,
supported: &[String],
cmd: &FanCurveCommand,
) -> Result<(), Box<dyn std::error::Error>> {
if !supported.contains(&FAN_CURVE_ZBUS_NAME.to_string()) {
println!("Fan-curves not supported by either this kernel or by the laptop.");
let Ok(fan_proxy) = FanCurvesProxyBlocking::new(conn).map_err(|e| {
println!("Fan-curves not supported by either this kernel or by the laptop: {e:?}");
}) else {
return Err(ProfileError::NotSupported.into());
}
};
if !cmd.get_enabled && !cmd.default && cmd.mod_profile.is_none() {
if !cmd.help {
@@ -838,7 +837,6 @@ fn handle_fan_curve(
}
let plat_proxy = PlatformProxyBlocking::new(conn)?;
let fan_proxy = FanCurvesProxyBlocking::new(conn)?;
if cmd.get_enabled {
let profile = plat_proxy.throttle_thermal_policy()?;
let curves = fan_proxy.fan_curve_data(profile)?;
+68 -1
View File
@@ -134,12 +134,16 @@ impl AuraConfig {
#[cfg(test)]
mod tests {
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Colour};
use rog_aura::keyboard::AuraPowerState;
use rog_aura::{
AuraEffect, AuraModeNum, AuraZone, Colour, Direction, LedBrightness, PowerZones, Speed,
};
use super::AuraConfig;
#[test]
fn set_multizone_4key_config() {
std::env::set_var("BOARD_NAME", "");
let mut config = AuraConfig::new("19b6");
let effect = AuraEffect {
@@ -230,6 +234,7 @@ mod tests {
#[test]
fn set_multizone_multimode_config() {
std::env::set_var("BOARD_NAME", "");
let mut config = AuraConfig::new("19b6");
let effect = AuraEffect {
@@ -274,4 +279,66 @@ mod tests {
let sta = res.get(&AuraModeNum::Pulse).unwrap();
assert_eq!(sta.len(), 1);
}
#[test]
fn verify_0x1866_g531i() {
std::env::set_var("BOARD_NAME", "G513I");
let mut config = AuraConfig::new("1866");
assert_eq!(config.brightness, LedBrightness::Med);
assert_eq!(config.builtins.len(), 5);
assert_eq!(
config.builtins.first_entry().unwrap().get(),
&AuraEffect {
mode: AuraModeNum::Static,
zone: AuraZone::None,
colour1: Colour { r: 166, g: 0, b: 0 },
colour2: Colour { r: 0, g: 0, b: 0 },
speed: Speed::Med,
direction: Direction::Right
}
);
assert_eq!(config.enabled.states.len(), 1);
assert_eq!(
config.enabled.states[0],
AuraPowerState {
zone: PowerZones::KeyboardAndLightbar,
boot: true,
awake: true,
sleep: true,
shutdown: true
}
);
}
#[test]
fn verify_0x19b6_g634j() {
std::env::set_var("BOARD_NAME", "G634J");
let mut config = AuraConfig::new("19b6");
assert_eq!(config.brightness, LedBrightness::Med);
assert_eq!(config.builtins.len(), 12);
assert_eq!(
config.builtins.first_entry().unwrap().get(),
&AuraEffect {
mode: AuraModeNum::Static,
zone: AuraZone::None,
colour1: Colour { r: 166, g: 0, b: 0 },
colour2: Colour { r: 0, g: 0, b: 0 },
speed: Speed::Med,
direction: Direction::Right
}
);
assert_eq!(config.enabled.states.len(), 4);
assert_eq!(
config.enabled.states[0],
AuraPowerState {
zone: PowerZones::Keyboard,
boot: true,
awake: true,
sleep: true,
shutdown: true
}
);
}
}
+11 -2
View File
@@ -80,6 +80,15 @@
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "G512L",
product_id: "",
layout_name: "g512",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G513I",
product_id: "",
@@ -117,7 +126,7 @@
power_zones: [Keyboard],
),
(
device_name: "G513R",
device_name: "G513RC",
product_id: "",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
@@ -132,7 +141,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G531",
+6 -1
View File
@@ -1,3 +1,5 @@
use std::env;
use dmi_id::DMIID;
use log::{error, info, warn};
use serde_derive::{Deserialize, Serialize};
@@ -60,7 +62,10 @@ impl LedSupportData {
/// matches against laptops first, then will proceed with matching the
/// `device_name` if there are no DMI matches.
pub fn get_data(product_id: &str) -> Self {
let dmi = DMIID::new().unwrap_or_default();
let mut dmi = DMIID::new().unwrap_or_default();
if let Ok(board_name) = env::var("BOARD_NAME") {
dmi.board_name = board_name;
}
// let prod_family = dmi.product_family().expect("Could not get
// product_family");
+1 -1
View File
@@ -434,7 +434,7 @@ impl From<AuraZone> for i32 {
/// ```
#[typeshare]
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
#[derive(Debug, Clone, Deserialize, Serialize)]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct AuraEffect {
/// The effect type
pub mode: AuraModeNum,
+1 -1
View File
@@ -488,7 +488,7 @@ mod tests {
let rows = &data.key_rows;
for row in rows {
for k in &row.row {
if data.key_shapes.get(&k.1).is_some() {
if data.key_shapes.contains_key(&k.1) {
unused.remove(&k.1);
} else {
panic!("Key {:?} was missing matching shape {}", k.0, k.1);
+2 -3
View File
@@ -20,7 +20,6 @@ use supergfxctl::pci_device::{GfxMode, GfxPower};
use supergfxctl::zbus_proxy::DaemonProxy as SuperProxy;
use tokio::runtime::Runtime;
use tokio::task::JoinHandle;
use tokio::time::sleep;
use zbus::export::futures_util::StreamExt;
use crate::config::Config;
@@ -148,7 +147,7 @@ pub fn start_notifications(
if dev.is_dgpu() {
let enabled_notifications_copy = config.clone();
// Plain old thread is perfectly fine since most of this is potentially blocking
tokio::spawn(async move {
rt.spawn_blocking(move || {
let mut last_status = GfxPower::Unknown;
loop {
if let Ok(status) = dev.get_runtime_status() {
@@ -166,7 +165,7 @@ pub fn start_notifications(
}
last_status = status;
}
sleep(Duration::from_millis(500)).await;
std::thread::sleep(Duration::from_millis(500));
}
});
found_dgpu = true;
+27 -10
View File
@@ -2,6 +2,7 @@ use std::sync::{Arc, Mutex};
use log::{error, info};
use rog_aura::keyboard::LaptopAuraPower;
use rog_aura::{AuraDeviceType, PowerZones};
use rog_dbus::zbus_aura::AuraProxy;
use slint::{ComponentHandle, Model, RgbaColor, SharedString};
@@ -84,24 +85,40 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
set_ui_props_async!(handle, aura, AuraPageData, led_power);
set_ui_props_async!(handle, aura, AuraPageData, device_type);
if let Ok(pow3r) = aura.supported_power_zones().await {
if let Ok(mut pow3r) = aura.supported_power_zones().await {
let dev_type = aura
.device_type()
.await
.unwrap_or(AuraDeviceType::LaptopPost2021);
log::debug!("Available LED power modes {pow3r:?}");
handle
.upgrade_in_event_loop(move |handle| {
let power: Vec<SlintPowerZones> = pow3r.iter().map(|p| (*p).into()).collect();
let names: Vec<SharedString> = handle
.global::<AuraPageData>()
.get_power_zone_names()
.iter()
.collect();
let names: Vec<SharedString> =
pow3r.iter().map(|n| names[(*n) as usize].clone()).collect();
handle
.global::<AuraPageData>()
.set_supported_power_zones(power.as_slice().into());
handle
.global::<AuraPageData>()
.set_power_zone_names_old(names.as_slice().into());
if dev_type.is_old_laptop() {
// Need to add the specific KeyboardAndLightbar
if pow3r.contains(&PowerZones::Keyboard)
&& pow3r.contains(&PowerZones::Lightbar)
{
pow3r.push(PowerZones::KeyboardAndLightbar);
}
let names: Vec<SharedString> =
pow3r.iter().map(|n| names[(*n) as usize].clone()).collect();
handle
.global::<AuraPageData>()
.set_power_zone_names_old(names.as_slice().into());
} else {
let power: Vec<SlintPowerZones> =
pow3r.iter().map(|p| (*p).into()).collect();
handle
.global::<AuraPageData>()
.set_supported_power_zones(power.as_slice().into());
}
})
.ok();
}
@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-05-14 05:08+0000\n"
"POT-Creation-Date: 2024-05-16 21:41+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -642,42 +642,42 @@ msgctxt "AuraPowerGroupOld"
msgid "Sleep"
msgstr ""
#: rog-control-center/ui/main_window.slint:50
#: rog-control-center/ui/main_window.slint:51
msgctxt "MainWindow"
msgid "ROG"
msgstr ""
#: rog-control-center/ui/main_window.slint:52
#: rog-control-center/ui/main_window.slint:53
msgctxt "Menu1"
msgid "System Control"
msgstr ""
#: rog-control-center/ui/main_window.slint:53
#: rog-control-center/ui/main_window.slint:54
msgctxt "Menu2"
msgid "Keyboard Aura"
msgstr ""
#: rog-control-center/ui/main_window.slint:54
#: rog-control-center/ui/main_window.slint:55
msgctxt "Menu3"
msgid "AniMe Matrix"
msgstr ""
#: rog-control-center/ui/main_window.slint:55
#: rog-control-center/ui/main_window.slint:56
msgctxt "Menu4"
msgid "Fan Curves"
msgstr ""
#: rog-control-center/ui/main_window.slint:56
#: rog-control-center/ui/main_window.slint:57
msgctxt "Menu5"
msgid "App Settings"
msgstr ""
#: rog-control-center/ui/main_window.slint:57
#: rog-control-center/ui/main_window.slint:58
msgctxt "Menu6"
msgid "About"
msgstr ""
#: rog-control-center/ui/main_window.slint:69
#: rog-control-center/ui/main_window.slint:70
msgctxt "MainWindow"
msgid "Quit"
msgstr ""
+36
View File
@@ -5,6 +5,7 @@ import { SideBar } from "widgets/sidebar.slint";
import { PageAbout } from "pages/about.slint";
import { PageFans } from "pages/fans.slint";
import { PageAnime, AnimePageData } from "pages/anime.slint";
import { RogItem } from "widgets/common.slint";
import { PageAura } from "pages/aura.slint";
import { Node } from "widgets/graph.slint";
export { Node }
@@ -178,4 +179,39 @@ export component MainWindow inherits Window {
}
}
}
if SomeError.error_message != "": Rectangle {
x: 0px;
y: 0px;
width: root.width;
height: root.height;
padding: 10px;
background: Palette.background;
border-color: Palette.border;
border-width: 3px;
border-radius: 10px;
VerticalBox {
RogItem {
min-height: 50px;
max-height: 100px;
Text {
text <=> SomeError.error_message;
font-size: 18px;
}
}
Text {
text <=> SomeError.error_help;
horizontal-alignment: TextHorizontalAlignment.center;
vertical-alignment: TextVerticalAlignment.center;
}
}
}
}
export global SomeError {
in property <string> error_message: "";
in property <string> error_help: "";
}