Rename RogBios bits to Platform. Better GPU MUX support.

This commit is contained in:
Luke D. Jones
2022-08-12 21:51:04 +12:00
parent d35707f2e4
commit a0f7cf3acd
16 changed files with 122 additions and 164 deletions

View File

@@ -1,3 +1,6 @@
//! This crate functions as a wrapper of all the relevant ASUS functionality
//! on ROG, Strix, and TUF laptops.
pub mod error;
pub mod hid_raw;
pub mod keyboard_led;

View File

@@ -1,9 +1,11 @@
use std::path::PathBuf;
use log::warn;
use serde::{Deserialize, Serialize};
use zvariant::Type;
use crate::{
attr_bool,
attr_bool, attr_u8,
error::{PlatformError, Result},
to_device,
};
@@ -60,10 +62,38 @@ impl AsusPlatform {
attr_bool!(has_panel_od, get_panel_od, set_panel_od, "panel_od");
attr_bool!(
attr_u8!(
has_gpu_mux_mode,
get_gpu_mux_mode,
set_gpu_mux_mode,
"gpu_mux_mode"
);
}
#[derive(Serialize, Deserialize, Type, Debug, PartialEq, Clone, Copy)]
pub enum GpuMuxMode {
Discrete,
Optimus,
Error,
NotSupported,
}
impl From<u8> for GpuMuxMode {
fn from(m: u8) -> Self {
if m > 0 {
return Self::Optimus;
}
Self::Discrete
}
}
impl From<GpuMuxMode> for u8 {
fn from(m: GpuMuxMode) -> Self {
match m {
GpuMuxMode::Discrete => 0,
GpuMuxMode::Optimus => 1,
GpuMuxMode::Error => 254,
GpuMuxMode::NotSupported => 255,
}
}
}