mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Merge branch 'fix-z13-2025-1' into 'devel'
Fixes for Asus z13 2025 See merge request asus-linux/asusctl!245
This commit is contained in:
@@ -25,6 +25,30 @@ pub struct Aura {
|
||||
impl Aura {
|
||||
/// Initialise the device if required.
|
||||
pub async fn do_initialization(&self) -> Result<(), RogError> {
|
||||
if let Some(hid) = &self.hid {
|
||||
let hid = hid.lock().await;
|
||||
let init_1: [u8; 2] = [
|
||||
0x5d, 0xb9,
|
||||
];
|
||||
let init_2 = b"]ASUS Tech.Inc.";
|
||||
let init_3: [u8; 6] = [
|
||||
0x5d, 0x05, 0x20, 0x31, 0, 0x1a,
|
||||
];
|
||||
|
||||
hid.write_bytes(&init_1)?;
|
||||
hid.write_bytes(init_2)?;
|
||||
hid.write_bytes(&init_3)?;
|
||||
|
||||
let config = self.config.lock().await;
|
||||
if config.support_data.device_name.contains("GZ30")
|
||||
|| config.support_data.device_name.contains("Z13")
|
||||
{
|
||||
let z13_init: [u8; 4] = [
|
||||
0x5d, 0xc0, 0x03, 0x01,
|
||||
];
|
||||
hid.write_bytes(&z13_init)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -152,9 +176,54 @@ impl Aura {
|
||||
}
|
||||
}
|
||||
|
||||
let bytes = config.enabled.to_bytes(config.led_type);
|
||||
let mut enabled = config.enabled.clone();
|
||||
if config.support_data.device_name.contains("GZ30")
|
||||
|| config.support_data.device_name.contains("Z13")
|
||||
{
|
||||
let logo_state = enabled
|
||||
.states
|
||||
.iter()
|
||||
.find(|s| s.zone == PowerZones::Logo)
|
||||
.cloned();
|
||||
if let Some(logo) = logo_state {
|
||||
let mut lid_found = false;
|
||||
let mut bar_found = false;
|
||||
|
||||
for s in enabled.states.iter_mut() {
|
||||
if s.zone == PowerZones::Lid {
|
||||
s.boot = logo.boot;
|
||||
s.awake = logo.awake;
|
||||
s.sleep = logo.sleep;
|
||||
s.shutdown = logo.shutdown;
|
||||
lid_found = true;
|
||||
}
|
||||
if s.zone == PowerZones::Lightbar {
|
||||
s.boot = logo.boot;
|
||||
s.awake = logo.awake;
|
||||
s.sleep = logo.sleep;
|
||||
s.shutdown = logo.shutdown;
|
||||
bar_found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if !lid_found {
|
||||
let mut new_state = logo;
|
||||
new_state.zone = PowerZones::Lid;
|
||||
enabled.states.push(new_state.clone());
|
||||
new_state.zone = PowerZones::Lightbar;
|
||||
enabled.states.push(new_state);
|
||||
} else if !bar_found {
|
||||
// Lid found but not bar?
|
||||
let mut new_state = logo;
|
||||
new_state.zone = PowerZones::Lightbar;
|
||||
enabled.states.push(new_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let bytes = enabled.to_bytes(config.led_type);
|
||||
let msg = [
|
||||
0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3],
|
||||
0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3], 0xff,
|
||||
];
|
||||
hid_raw.write_bytes(&msg)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user