mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
VFIO mode enabled
This commit is contained in:
@@ -11,7 +11,10 @@ pub mod zbus_profile;
|
||||
pub mod zbus_rogbios;
|
||||
pub mod zbus_supported;
|
||||
|
||||
use rog_types::aura_modes::AuraEffect;
|
||||
use rog_types::{
|
||||
aura_modes::AuraEffect,
|
||||
gfx_vendors::{GfxRequiredUserAction, GfxVendors},
|
||||
};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use zbus::{Connection, Result, SignalReceiver};
|
||||
|
||||
@@ -86,8 +89,8 @@ impl<'a> DbusProxies<'a> {
|
||||
|
||||
// Signals separated out
|
||||
pub struct Signals {
|
||||
pub gfx_vendor: Arc<Mutex<Option<String>>>,
|
||||
pub gfx_action: Arc<Mutex<Option<String>>>,
|
||||
pub gfx_vendor: Arc<Mutex<Option<GfxVendors>>>,
|
||||
pub gfx_action: Arc<Mutex<Option<GfxRequiredUserAction>>>,
|
||||
pub profile: Arc<Mutex<Option<String>>>,
|
||||
pub led_mode: Arc<Mutex<Option<AuraEffect>>>,
|
||||
pub charge: Arc<Mutex<Option<u8>>>,
|
||||
@@ -151,13 +154,13 @@ impl<'a> AuraDbusClient<'a> {
|
||||
/*
|
||||
* GFX
|
||||
*/
|
||||
pub fn gfx_wait_changed(&self) -> Result<String> {
|
||||
pub fn gfx_wait_changed(&self) -> Result<GfxRequiredUserAction> {
|
||||
loop {
|
||||
if let Ok(res) = self.proxies.gfx.proxy().next_signal() {
|
||||
if res.is_none() {
|
||||
if let Ok(lock) = self.signals.gfx_action.lock() {
|
||||
if let Some(stuff) = lock.as_ref() {
|
||||
return Ok(stuff.to_string());
|
||||
return Ok(*stuff);
|
||||
}
|
||||
}
|
||||
// return Ok("Failed for unknown reason".to_owned());
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use rog_types::gfx_vendors::{GfxRequiredUserAction, GfxVendors};
|
||||
use zbus::{dbus_proxy, Connection, Result};
|
||||
|
||||
#[dbus_proxy(
|
||||
@@ -32,18 +33,18 @@ trait Daemon {
|
||||
fn power(&self) -> zbus::Result<String>;
|
||||
|
||||
/// SetVendor method
|
||||
fn set_vendor(&self, vendor: &str) -> zbus::Result<()>;
|
||||
fn set_vendor(&self, vendor: &GfxVendors) -> zbus::Result<GfxRequiredUserAction>;
|
||||
|
||||
/// Vendor method
|
||||
fn vendor(&self) -> zbus::Result<String>;
|
||||
fn vendor(&self) -> zbus::Result<GfxVendors>;
|
||||
|
||||
/// NotifyAction signal
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_action(&self, action: &str) -> zbus::Result<()>;
|
||||
fn notify_action(&self, action: GfxRequiredUserAction) -> zbus::Result<()>;
|
||||
|
||||
/// NotifyGfx signal
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_gfx(&self, vendor: &str) -> zbus::Result<()>;
|
||||
fn notify_gfx(&self, vendor: GfxVendors) -> zbus::Result<()>;
|
||||
}
|
||||
|
||||
pub struct GfxProxy<'a>(DaemonProxy<'a>);
|
||||
@@ -64,33 +65,36 @@ impl<'a> GfxProxy<'a> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn gfx_get_mode(&self) -> Result<String> {
|
||||
pub fn gfx_get_mode(&self) -> Result<GfxVendors> {
|
||||
self.0.vendor()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn gfx_write_mode(&self, vendor: &str) -> Result<()> {
|
||||
pub fn gfx_write_mode(&self, vendor: &GfxVendors) -> Result<GfxRequiredUserAction> {
|
||||
self.0.set_vendor(vendor)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn connect_notify_action(
|
||||
&self,
|
||||
action: Arc<Mutex<Option<String>>>,
|
||||
action: Arc<Mutex<Option<GfxRequiredUserAction>>>,
|
||||
) -> zbus::fdo::Result<()> {
|
||||
self.0.connect_notify_action(move |data| {
|
||||
if let Ok(mut lock) = action.lock() {
|
||||
*lock = Some(data.to_owned());
|
||||
*lock = Some(data);
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn connect_notify_gfx(&self, vendor: Arc<Mutex<Option<String>>>) -> zbus::fdo::Result<()> {
|
||||
pub fn connect_notify_gfx(
|
||||
&self,
|
||||
vendor: Arc<Mutex<Option<GfxVendors>>>,
|
||||
) -> zbus::fdo::Result<()> {
|
||||
self.0.connect_notify_gfx(move |data| {
|
||||
if let Ok(mut lock) = vendor.lock() {
|
||||
*lock = Some(data.to_owned());
|
||||
*lock = Some(data);
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
|
||||
@@ -45,7 +45,7 @@ trait Daemon {
|
||||
fn set_led_mode(&self, effect: &AuraEffect) -> zbus::Result<()>;
|
||||
|
||||
/// NotifyLed signal
|
||||
/// NotifyLed signal
|
||||
/// NotifyLed signal
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_led(&self, data: &str) -> zbus::Result<()>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user