mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
Fix: prevent event loop error in ROGCC
Leftover code from parts of the refactor and tray crate change were causing the app to crash due to the UI trying to issue a command on the slint thread when the slint thread had not been created yet. Closes #579
This commit is contained in:
@@ -151,6 +151,7 @@ where
|
||||
}
|
||||
if !paths.is_empty() {
|
||||
let mut ctrl = Vec::new();
|
||||
paths.sort_by(|a, b| a.cmp(&b));
|
||||
for path in paths {
|
||||
ctrl.push(
|
||||
T::builder(&conn)
|
||||
@@ -1089,7 +1090,11 @@ fn handle_platform_new_properties(
|
||||
let attrs = attr.available_attrs()?;
|
||||
// dbg!(&name, &attrs);
|
||||
println!("{name}::");
|
||||
if attrs.contains(&"defalt_value".to_string()) {
|
||||
if attrs.contains(&"current_value".to_string()) {
|
||||
let v = attr.current_value()?;
|
||||
println!(" current_value: {v}");
|
||||
}
|
||||
if attrs.contains(&"default_value".to_string()) {
|
||||
let v = attr.default_value()?;
|
||||
println!(" default_value: {v:?}");
|
||||
}
|
||||
@@ -1101,18 +1106,10 @@ fn handle_platform_new_properties(
|
||||
let v = attr.max_value()?;
|
||||
println!(" max_value: {v}");
|
||||
}
|
||||
if attrs.contains(&"scalar_increment".to_string()) {
|
||||
let v = attr.scalar_increment()?;
|
||||
println!(" scalar_increment: {v}");
|
||||
}
|
||||
if attrs.contains(&"possible_values".to_string()) {
|
||||
let v = attr.possible_values()?;
|
||||
println!(" possible_values: {v:?}");
|
||||
}
|
||||
if attrs.contains(&"current_value".to_string()) {
|
||||
let v = attr.current_value()?;
|
||||
println!(" current_value: {v}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
use rog_platform::firmware_attributes::FirmwareAttributes;
|
||||
use zbus::Connection;
|
||||
|
||||
use log::error;
|
||||
use rog_platform::firmware_attributes::{AttrValue, Attribute};
|
||||
use rog_platform::firmware_attributes::{AttrValue, Attribute, FirmwareAttributes};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value};
|
||||
use zbus::{fdo, interface};
|
||||
use zbus::{fdo, interface, Connection};
|
||||
|
||||
use crate::error::RogError;
|
||||
use crate::ASUS_ZBUS_PATH;
|
||||
|
||||
@@ -268,7 +268,7 @@ impl DeviceManager {
|
||||
found.push(path);
|
||||
}
|
||||
} else {
|
||||
warn!("No serial for SCSI device");
|
||||
debug!("No serial for SCSI device: {:?}", device.devpath());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use std::borrow::BorrowMut;
|
||||
use std::env::args;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::exit;
|
||||
@@ -203,16 +202,6 @@ async fn main() -> Result<()> {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
slint::invoke_from_event_loop(move || {
|
||||
UI.with(|ui| {
|
||||
let mut ui = ui.take();
|
||||
if let Some(ui) = ui.borrow_mut() {
|
||||
ui.window().hide().unwrap();
|
||||
}
|
||||
});
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
sleep(Duration::from_millis(300));
|
||||
}
|
||||
@@ -223,42 +212,6 @@ async fn main() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// /// Bah.. the icon dosn't work on wayland anyway, but we'll leave it in for
|
||||
// now. fn load_icon() -> IconData {
|
||||
// let path = PathBuf::from(APP_ICON_PATH);
|
||||
// let mut rgba = Vec::new();
|
||||
// let mut height = 512;
|
||||
// let mut width = 512;
|
||||
// if path.exists() {
|
||||
// if let Ok(data) = std::fs::read(path)
|
||||
// .map_err(|e| error!("Error reading app icon: {e:?}"))
|
||||
// .map_err(|e| error!("Error opening app icon: {e:?}"))
|
||||
// {
|
||||
// let data = std::io::Cursor::new(data);
|
||||
// let decoder = png_pong::Decoder::new(data).unwrap().into_steps();
|
||||
// let png_pong::Step { raster, delay: _ } =
|
||||
// decoder.last().unwrap().unwrap();
|
||||
|
||||
// if let png_pong::PngRaster::Rgba8(ras) = raster {
|
||||
// rgba = ras.as_u8_slice().to_vec();
|
||||
// width = ras.width();
|
||||
// height = ras.height();
|
||||
// info!("Loaded app icon. Not actually supported in Wayland
|
||||
// yet"); }
|
||||
// }
|
||||
// } else {
|
||||
// error!("Missing {APP_ICON_PATH}");
|
||||
// }
|
||||
|
||||
// IconData {
|
||||
// height,
|
||||
// width,
|
||||
// rgba
|
||||
//
|
||||
//
|
||||
// / }
|
||||
// }
|
||||
|
||||
fn do_cli_help(parsed: &CliStart) -> bool {
|
||||
if parsed.help {
|
||||
println!("{}", CliStart::usage());
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-12-27 08:21+0000\n"
|
||||
"POT-Creation-Date: 2024-12-28 09:01+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"
|
||||
|
||||
@@ -1,24 +1,7 @@
|
||||
//! # D-Bus interface proxy for: `xyz.ljones.AsusArmoury`
|
||||
//!
|
||||
//! This code was generated by `zbus-xmlgen` `5.0.1` from D-Bus introspection data.
|
||||
//! Source: `Interface '/xyz/ljones/asus_armoury/nv_temp_target' from service 'xyz.ljones.Asusd' on system bus`.
|
||||
//!
|
||||
//! You may prefer to adapt it, instead of using it verbatim.
|
||||
//!
|
||||
//! More information can be found in the [Writing a client proxy] section of the zbus
|
||||
//! documentation.
|
||||
//!
|
||||
//! This type implements the [D-Bus standard interfaces], (`org.freedesktop.DBus.*`) for which the
|
||||
//! following zbus API can be used:
|
||||
//!
|
||||
//! * [`zbus::fdo::IntrospectableProxy`]
|
||||
//! * [`zbus::fdo::PropertiesProxy`]
|
||||
//! * [`zbus::fdo::PeerProxy`]
|
||||
//!
|
||||
//! Consequently `zbus-xmlgen` did not generate code for the above interfaces.
|
||||
//!
|
||||
//! [Writing a client proxy]: https://dbus2.github.io/zbus/client.html
|
||||
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
|
||||
//! `zbus-xmlgen system xyz.ljones.Asusd
|
||||
//! /xyz/ljones/asus_armoury/nv_temp_target`
|
||||
use zbus::proxy;
|
||||
#[proxy(
|
||||
interface = "xyz.ljones.AsusArmoury",
|
||||
@@ -41,16 +24,18 @@ pub trait AsusArmoury {
|
||||
#[zbus(property)]
|
||||
fn default_value(&self) -> zbus::Result<i32>;
|
||||
|
||||
/// MaxValue property. Maximum allowed current_value. Returns `-1` if unused or not set.
|
||||
/// MaxValue property. Maximum allowed current_value. Returns `-1` if unused
|
||||
/// or not set.
|
||||
#[zbus(property)]
|
||||
fn max_value(&self) -> zbus::Result<i32>;
|
||||
|
||||
/// MinValue property. Minimum allowed current_value. Returns `-1` if unused or not set.
|
||||
/// MinValue property. Minimum allowed current_value. Returns `-1` if unused
|
||||
/// or not set.
|
||||
#[zbus(property)]
|
||||
fn min_value(&self) -> zbus::Result<i32>;
|
||||
|
||||
/// PossibleValues property. Return the allowed values for `current_value` if used or set,
|
||||
/// otherwise the array is empty.
|
||||
/// PossibleValues property. Return the allowed values for `current_value`
|
||||
/// if used or set, otherwise the array is empty.
|
||||
#[zbus(property)]
|
||||
fn possible_values(&self) -> zbus::Result<Vec<i32>>;
|
||||
|
||||
@@ -58,8 +43,8 @@ pub trait AsusArmoury {
|
||||
#[zbus(property)]
|
||||
fn name(&self) -> zbus::Result<String>;
|
||||
|
||||
/// ScalarIncrement property. The increment steps that `current_value` may take. Returns
|
||||
/// `-1` if not used or set.
|
||||
/// ScalarIncrement property. The increment steps that `current_value` may
|
||||
/// take. Returns `-1` if not used or set.
|
||||
#[zbus(property)]
|
||||
fn scalar_increment(&self) -> zbus::Result<i32>;
|
||||
}
|
||||
|
||||
@@ -176,6 +176,9 @@ impl FirmwareAttributes {
|
||||
for entry in dir.flatten() {
|
||||
let base_path = entry.path();
|
||||
let name = base_path.file_name().unwrap().to_string_lossy().to_string();
|
||||
if name == "pending_reboot" {
|
||||
continue;
|
||||
}
|
||||
let help = read_string(&base_path.join("display_name")).unwrap_or_default();
|
||||
|
||||
let (default_value, possible_values, min_value, max_value, scalar_increment) =
|
||||
|
||||
Reference in New Issue
Block a user