mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
daemon: revert zbus to 1.9.1 in daemon
This commit is contained in:
@@ -16,6 +16,7 @@ const ON_OFF: u8 = 0x04;
|
||||
use log::{error, info, warn};
|
||||
use rog_anime::{AniMeDataBuffer, AniMePacketType};
|
||||
use rusb::{Device, DeviceHandle};
|
||||
use zvariant::ObjectPath;
|
||||
use std::error::Error;
|
||||
use std::time::Duration;
|
||||
use zbus::dbus_interface;
|
||||
@@ -51,7 +52,7 @@ pub trait Dbus {
|
||||
impl crate::ZbusAdd for CtrlAnimeDisplay {
|
||||
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
||||
server
|
||||
.at("/org/asuslinux/Anime", self)
|
||||
.at(&ObjectPath::from_str_unchecked("/org/asuslinux/Anime"), self)
|
||||
.map_err(|err| {
|
||||
warn!("CtrlAnimeDisplay: add_to_server {}", err);
|
||||
err
|
||||
|
||||
@@ -2,6 +2,7 @@ use crate::{config::Config, error::RogError, GetSupported};
|
||||
//use crate::dbus::DbusEvents;
|
||||
use log::{info, warn};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use zvariant::ObjectPath;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
@@ -63,7 +64,7 @@ impl CtrlCharge {
|
||||
impl crate::ZbusAdd for CtrlCharge {
|
||||
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
||||
server
|
||||
.at("/org/asuslinux/Charge", self)
|
||||
.at(&ObjectPath::from_str_unchecked("/org/asuslinux/Charge"), self)
|
||||
.map_err(|err| {
|
||||
warn!("CtrlCharge: add_to_server {}", err);
|
||||
err
|
||||
|
||||
@@ -3,6 +3,7 @@ use crate::{config::Config, GetSupported};
|
||||
use log::{info, warn};
|
||||
use rog_types::profile::{FanLevel, Profile, ProfileEvent};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use zvariant::ObjectPath;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
@@ -180,7 +181,7 @@ impl DbusFanAndCpu {
|
||||
impl crate::ZbusAdd for DbusFanAndCpu {
|
||||
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
||||
server
|
||||
.at("/org/asuslinux/Profile", self)
|
||||
.at(&ObjectPath::from_str_unchecked("/org/asuslinux/Profile"), self)
|
||||
.map_err(|err| {
|
||||
warn!("DbusFanAndCpu: add_to_server {}", err);
|
||||
err
|
||||
|
||||
@@ -7,6 +7,7 @@ use logind_zbus::{
|
||||
ManagerProxy, SessionProxy,
|
||||
};
|
||||
use rog_types::gfx_vendors::{GfxPower, GfxRequiredUserAction, GfxVendors};
|
||||
use zvariant::ObjectPath;
|
||||
use std::{io::Write, ops::Add, path::Path, time::Instant};
|
||||
use std::{iter::FromIterator, thread::JoinHandle};
|
||||
use std::{process::Command, thread::sleep, time::Duration};
|
||||
@@ -78,7 +79,7 @@ impl Dbus for CtrlGraphics {
|
||||
impl ZbusAdd for CtrlGraphics {
|
||||
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
||||
server
|
||||
.at("/org/asuslinux/Gfx", self)
|
||||
.at(&ObjectPath::from_str_unchecked("/org/asuslinux/Gfx"), self)
|
||||
.map_err(|err| {
|
||||
warn!("GFX: CtrlGraphics: add_to_server {}", err);
|
||||
err
|
||||
@@ -495,7 +496,7 @@ impl CtrlGraphics {
|
||||
sessions: &[SessionInfo],
|
||||
) -> Result<bool, RogError> {
|
||||
for session in sessions {
|
||||
let session_proxy = SessionProxy::new(&connection, session)?;
|
||||
let session_proxy = SessionProxy::new(connection, session)?;
|
||||
if session_proxy.get_class()? == SessionClass::User {
|
||||
match session_proxy.get_type()? {
|
||||
SessionType::X11 | SessionType::Wayland | SessionType::MIR => {
|
||||
|
||||
@@ -14,6 +14,7 @@ use rog_types::{
|
||||
aura_modes::{AuraEffect, AuraModeNum, LedBrightness},
|
||||
LED_MSG_LEN,
|
||||
};
|
||||
use zvariant::ObjectPath;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::{Read, Write};
|
||||
use std::path::Path;
|
||||
@@ -82,7 +83,7 @@ trait Dbus {
|
||||
impl crate::ZbusAdd for DbusKbdBacklight {
|
||||
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
||||
server
|
||||
.at("/org/asuslinux/Led", self)
|
||||
.at(&ObjectPath::from_str_unchecked("/org/asuslinux/Led"), self)
|
||||
.map_err(|err| {
|
||||
error!("DbusKbdBacklight: add_to_server {}", err);
|
||||
})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::{config::Config, error::RogError, GetSupported};
|
||||
use log::{error, info, warn};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use zvariant::ObjectPath;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::BufRead;
|
||||
use std::io::{Read, Write};
|
||||
@@ -101,7 +102,7 @@ impl CtrlRogBios {
|
||||
impl crate::ZbusAdd for CtrlRogBios {
|
||||
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
||||
server
|
||||
.at("/org/asuslinux/RogBios", self)
|
||||
.at(&ObjectPath::from_str_unchecked("/org/asuslinux/RogBios"), self)
|
||||
.map_err(|err| {
|
||||
warn!("CtrlRogBios: add_to_server {}", err);
|
||||
err
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use log::warn;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use zbus::dbus_interface;
|
||||
use zvariant::ObjectPath;
|
||||
|
||||
use crate::{
|
||||
ctrl_anime::{AnimeSupportedFunctions, CtrlAnimeDisplay},
|
||||
@@ -30,7 +31,7 @@ impl SupportedFunctions {
|
||||
impl crate::ZbusAdd for SupportedFunctions {
|
||||
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
||||
server
|
||||
.at("/org/asuslinux/Supported", self)
|
||||
.at(&ObjectPath::from_str_unchecked("/org/asuslinux/Supported"), self)
|
||||
.map_err(|err| {
|
||||
warn!("SupportedFunctions: add_to_server {}", err);
|
||||
err
|
||||
|
||||
@@ -23,6 +23,7 @@ use daemon::ctrl_rog_bios::CtrlRogBios;
|
||||
use std::convert::Into;
|
||||
use zbus::fdo;
|
||||
use zbus::Connection;
|
||||
use zvariant::ObjectPath;
|
||||
|
||||
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut logger = env_logger::Builder::new();
|
||||
@@ -157,7 +158,7 @@ fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
// TODO: implement messaging between threads to check fails
|
||||
// These tasks generally read a sys path or file to check for a
|
||||
// change
|
||||
let _handle = std::thread::Builder::new()
|
||||
let handle = std::thread::Builder::new()
|
||||
.name("asusd watch".to_string())
|
||||
.spawn(move || loop {
|
||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||
@@ -174,7 +175,7 @@ fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
});
|
||||
|
||||
object_server
|
||||
.with("/org/asuslinux/Charge", |obj: &CtrlCharge| {
|
||||
.with(&ObjectPath::from_str_unchecked("/org/asuslinux/Charge"), |obj: &CtrlCharge| {
|
||||
let x = obj.limit();
|
||||
obj.notify_charge(x as u8)
|
||||
})
|
||||
@@ -184,8 +185,11 @@ fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
.ok();
|
||||
|
||||
loop {
|
||||
if let Err(err) = &handle {
|
||||
error!("{}", err);
|
||||
}
|
||||
if let Err(err) = object_server.try_handle_next() {
|
||||
eprintln!("{}", err);
|
||||
error!("{}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user