Add G731 support

This commit is contained in:
Luke D Jones
2020-08-04 22:04:25 +12:00
parent 7adb477e1b
commit 4011bdd554
8 changed files with 50 additions and 42 deletions

View File

@@ -16,6 +16,9 @@ change modes and RGB settings. The previous version of this program is named
`rog-core` and takes full control of the interfaces required - if you can't
apply the kernel patches then `rog-core` is still highly usable.
Many other patches for these laptops, AMD and Intel based, are working their way
in to the kernel.
---
asusd is a utility for Linux to control many aspects of various ASUS laptops.
@@ -38,25 +41,22 @@ As far as I can see, the EC does not give us a way to find what modes are suppor
### ANIME AND OTHER FUNCTIONS
| MODEL | AniMe |Touchpad-Numpad| Fan Modes | Charge Limit |
|:-----:|:-----:|:-------------:|:---------:|:------------:|
| GM501 | | | X | X |
| GX502 | | | X | X |
| GX531 | | | X | X |
| GX701 | | | X | X |
| G512 | | | X | X |
| G712 | | | X | X |
| G531 | | | X | X |
| G731 | | | X | X |
| G532 | | | X | X |
| GA401 | X | | X | X |
| GA502 | X | | X | X |
| GU502 | X | | X | X |
**NOTE:** GA14/GA401 and GA15/GA502/GU502, You will need kernel [patches](https://lab.retarded.farm/zappel/asus-rog-zephyrus-g14/-/tree/master/kernel_patches).
**AniMe device check is performed on start, if your device has one it will be detected.**
**NOTE:** If charge limit or fan modes are not working, then you may require a kernel newer than 5.6.10.
- [X] AniMe Matrix display
- [X] Power profile switching on fan-mode (FN+F5)
- [X] Intel
- [X] Turbo enale/disable
- [X] Min frequency percentage
- [X] Max frequency percentage
- [X] AMD
- [X] Turbo enale/disable
- [X] Battery charge limit
**NOTE:** GA14/GA401 and GA15/GA502/GU502, You will need kernel [patches](https://lab.retarded.farm/zappel/asus-rog-zephyrus-g14/-/tree/master/kernel_patches).
### KEYBOARD BACKLIGHT MODES
Models GA401, GA502, GU502 support LED brightness change only (no RGB).

View File

@@ -10,8 +10,8 @@ const APPLY: u8 = 0xc3;
const SET: u8 = 0xc4;
use crate::config::Config;
use log::{error, info, warn};
use asus_nb::error::AuraError;
use log::{error, info, warn};
use rusb::{Device, DeviceHandle};
use std::error::Error;
use std::sync::Arc;

View File

@@ -47,6 +47,7 @@ impl crate::Controller for CtrlFanAndCPU {
}
});
// need to watch file path
// TODO: split this out to a struct CtrlFanAndCPUWatcher or similar
tokio::spawn(async move {
loop {
if let Ok(mut lock) = gate2.try_lock() {
@@ -65,7 +66,10 @@ impl crate::Controller for CtrlFanAndCPU {
file.write_all(format!("{:?}\n", config.power_profile).as_bytes())
.unwrap_or_else(|err| error!("Could not write to {}, {:?}", self.path, err));
self.set_pstate_for_fan_mode(FanLevel::from(config.power_profile), config)?;
info!("Reloaded fan mode: {:?}", FanLevel::from(config.power_profile));
info!(
"Reloaded fan mode: {:?}",
FanLevel::from(config.power_profile)
);
Ok(())
}
}
@@ -128,7 +132,10 @@ impl CtrlFanAndCPU {
fan_ctrl
.write_all(format!("{:?}\n", config.power_profile).as_bytes())
.unwrap_or_else(|err| error!("Could not write to {}, {:?}", self.path, err));
info!("Fan mode set to: {:?}", FanLevel::from(config.power_profile));
info!(
"Fan mode set to: {:?}",
FanLevel::from(config.power_profile)
);
self.set_pstate_for_fan_mode(FanLevel::from(n), config)?;
Ok(())
}

View File

@@ -3,12 +3,12 @@ static LED_APPLY: [u8; 17] = [0x5d, 0xb4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
static LED_SET: [u8; 17] = [0x5d, 0xb5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
use crate::{config::Config, error::RogError};
use dbus::{channel::Sender, nonblock::SyncConnection, tree::Signal};
use log::{info, warn};
use asus_nb::{
aura_brightness_bytes, aura_modes::AuraModes, fancy::KeyColourArray, DBUS_IFACE, DBUS_PATH,
LED_MSG_LEN,
};
use dbus::{channel::Sender, nonblock::SyncConnection, tree::Signal};
use log::{info, warn};
use std::error::Error;
use std::fs::OpenOptions;
use std::io::Write;

View File

@@ -1,19 +1,20 @@
use daemon::{
config::Config, ctrl_anime::CtrlAnimeDisplay, ctrl_charge::CtrlCharge, ctrl_fan_cpu::CtrlFanAndCPU,
ctrl_leds::CtrlKbdBacklight, dbus::dbus_create_tree, laptops::match_laptop,
config::Config, ctrl_anime::CtrlAnimeDisplay, ctrl_charge::CtrlCharge,
ctrl_fan_cpu::CtrlFanAndCPU, ctrl_leds::CtrlKbdBacklight, dbus::dbus_create_tree,
laptops::match_laptop,
};
use dbus::{channel::Sender, nonblock::SyncConnection, tree::Signal};
use asus_nb::{DBUS_IFACE, DBUS_NAME, DBUS_PATH};
use daemon::Controller;
use dbus_tokio::connection;
use log::{error, warn, info};
use asus_nb::{DBUS_IFACE, DBUS_NAME, DBUS_PATH};
use log::LevelFilter;
use log::{error, info, warn};
use std::error::Error;
use std::io::Write;
use std::sync::Arc;
use tokio::sync::Mutex;
use std::io::Write;
use log::LevelFilter;
#[tokio::main]
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -42,14 +43,15 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
let laptop = match_laptop();
let mut config = Config::default().load(laptop.supported_modes());
let mut led_control = CtrlKbdBacklight::new(laptop.usb_product(), laptop.supported_modes().to_owned())
.map_or_else(
|err| {
error!("{}", err);
None
},
Some,
);
let mut led_control =
CtrlKbdBacklight::new(laptop.usb_product(), laptop.supported_modes().to_owned())
.map_or_else(
|err| {
error!("{}", err);
None
},
Some,
);
let mut charge_control = CtrlCharge::new().map_or_else(
|err| {
@@ -207,7 +209,6 @@ async fn send_boot_signals(
charge_limit_signal: Arc<Signal<()>>,
led_changed_signal: Arc<Signal<()>>,
) -> Result<(), Box<dyn Error>> {
let config = config.lock().await;
if let Some(data) = config.get_led_mode_data(config.kbd_backlight_mode) {

View File

@@ -1,7 +1,7 @@
use crate::config::Config;
use asus_nb::{aura_modes::AuraModes, DBUS_IFACE, DBUS_PATH};
use dbus::tree::{Factory, MTSync, Method, MethodErr, Signal, Tree};
use log::warn;
use asus_nb::{aura_modes::AuraModes, DBUS_IFACE, DBUS_PATH};
use std::sync::Arc;
use tokio::sync::{
mpsc::{channel, Receiver, Sender},

View File

@@ -1,8 +1,8 @@
use log::{info, warn};
use asus_nb::aura_modes::{
AuraModes, BREATHING, COMET, FLASH, HIGHLIGHT, LASER, MULTISTATIC, PULSE, RAIN, RAINBOW, RGB,
RIPPLE, STATIC, STAR, STROBE,
RIPPLE, STAR, STATIC, STROBE,
};
use log::{info, warn};
static HELP_ADDRESS: &str = "https://gitlab.com/asus-linux/asus-nb-ctrl";

View File

@@ -1,10 +1,10 @@
use daemon::ctrl_fan_cpu::FanLevel;
use gumdrop::Options;
use log::LevelFilter;
use asus_nb::{
cli_options::{LedBrightness, SetAuraBuiltin},
core_dbus::AuraDbusClient,
};
use daemon::ctrl_fan_cpu::FanLevel;
use gumdrop::Options;
use log::LevelFilter;
use std::io::Write;
#[derive(Options)]