mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae8ce83583 | |||
| 5c3348a9f5 | |||
| f299ffeb6e |
@@ -2,6 +2,16 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [v6.1.7]
|
||||
|
||||
### Changed
|
||||
- Fix Slash display enable
|
||||
|
||||
## [v6.1.6]
|
||||
|
||||
### Changed
|
||||
- Disable skia bindings for UI again. It causes failures in build pipelines and requires extra dependencies.
|
||||
|
||||
## [v6.1.5]
|
||||
|
||||
### Changed
|
||||
|
||||
Generated
+150
-58
@@ -250,7 +250,7 @@ checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
|
||||
|
||||
[[package]]
|
||||
name = "asusctl"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"env_logger",
|
||||
@@ -269,7 +269,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusd"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"concat-idents",
|
||||
@@ -296,7 +296,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusd-user"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"config-traits",
|
||||
"dirs",
|
||||
@@ -1084,7 +1084,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "config-traits"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ron",
|
||||
@@ -1237,6 +1237,18 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-text"
|
||||
version = "20.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9d2790b5c08465d49f8dc05c8bcae9fea467855947db39b0f8145c091aaced5"
|
||||
dependencies = [
|
||||
"core-foundation 0.9.4",
|
||||
"core-graphics 0.23.2",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core_maths"
|
||||
version = "0.1.1"
|
||||
@@ -1464,7 +1476,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "dmi_id"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"log",
|
||||
"udev 0.8.0",
|
||||
@@ -1482,19 +1494,6 @@ version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53"
|
||||
|
||||
[[package]]
|
||||
name = "drm"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98888c4bbd601524c11a7ed63f814b8825f420514f78e96f752c437ae9cbb5d1"
|
||||
dependencies = [
|
||||
"bitflags 2.8.0",
|
||||
"bytemuck",
|
||||
"drm-ffi 0.8.0",
|
||||
"drm-fourcc",
|
||||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "drm"
|
||||
version = "0.14.1"
|
||||
@@ -1503,29 +1502,19 @@ checksum = "80bc8c5c6c2941f70a55c15f8d9f00f9710ebda3ffda98075f996a0e6c92756f"
|
||||
dependencies = [
|
||||
"bitflags 2.8.0",
|
||||
"bytemuck",
|
||||
"drm-ffi 0.9.0",
|
||||
"drm-ffi",
|
||||
"drm-fourcc",
|
||||
"libc",
|
||||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "drm-ffi"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97c98727e48b7ccb4f4aea8cfe881e5b07f702d17b7875991881b41af7278d53"
|
||||
dependencies = [
|
||||
"drm-sys 0.7.0",
|
||||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "drm-ffi"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8e41459d99a9b529845f6d2c909eb9adf3b6d2f82635ae40be8de0601726e8b"
|
||||
dependencies = [
|
||||
"drm-sys 0.8.0",
|
||||
"drm-sys",
|
||||
"rustix",
|
||||
]
|
||||
|
||||
@@ -1535,16 +1524,6 @@ version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4"
|
||||
|
||||
[[package]]
|
||||
name = "drm-sys"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd39dde40b6e196c2e8763f23d119ddb1a8714534bf7d77fa97a65b0feda3986"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"linux-raw-sys 0.6.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "drm-sys"
|
||||
version = "0.8.0"
|
||||
@@ -1555,6 +1534,20 @@ dependencies = [
|
||||
"linux-raw-sys 0.6.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dwrote"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70182709525a3632b2ba96b6569225467b18ecb4a77f46d255f713a6bebf05fd"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"winapi",
|
||||
"wio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.13.0"
|
||||
@@ -1677,6 +1670,29 @@ dependencies = [
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "femtovg"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9bec3fb78abd18f7bbbde01f22f467c47c5a9c043e791802f82da0cf16066d1"
|
||||
dependencies = [
|
||||
"bitflags 2.8.0",
|
||||
"bytemuck",
|
||||
"fnv",
|
||||
"glow",
|
||||
"image",
|
||||
"imgref",
|
||||
"log",
|
||||
"lru",
|
||||
"rgb",
|
||||
"rustybuzz 0.20.1",
|
||||
"slotmap",
|
||||
"unicode-bidi",
|
||||
"unicode-segmentation",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "field-offset"
|
||||
version = "0.3.6"
|
||||
@@ -1906,7 +1922,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce852e998d3ca5e4a97014fb31c940dc5ef344ec7d364984525fd11e8a547e6a"
|
||||
dependencies = [
|
||||
"bitflags 2.8.0",
|
||||
"drm 0.14.1",
|
||||
"drm",
|
||||
"drm-fourcc",
|
||||
"gbm-sys",
|
||||
"libc",
|
||||
@@ -2550,14 +2566,13 @@ version = "1.10.0"
|
||||
source = "git+https://github.com/slint-ui/slint.git#7c75720c9a0ba3d635380601471d1a5aa48ce1d3"
|
||||
dependencies = [
|
||||
"calloop 0.14.2",
|
||||
"drm 0.14.1",
|
||||
"drm",
|
||||
"gbm",
|
||||
"glutin",
|
||||
"i-slint-common",
|
||||
"i-slint-core",
|
||||
"i-slint-renderer-skia",
|
||||
"i-slint-renderer-femtovg",
|
||||
"input",
|
||||
"memmap2",
|
||||
"nix",
|
||||
"raw-window-handle",
|
||||
"xkbcommon",
|
||||
@@ -2574,7 +2589,6 @@ dependencies = [
|
||||
"i-slint-common",
|
||||
"i-slint-core",
|
||||
"i-slint-core-macros",
|
||||
"i-slint-renderer-skia",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2594,6 +2608,7 @@ dependencies = [
|
||||
"i-slint-common",
|
||||
"i-slint-core",
|
||||
"i-slint-core-macros",
|
||||
"i-slint-renderer-femtovg",
|
||||
"i-slint-renderer-skia",
|
||||
"lyon_path",
|
||||
"muda",
|
||||
@@ -2705,6 +2720,35 @@ dependencies = [
|
||||
"syn 2.0.98",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-renderer-femtovg"
|
||||
version = "1.10.0"
|
||||
source = "git+https://github.com/slint-ui/slint.git#7c75720c9a0ba3d635380601471d1a5aa48ce1d3"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"const-field-offset",
|
||||
"core-foundation 0.9.4",
|
||||
"core-text",
|
||||
"derive_more",
|
||||
"dwrote",
|
||||
"femtovg",
|
||||
"glow",
|
||||
"i-slint-common",
|
||||
"i-slint-core",
|
||||
"i-slint-core-macros",
|
||||
"imgref",
|
||||
"lyon_path",
|
||||
"pin-weak",
|
||||
"rgb",
|
||||
"scoped-tls-hkt",
|
||||
"ttf-parser 0.25.1",
|
||||
"unicode-script",
|
||||
"unicode-segmentation",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-renderer-skia"
|
||||
version = "1.10.0"
|
||||
@@ -3370,6 +3414,12 @@ dependencies = [
|
||||
"imgref",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lru"
|
||||
version = "0.12.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38"
|
||||
|
||||
[[package]]
|
||||
name = "lyon_algorithms"
|
||||
version = "1.0.5"
|
||||
@@ -4693,7 +4743,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog-control-center"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"concat-idents",
|
||||
@@ -4724,7 +4774,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_anime"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"gif 0.12.0",
|
||||
@@ -4738,7 +4788,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_aura"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"log",
|
||||
@@ -4749,7 +4799,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_dbus"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"rog_anime",
|
||||
@@ -4763,7 +4813,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_platform"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"concat-idents",
|
||||
"inotify",
|
||||
@@ -4776,7 +4826,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_profiles"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"log",
|
||||
"rog_platform",
|
||||
@@ -4787,7 +4837,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_scsi"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"ron",
|
||||
"serde",
|
||||
@@ -4797,7 +4847,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_simulators"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"log",
|
||||
"rog_anime",
|
||||
@@ -4807,7 +4857,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_slash"
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"serde",
|
||||
@@ -4912,8 +4962,26 @@ dependencies = [
|
||||
"log",
|
||||
"smallvec",
|
||||
"ttf-parser 0.24.1",
|
||||
"unicode-bidi-mirroring",
|
||||
"unicode-ccc",
|
||||
"unicode-bidi-mirroring 0.3.0",
|
||||
"unicode-ccc 0.3.0",
|
||||
"unicode-properties",
|
||||
"unicode-script",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustybuzz"
|
||||
version = "0.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702"
|
||||
dependencies = [
|
||||
"bitflags 2.8.0",
|
||||
"bytemuck",
|
||||
"core_maths",
|
||||
"log",
|
||||
"smallvec",
|
||||
"ttf-parser 0.25.1",
|
||||
"unicode-bidi-mirroring 0.4.0",
|
||||
"unicode-ccc 0.4.0",
|
||||
"unicode-properties",
|
||||
"unicode-script",
|
||||
]
|
||||
@@ -5167,6 +5235,7 @@ dependencies = [
|
||||
"i-slint-backend-selector",
|
||||
"i-slint-core",
|
||||
"i-slint-core-macros",
|
||||
"i-slint-renderer-femtovg",
|
||||
"num-traits",
|
||||
"once_cell",
|
||||
"pin-weak",
|
||||
@@ -5304,7 +5373,6 @@ dependencies = [
|
||||
"bytemuck",
|
||||
"cfg_aliases",
|
||||
"core-graphics 0.24.0",
|
||||
"drm 0.12.0",
|
||||
"fastrand",
|
||||
"foreign-types",
|
||||
"js-sys",
|
||||
@@ -5910,6 +5978,9 @@ name = "ttf-parser"
|
||||
version = "0.25.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
|
||||
dependencies = [
|
||||
"core_maths",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typed-index-collections"
|
||||
@@ -5994,12 +6065,24 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64af057ad7466495ca113126be61838d8af947f41d93a949980b2389a118082f"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi-mirroring"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ccc"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "260bc6647b3893a9a90668360803a15f96b85a5257b1c3a0c3daf6ae2496de42"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ccc"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.16"
|
||||
@@ -6068,7 +6151,7 @@ dependencies = [
|
||||
"log",
|
||||
"pico-args",
|
||||
"roxmltree",
|
||||
"rustybuzz",
|
||||
"rustybuzz 0.18.0",
|
||||
"simplecss",
|
||||
"siphasher",
|
||||
"strict-num",
|
||||
@@ -6930,6 +7013,15 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wio"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rt"
|
||||
version = "0.33.0"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
[workspace.package]
|
||||
version = "6.1.5"
|
||||
version = "6.1.7"
|
||||
rust-version = "1.82"
|
||||
license = "MPL-2.0"
|
||||
readme = "README.md"
|
||||
|
||||
@@ -575,6 +575,7 @@ fn handle_slash(cmd: &SlashCommand) -> Result<(), Box<dyn std::error::Error>> {
|
||||
&& cmd.show_on_sleep.is_none()
|
||||
&& cmd.show_on_battery.is_none()
|
||||
&& cmd.show_battery_warning.is_none()
|
||||
// && cmd.show_on_lid_closed.is_none()
|
||||
&& cmd.mode.is_none()
|
||||
&& !cmd.list
|
||||
&& !cmd.enable
|
||||
@@ -620,6 +621,9 @@ fn handle_slash(cmd: &SlashCommand) -> Result<(), Box<dyn std::error::Error>> {
|
||||
if let Some(show) = cmd.show_battery_warning {
|
||||
proxy.set_show_battery_warning(show)?;
|
||||
}
|
||||
// if let Some(show) = cmd.show_on_lid_closed {
|
||||
// proxy.set_show_on_lid_closed(show)?;
|
||||
// }
|
||||
}
|
||||
if cmd.list {
|
||||
let res = SlashMode::list();
|
||||
|
||||
@@ -26,6 +26,8 @@ pub struct SlashCommand {
|
||||
pub show_on_sleep: Option<bool>,
|
||||
#[options(short = "b", meta = "", help = "Show the animation on battery")]
|
||||
pub show_on_battery: Option<bool>,
|
||||
// #[options(short = "L", meta = "", help = "Show the animation on lid closed")]
|
||||
// pub show_on_lid_closed: Option<bool>,
|
||||
#[options(
|
||||
short = "w",
|
||||
meta = "",
|
||||
|
||||
@@ -18,6 +18,7 @@ pub struct SlashConfig {
|
||||
pub show_on_sleep: bool,
|
||||
pub show_on_battery: bool,
|
||||
pub show_battery_warning: bool,
|
||||
pub show_on_lid_closed: bool,
|
||||
}
|
||||
|
||||
impl Default for SlashConfig {
|
||||
@@ -33,6 +34,7 @@ impl Default for SlashConfig {
|
||||
show_on_sleep: true,
|
||||
show_on_battery: true,
|
||||
show_battery_warning: true,
|
||||
show_on_lid_closed: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@ use config::SlashConfig;
|
||||
use futures_util::lock::{Mutex, MutexGuard};
|
||||
use rog_platform::hid_raw::HidRaw;
|
||||
use rog_platform::usb_raw::USBRaw;
|
||||
use rog_slash::usb::{get_options_packet, pkt_set_mode, pkts_for_init};
|
||||
use rog_slash::SlashType;
|
||||
use rog_slash::usb::{slash_pkt_enable, slash_pkt_init, slash_pkt_options, slash_pkt_set_mode};
|
||||
|
||||
use crate::error::RogError;
|
||||
|
||||
@@ -46,14 +45,14 @@ impl Slash {
|
||||
pub async fn do_initialization(&self) -> Result<(), RogError> {
|
||||
// Don't try to initialise these models as the asus drivers already did
|
||||
let config = self.config.lock().await;
|
||||
if !matches!(config.slash_type, SlashType::GA605 | SlashType::GU605) {
|
||||
for pkt in &pkts_for_init(config.slash_type) {
|
||||
self.write_bytes(pkt).await?;
|
||||
}
|
||||
for pkt in &slash_pkt_init(config.slash_type) {
|
||||
self.write_bytes(pkt).await?;
|
||||
}
|
||||
self.write_bytes(&slash_pkt_enable(config.slash_type, config.enabled))
|
||||
.await?;
|
||||
|
||||
// Apply config upon initialization
|
||||
let option_packets = get_options_packet(
|
||||
let option_packets = slash_pkt_options(
|
||||
config.slash_type,
|
||||
config.enabled,
|
||||
config.brightness,
|
||||
@@ -61,7 +60,7 @@ impl Slash {
|
||||
);
|
||||
self.write_bytes(&option_packets).await?;
|
||||
|
||||
let mode_packets = pkt_set_mode(config.slash_type, config.display_mode);
|
||||
let mode_packets = slash_pkt_set_mode(config.slash_type, config.display_mode);
|
||||
// self.node.write_bytes(&mode_packets[0])?;
|
||||
self.write_bytes(&mode_packets[1]).await?;
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
use config_traits::StdConfig;
|
||||
use log::{debug, error, warn};
|
||||
use rog_slash::usb::{
|
||||
get_battery_saver_packet, get_boot_packet, get_low_battery_packet, get_options_packet,
|
||||
get_shutdown_packet, get_sleep_packet, pkt_save, pkt_set_mode,
|
||||
slash_pkt_battery_saver, slash_pkt_boot, slash_pkt_enable, slash_pkt_lid_closed,
|
||||
slash_pkt_low_battery, slash_pkt_options, slash_pkt_save, slash_pkt_set_mode,
|
||||
slash_pkt_shutdown, slash_pkt_sleep,
|
||||
};
|
||||
use rog_slash::{DeviceState, SlashMode};
|
||||
use zbus::zvariant::OwnedObjectPath;
|
||||
@@ -58,7 +59,14 @@ impl SlashZbus {
|
||||
config.brightness
|
||||
};
|
||||
self.0
|
||||
.write_bytes(&get_options_packet(
|
||||
.write_bytes(&slash_pkt_enable(config.slash_type, enabled))
|
||||
.await
|
||||
.map_err(|err| {
|
||||
warn!("ctrl_slash::enable {}", err);
|
||||
})
|
||||
.ok();
|
||||
self.0
|
||||
.write_bytes(&slash_pkt_options(
|
||||
config.slash_type,
|
||||
enabled,
|
||||
brightness,
|
||||
@@ -88,7 +96,7 @@ impl SlashZbus {
|
||||
let mut config = self.0.lock_config().await;
|
||||
let enabled = brightness > 0;
|
||||
self.0
|
||||
.write_bytes(&get_options_packet(
|
||||
.write_bytes(&slash_pkt_options(
|
||||
config.slash_type,
|
||||
enabled,
|
||||
brightness,
|
||||
@@ -116,7 +124,7 @@ impl SlashZbus {
|
||||
async fn set_interval(&self, interval: u8) {
|
||||
let mut config = self.0.lock_config().await;
|
||||
self.0
|
||||
.write_bytes(&get_options_packet(
|
||||
.write_bytes(&slash_pkt_options(
|
||||
config.slash_type, config.enabled, config.brightness, interval,
|
||||
))
|
||||
.await
|
||||
@@ -140,10 +148,12 @@ impl SlashZbus {
|
||||
async fn set_mode(&self, mode: SlashMode) -> zbus::Result<()> {
|
||||
let mut config = self.0.lock_config().await;
|
||||
|
||||
let command_packets = pkt_set_mode(config.slash_type, mode);
|
||||
let command_packets = slash_pkt_set_mode(config.slash_type, mode);
|
||||
// self.node.write_bytes(&command_packets[0])?;
|
||||
self.0.write_bytes(&command_packets[1]).await?;
|
||||
self.0.write_bytes(&pkt_save(config.slash_type)).await?;
|
||||
self.0
|
||||
.write_bytes(&slash_pkt_save(config.slash_type))
|
||||
.await?;
|
||||
|
||||
config.display_mode = mode;
|
||||
config.write();
|
||||
@@ -167,7 +177,7 @@ impl SlashZbus {
|
||||
async fn set_show_on_boot(&self, enable: bool) -> zbus::Result<()> {
|
||||
let mut config = self.0.lock_config().await;
|
||||
self.0
|
||||
.write_bytes(&get_boot_packet(config.slash_type, enable))
|
||||
.write_bytes(&slash_pkt_boot(config.slash_type, enable))
|
||||
.await?;
|
||||
config.show_on_boot = enable;
|
||||
config.write();
|
||||
@@ -184,7 +194,7 @@ impl SlashZbus {
|
||||
async fn set_show_on_sleep(&self, enable: bool) -> zbus::Result<()> {
|
||||
let mut config = self.0.lock_config().await;
|
||||
self.0
|
||||
.write_bytes(&get_sleep_packet(config.slash_type, enable))
|
||||
.write_bytes(&slash_pkt_sleep(config.slash_type, enable))
|
||||
.await?;
|
||||
config.show_on_sleep = enable;
|
||||
config.write();
|
||||
@@ -201,7 +211,7 @@ impl SlashZbus {
|
||||
async fn set_show_on_shutdown(&self, enable: bool) -> zbus::Result<()> {
|
||||
let mut config = self.0.lock_config().await;
|
||||
self.0
|
||||
.write_bytes(&get_shutdown_packet(config.slash_type, enable))
|
||||
.write_bytes(&slash_pkt_shutdown(config.slash_type, enable))
|
||||
.await?;
|
||||
config.show_on_shutdown = enable;
|
||||
config.write();
|
||||
@@ -218,7 +228,7 @@ impl SlashZbus {
|
||||
async fn set_show_on_battery(&self, enable: bool) -> zbus::Result<()> {
|
||||
let mut config = self.0.lock_config().await;
|
||||
self.0
|
||||
.write_bytes(&get_battery_saver_packet(config.slash_type, enable))
|
||||
.write_bytes(&slash_pkt_battery_saver(config.slash_type, enable))
|
||||
.await?;
|
||||
config.show_on_battery = enable;
|
||||
config.write();
|
||||
@@ -235,12 +245,32 @@ impl SlashZbus {
|
||||
async fn set_show_battery_warning(&self, enable: bool) -> zbus::Result<()> {
|
||||
let mut config = self.0.lock_config().await;
|
||||
self.0
|
||||
.write_bytes(&get_low_battery_packet(config.slash_type, enable))
|
||||
.write_bytes(&slash_pkt_low_battery(config.slash_type, enable))
|
||||
.await?;
|
||||
config.show_battery_warning = enable;
|
||||
config.write();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
async fn show_on_lid_closed(&self) -> zbus::fdo::Result<bool> {
|
||||
let config = self.0.lock_config().await;
|
||||
Ok(config.show_on_lid_closed)
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
async fn set_show_on_lid_closed(&self, enable: bool) -> zbus::Result<()> {
|
||||
let mut config = self.0.lock_config().await;
|
||||
self.0
|
||||
.write_bytes(&slash_pkt_lid_closed(config.slash_type, enable))
|
||||
.await?;
|
||||
self.0
|
||||
.write_bytes(&slash_pkt_save(config.slash_type))
|
||||
.await?;
|
||||
config.show_on_lid_closed = enable;
|
||||
config.write();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Reloadable for SlashZbus {
|
||||
@@ -248,7 +278,7 @@ impl Reloadable for SlashZbus {
|
||||
debug!("reloading slash settings");
|
||||
let config = self.0.lock_config().await;
|
||||
self.0
|
||||
.write_bytes(&get_options_packet(
|
||||
.write_bytes(&slash_pkt_options(
|
||||
config.slash_type,
|
||||
config.enabled,
|
||||
config.brightness,
|
||||
@@ -272,12 +302,12 @@ impl Reloadable for SlashZbus {
|
||||
};
|
||||
}
|
||||
|
||||
write_bytes_with_warning!(get_boot_packet, show_on_boot, "show_on_boot");
|
||||
write_bytes_with_warning!(get_sleep_packet, show_on_sleep, "show_on_sleep");
|
||||
write_bytes_with_warning!(get_shutdown_packet, show_on_shutdown, "show_on_shutdown");
|
||||
write_bytes_with_warning!(get_battery_saver_packet, show_on_battery, "show_on_battery");
|
||||
write_bytes_with_warning!(slash_pkt_boot, show_on_boot, "show_on_boot");
|
||||
write_bytes_with_warning!(slash_pkt_sleep, show_on_sleep, "show_on_sleep");
|
||||
write_bytes_with_warning!(slash_pkt_shutdown, show_on_shutdown, "show_on_shutdown");
|
||||
write_bytes_with_warning!(slash_pkt_battery_saver, show_on_battery, "show_on_battery");
|
||||
write_bytes_with_warning!(
|
||||
get_low_battery_packet,
|
||||
slash_pkt_low_battery,
|
||||
show_battery_warning,
|
||||
"show_battery_warning"
|
||||
);
|
||||
|
||||
@@ -53,8 +53,8 @@ features = [
|
||||
"gettext",
|
||||
"accessibility",
|
||||
"backend-winit-wayland",
|
||||
# "renderer-femtovg",
|
||||
"renderer-skia-opengl",
|
||||
"renderer-femtovg",
|
||||
# "renderer-skia-opengl",
|
||||
]
|
||||
|
||||
[build-dependencies.slint-build]
|
||||
|
||||
+102
-63
@@ -35,10 +35,21 @@ async fn main() -> Result<()> {
|
||||
// If we're running under gamescope we have to set WAYLAND_DISPLAY for winit to
|
||||
// use
|
||||
if let Ok(gamescope) = env::var("GAMESCOPE_WAYLAND_DISPLAY") {
|
||||
dbg!(1);
|
||||
if !gamescope.is_empty() {
|
||||
dbg!(2);
|
||||
env::set_var("WAYLAND_DISPLAY", gamescope);
|
||||
}
|
||||
// gamescope-0
|
||||
else if let Ok(wayland) = env::var("WAYLAND_DISPLAY") {
|
||||
dbg!(3);
|
||||
if wayland.is_empty() {
|
||||
dbg!(4);
|
||||
env::set_var("WAYLAND_DISPLAY", "gamescope-0");
|
||||
}
|
||||
}
|
||||
}
|
||||
dbg!("SHITR");
|
||||
|
||||
// Try to open a proxy and check for app state first
|
||||
{
|
||||
@@ -92,7 +103,7 @@ async fn main() -> Result<()> {
|
||||
let board_name = dmi.board_name;
|
||||
let prod_family = dmi.product_family;
|
||||
info!("Running on {board_name}, product: {prod_family}");
|
||||
let is_rog_ally = prod_family == "RC71L" || prod_family == "RC72L";
|
||||
let is_rog_ally = board_name == "RC71L" || board_name == "RC72L" || prod_family == "ROG Ally";
|
||||
|
||||
let args: Vec<String> = args().skip(1).collect();
|
||||
|
||||
@@ -163,73 +174,101 @@ async fn main() -> Result<()> {
|
||||
thread::spawn(move || {
|
||||
let mut state = AppState::StartingUp;
|
||||
loop {
|
||||
// save as a var, don't hold the lock the entire time or deadlocks happen
|
||||
if let Ok(app_state) = app_state.lock() {
|
||||
state = *app_state;
|
||||
}
|
||||
if is_rog_ally {
|
||||
let config_copy_2 = config.clone();
|
||||
let newui = setup_window(config.clone());
|
||||
newui.window().on_close_requested(move || {
|
||||
exit(0);
|
||||
});
|
||||
|
||||
// This sleep is required to give the event loop time to react
|
||||
sleep(Duration::from_millis(300));
|
||||
if state == AppState::MainWindowShouldOpen {
|
||||
if let Ok(mut app_state) = app_state.lock() {
|
||||
*app_state = AppState::MainWindowOpen;
|
||||
}
|
||||
|
||||
let config_copy = config.clone();
|
||||
let app_state_copy = app_state.clone();
|
||||
slint::invoke_from_event_loop(move || {
|
||||
UI.with(|ui| {
|
||||
let app_state_copy = app_state_copy.clone();
|
||||
let mut ui = ui.borrow_mut();
|
||||
if let Some(ui) = ui.as_mut() {
|
||||
ui.window().show().unwrap();
|
||||
ui.window().on_close_requested(move || {
|
||||
if let Ok(mut app_state) = app_state_copy.lock() {
|
||||
*app_state = AppState::MainWindowClosed;
|
||||
}
|
||||
slint::CloseRequestResponse::HideWindow
|
||||
});
|
||||
} else {
|
||||
let config_copy_2 = config_copy.clone();
|
||||
let newui = setup_window(config_copy);
|
||||
newui.window().on_close_requested(move || {
|
||||
if let Ok(mut app_state) = app_state_copy.lock() {
|
||||
*app_state = AppState::MainWindowClosed;
|
||||
}
|
||||
slint::CloseRequestResponse::HideWindow
|
||||
});
|
||||
|
||||
let ui_copy = newui.as_weak();
|
||||
newui
|
||||
.window()
|
||||
.set_rendering_notifier(move |s, _| {
|
||||
if let slint::RenderingState::RenderingSetup = s {
|
||||
let config = config_copy_2.clone();
|
||||
ui_copy
|
||||
.upgrade_in_event_loop(move |w| {
|
||||
let fullscreen =
|
||||
config.lock().is_ok_and(|c| c.start_fullscreen);
|
||||
if fullscreen && !w.window().is_fullscreen() {
|
||||
w.window().set_fullscreen(fullscreen);
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
let ui_copy = newui.as_weak();
|
||||
newui
|
||||
.window()
|
||||
.set_rendering_notifier(move |s, _| {
|
||||
if let slint::RenderingState::BeforeRendering = s {
|
||||
let config = config_copy_2.clone();
|
||||
ui_copy
|
||||
.upgrade_in_event_loop(move |w| {
|
||||
let fullscreen =
|
||||
config.lock().is_ok_and(|c| c.start_fullscreen);
|
||||
if fullscreen && !w.window().is_fullscreen() {
|
||||
w.window().set_fullscreen(fullscreen);
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
ui.replace(newui);
|
||||
}
|
||||
});
|
||||
})
|
||||
.unwrap();
|
||||
} else if state == AppState::QuitApp {
|
||||
slint::quit_event_loop().unwrap();
|
||||
exit(0);
|
||||
} else if state != AppState::MainWindowOpen {
|
||||
if let Ok(config) = config.lock() {
|
||||
if !config.run_in_background {
|
||||
slint::quit_event_loop().unwrap();
|
||||
exit(0);
|
||||
})
|
||||
.ok();
|
||||
} else {
|
||||
// save as a var, don't hold the lock the entire time or deadlocks happen
|
||||
if let Ok(app_state) = app_state.lock() {
|
||||
state = *app_state;
|
||||
}
|
||||
|
||||
// This sleep is required to give the event loop time to react
|
||||
sleep(Duration::from_millis(300));
|
||||
if state == AppState::MainWindowShouldOpen {
|
||||
if let Ok(mut app_state) = app_state.lock() {
|
||||
*app_state = AppState::MainWindowOpen;
|
||||
}
|
||||
|
||||
let config_copy = config.clone();
|
||||
let app_state_copy = app_state.clone();
|
||||
slint::invoke_from_event_loop(move || {
|
||||
UI.with(|ui| {
|
||||
let app_state_copy = app_state_copy.clone();
|
||||
let mut ui = ui.borrow_mut();
|
||||
if let Some(ui) = ui.as_mut() {
|
||||
ui.window().show().unwrap();
|
||||
ui.window().on_close_requested(move || {
|
||||
if let Ok(mut app_state) = app_state_copy.lock() {
|
||||
*app_state = AppState::MainWindowClosed;
|
||||
}
|
||||
slint::CloseRequestResponse::HideWindow
|
||||
});
|
||||
} else {
|
||||
let config_copy_2 = config_copy.clone();
|
||||
let newui = setup_window(config_copy);
|
||||
newui.window().on_close_requested(move || {
|
||||
if let Ok(mut app_state) = app_state_copy.lock() {
|
||||
*app_state = AppState::MainWindowClosed;
|
||||
}
|
||||
slint::CloseRequestResponse::HideWindow
|
||||
});
|
||||
|
||||
let ui_copy = newui.as_weak();
|
||||
newui
|
||||
.window()
|
||||
.set_rendering_notifier(move |s, _| {
|
||||
if let slint::RenderingState::RenderingSetup = s {
|
||||
let config = config_copy_2.clone();
|
||||
ui_copy
|
||||
.upgrade_in_event_loop(move |w| {
|
||||
let fullscreen = config
|
||||
.lock()
|
||||
.is_ok_and(|c| c.start_fullscreen);
|
||||
if fullscreen && !w.window().is_fullscreen() {
|
||||
w.window().set_fullscreen(fullscreen);
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
ui.replace(newui);
|
||||
}
|
||||
});
|
||||
})
|
||||
.unwrap();
|
||||
} else if state == AppState::QuitApp {
|
||||
slint::quit_event_loop().unwrap();
|
||||
exit(0);
|
||||
} else if state != AppState::MainWindowOpen {
|
||||
if let Ok(config) = config.lock() {
|
||||
if !config.run_in_background {
|
||||
slint::quit_event_loop().unwrap();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2025-02-15 22:46+0000\n"
|
||||
"POT-Creation-Date: 2025-02-15 22:50+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"
|
||||
|
||||
@@ -60,4 +60,10 @@ pub trait Slash {
|
||||
fn show_on_sleep(&self) -> zbus::Result<bool>;
|
||||
#[zbus(property)]
|
||||
fn set_show_on_sleep(&self, value: bool) -> zbus::Result<()>;
|
||||
|
||||
/// ShowOnLidClosed property
|
||||
#[zbus(property)]
|
||||
fn show_on_lid_closed(&self) -> zbus::Result<bool>;
|
||||
#[zbus(property)]
|
||||
fn set_show_on_lid_closed(&self, value: bool) -> zbus::Result<()>;
|
||||
}
|
||||
|
||||
+23
-10
@@ -62,7 +62,7 @@ pub const fn report_id(slash_type: SlashType) -> u8 {
|
||||
/// Get the two device initialization packets. These are required for device
|
||||
/// start after the laptop boots.
|
||||
#[inline]
|
||||
pub fn pkts_for_init(slash_type: SlashType) -> [SlashUsbPacket; 2] {
|
||||
pub fn slash_pkt_init(slash_type: SlashType) -> [SlashUsbPacket; 2] {
|
||||
let report_id = report_id(slash_type);
|
||||
|
||||
let mut pkt1 = [0; PACKET_SIZE];
|
||||
@@ -87,7 +87,20 @@ pub fn pkts_for_init(slash_type: SlashType) -> [SlashUsbPacket; 2] {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn pkt_save(slash_type: SlashType) -> SlashUsbPacket {
|
||||
pub const fn slash_pkt_enable(slash_type: SlashType, enabled: bool) -> SlashUsbPacket {
|
||||
let mut pkt = [0; PACKET_SIZE];
|
||||
pkt[0] = report_id(slash_type);
|
||||
pkt[1] = 0xd8;
|
||||
pkt[2] = 0x02;
|
||||
pkt[3] = 0x00;
|
||||
pkt[4] = 0x01;
|
||||
pkt[5] = if enabled { 0x00 } else { 0x80 };
|
||||
|
||||
pkt
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn slash_pkt_save(slash_type: SlashType) -> SlashUsbPacket {
|
||||
let mut pkt = [0; PACKET_SIZE];
|
||||
pkt[0] = report_id(slash_type);
|
||||
pkt[1] = 0xd4;
|
||||
@@ -100,7 +113,7 @@ pub const fn pkt_save(slash_type: SlashType) -> SlashUsbPacket {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn pkt_set_mode(slash_type: SlashType, mode: SlashMode) -> [SlashUsbPacket; 2] {
|
||||
pub const fn slash_pkt_set_mode(slash_type: SlashType, mode: SlashMode) -> [SlashUsbPacket; 2] {
|
||||
let report_id = report_id(slash_type);
|
||||
let mut pkt1 = [0; PACKET_SIZE];
|
||||
pkt1[0] = report_id;
|
||||
@@ -133,7 +146,7 @@ pub const fn pkt_set_mode(slash_type: SlashType, mode: SlashMode) -> [SlashUsbPa
|
||||
]
|
||||
}
|
||||
|
||||
pub const fn get_options_packet(
|
||||
pub const fn slash_pkt_options(
|
||||
slash_type: SlashType,
|
||||
enabled: bool,
|
||||
brightness: u8,
|
||||
@@ -146,7 +159,7 @@ pub const fn get_options_packet(
|
||||
]
|
||||
}
|
||||
|
||||
pub const fn get_boot_packet(slash_type: SlashType, enabled: bool) -> [u8; 12] {
|
||||
pub const fn slash_pkt_boot(slash_type: SlashType, enabled: bool) -> [u8; 12] {
|
||||
let typ = report_id(slash_type);
|
||||
let status = enabled as u8;
|
||||
[
|
||||
@@ -154,7 +167,7 @@ pub const fn get_boot_packet(slash_type: SlashType, enabled: bool) -> [u8; 12] {
|
||||
]
|
||||
}
|
||||
|
||||
pub const fn get_sleep_packet(slash_type: SlashType, enabled: bool) -> [u8; 12] {
|
||||
pub const fn slash_pkt_sleep(slash_type: SlashType, enabled: bool) -> [u8; 12] {
|
||||
let typ = report_id(slash_type);
|
||||
let status = (!enabled) as u8;
|
||||
[
|
||||
@@ -162,7 +175,7 @@ pub const fn get_sleep_packet(slash_type: SlashType, enabled: bool) -> [u8; 12]
|
||||
]
|
||||
}
|
||||
|
||||
pub const fn get_low_battery_packet(slash_type: SlashType, enabled: bool) -> [u8; 12] {
|
||||
pub const fn slash_pkt_low_battery(slash_type: SlashType, enabled: bool) -> [u8; 12] {
|
||||
let typ = report_id(slash_type);
|
||||
let status = enabled as u8;
|
||||
[
|
||||
@@ -170,7 +183,7 @@ pub const fn get_low_battery_packet(slash_type: SlashType, enabled: bool) -> [u8
|
||||
]
|
||||
}
|
||||
|
||||
pub const fn get_shutdown_packet(slash_type: SlashType, enabled: bool) -> [u8; 12] {
|
||||
pub const fn slash_pkt_shutdown(slash_type: SlashType, enabled: bool) -> [u8; 12] {
|
||||
let typ = report_id(slash_type);
|
||||
let status = enabled as u8;
|
||||
[
|
||||
@@ -178,7 +191,7 @@ pub const fn get_shutdown_packet(slash_type: SlashType, enabled: bool) -> [u8; 1
|
||||
]
|
||||
}
|
||||
|
||||
pub const fn get_battery_saver_packet(slash_type: SlashType, enabled: bool) -> [u8; 6] {
|
||||
pub const fn slash_pkt_battery_saver(slash_type: SlashType, enabled: bool) -> [u8; 6] {
|
||||
let typ = report_id(slash_type);
|
||||
let status = if enabled { 0x00 } else { 0x80 };
|
||||
[
|
||||
@@ -186,7 +199,7 @@ pub const fn get_battery_saver_packet(slash_type: SlashType, enabled: bool) -> [
|
||||
]
|
||||
}
|
||||
|
||||
pub const fn get_lid_closed_packet(slash_type: SlashType, enabled: bool) -> [u8; 7] {
|
||||
pub const fn slash_pkt_lid_closed(slash_type: SlashType, enabled: bool) -> [u8; 7] {
|
||||
let typ = report_id(slash_type);
|
||||
let status = if enabled { 0x00 } else { 0x80 };
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user