Fix the broken pipe error

This commit is contained in:
Luke D. Jones
2024-02-02 23:26:41 +13:00
parent c94eaa473e
commit 086bbd0908
7 changed files with 42 additions and 14 deletions

View File

@@ -22,6 +22,8 @@ use rog_control_center::{
get_ipc_file, on_tmp_dir_exists, print_versions, RogApp, RogDbusClientBlocking, SHOWING_GUI,
SHOW_GUI,
};
#[cfg(not(feature = "mocking"))]
use supergfxctl::zbus_proxy::DaemonProxyBlocking as GfxProxyBlocking;
use tokio::runtime::Runtime;
#[cfg(not(feature = "mocking"))]
@@ -197,6 +199,16 @@ fn main() -> Result<()> {
init_tray(supported_properties, states.clone());
}
if let Ok(mut states) = states.lock() {
// For some reason the gui is causing a broke pipe error on dbus send, so
// replace it.
let (asus_dbus, conn) =
rog_dbus::RogDbusClientBlocking::new().expect("Couldn't connect to asusd");
states.asus_dbus = asus_dbus;
let gfx_dbus = GfxProxyBlocking::new(&conn).expect("Couldn't connect to supergfxd");
states.gfx_dbus = gfx_dbus;
}
let mut bg_check_spawned = false;
loop {
if !running_in_bg.load(Ordering::Relaxed) {

View File

@@ -230,6 +230,7 @@ pub fn aura_modes_group(states: &mut SystemState, freq: &mut Arc<AtomicU8>, ui:
.aura()
.set_led_mode_data(states.aura.modes.get(&selected).unwrap().clone())
.map_err(|err| {
dbg!(&err);
states.error = Some(err.to_string());
})
.ok();

View File

@@ -133,6 +133,7 @@ fn aura_power1(states: &mut SystemState, ui: &mut Ui) {
.aura()
.set_led_power((options, enable))
.map_err(|err| {
dbg!(&err);
states.error = Some(err.to_string());
})
.ok();
@@ -183,6 +184,7 @@ fn aura_power1(states: &mut SystemState, ui: &mut Ui) {
.aura()
.set_led_power((options, enable))
.map_err(|err| {
dbg!(&err);
states.error = Some(err.to_string());
})
.ok();
@@ -248,6 +250,7 @@ fn aura_power2(states: &mut SystemState, ui: &mut Ui) {
.aura()
.set_led_power((options, enable))
.map_err(|err| {
dbg!(&err);
states.error = Some(err.to_string());
})
.ok();