mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
Try to ensure all aura are detected at start
This commit is contained in:
@@ -103,7 +103,7 @@ fn check_service(name: &str) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn find_aura_iface() -> Result<AuraProxyBlocking<'static>, Box<dyn std::error::Error>> {
|
||||
fn find_aura_iface() -> Result<Vec<AuraProxyBlocking<'static>>, Box<dyn std::error::Error>> {
|
||||
let conn = zbus::blocking::Connection::system().unwrap();
|
||||
let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/org")
|
||||
.unwrap();
|
||||
@@ -123,11 +123,17 @@ fn find_aura_iface() -> Result<AuraProxyBlocking<'static>, Box<dyn std::error::E
|
||||
println!("Multiple aura devices found: {aura_paths:?}");
|
||||
println!("TODO: enable selection");
|
||||
}
|
||||
if let Some(path) = aura_paths.first() {
|
||||
return Ok(AuraProxyBlocking::builder(&conn)
|
||||
if !aura_paths.is_empty() {
|
||||
let mut ctrl = Vec::new();
|
||||
for path in aura_paths {
|
||||
ctrl.push(
|
||||
AuraProxyBlocking::builder(&conn)
|
||||
.path(path.clone())?
|
||||
.destination("org.asuslinux.Daemon")?
|
||||
.build()?);
|
||||
.build()?,
|
||||
);
|
||||
}
|
||||
return Ok(ctrl);
|
||||
}
|
||||
|
||||
Err("No Aura interface".into())
|
||||
@@ -162,7 +168,12 @@ fn do_parsed(
|
||||
println!();
|
||||
if let Some(cmdlist) = CliStart::command_list() {
|
||||
let dev_type = if let Ok(proxy) = find_aura_iface() {
|
||||
proxy.device_type().unwrap_or(AuraDevice::Unknown)
|
||||
// TODO: commands on all?
|
||||
proxy
|
||||
.first()
|
||||
.unwrap()
|
||||
.device_type()
|
||||
.unwrap_or(AuraDevice::Unknown)
|
||||
} else {
|
||||
AuraDevice::Unknown
|
||||
};
|
||||
@@ -192,6 +203,7 @@ fn do_parsed(
|
||||
|
||||
if let Some(brightness) = &parsed.kbd_bright {
|
||||
if let Ok(aura) = find_aura_iface() {
|
||||
for aura in aura.iter() {
|
||||
match brightness.level() {
|
||||
None => {
|
||||
let level = aura.brightness()?;
|
||||
@@ -199,6 +211,7 @@ fn do_parsed(
|
||||
}
|
||||
Some(level) => aura.set_brightness(rog_aura::LedBrightness::from(level))?,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println!("No aura interface found");
|
||||
}
|
||||
@@ -206,8 +219,10 @@ fn do_parsed(
|
||||
|
||||
if parsed.next_kbd_bright {
|
||||
if let Ok(aura) = find_aura_iface() {
|
||||
for aura in aura.iter() {
|
||||
let brightness = aura.brightness()?;
|
||||
aura.set_brightness(brightness.next())?;
|
||||
}
|
||||
} else {
|
||||
println!("No aura interface found");
|
||||
}
|
||||
@@ -215,8 +230,10 @@ fn do_parsed(
|
||||
|
||||
if parsed.prev_kbd_bright {
|
||||
if let Ok(aura) = find_aura_iface() {
|
||||
for aura in aura.iter() {
|
||||
let brightness = aura.brightness()?;
|
||||
aura.set_brightness(brightness.prev())?;
|
||||
}
|
||||
} else {
|
||||
println!("No aura interface found");
|
||||
}
|
||||
@@ -229,10 +246,11 @@ fn do_parsed(
|
||||
supported_properties
|
||||
);
|
||||
if let Ok(aura) = find_aura_iface() {
|
||||
let bright = aura.supported_brightness()?;
|
||||
let modes = aura.supported_basic_modes()?;
|
||||
let zones = aura.supported_basic_zones()?;
|
||||
let power = aura.supported_power_zones()?;
|
||||
// TODO: multiple RGB check
|
||||
let bright = aura.first().unwrap().supported_brightness()?;
|
||||
let modes = aura.first().unwrap().supported_basic_modes()?;
|
||||
let zones = aura.first().unwrap().supported_basic_zones()?;
|
||||
let power = aura.first().unwrap().supported_power_zones()?;
|
||||
println!("Supported Keyboard Brightness:\n{:#?}", bright);
|
||||
println!("Supported Aura Modes:\n{:#?}", modes);
|
||||
println!("Supported Aura Zones:\n{:#?}", zones);
|
||||
@@ -459,14 +477,9 @@ fn verify_brightness(brightness: f32) {
|
||||
}
|
||||
|
||||
fn handle_led_mode(
|
||||
aura: &AuraProxyBlocking,
|
||||
aura: &[AuraProxyBlocking],
|
||||
mode: &LedModeCommand,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
// if !supported.contains(&AURA_ZBUS_NAME.to_string()) {
|
||||
// println!("This laptop does not support power options");
|
||||
// return Err(PlatformError::NotSupported.into());
|
||||
// }
|
||||
|
||||
if mode.command.is_none() && !mode.prev_mode && !mode.next_mode {
|
||||
if !mode.help {
|
||||
println!("Missing arg or command\n");
|
||||
@@ -476,7 +489,8 @@ fn handle_led_mode(
|
||||
|
||||
if let Some(cmdlist) = LedModeCommand::command_list() {
|
||||
let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect();
|
||||
let modes = aura.supported_basic_modes()?;
|
||||
// TODO: multiple rgb check
|
||||
let modes = aura.first().unwrap().supported_basic_modes()?;
|
||||
for command in commands.iter().filter(|command| {
|
||||
for mode in &modes {
|
||||
if command
|
||||
@@ -505,6 +519,7 @@ fn handle_led_mode(
|
||||
return Ok(());
|
||||
}
|
||||
if mode.next_mode {
|
||||
for aura in aura {
|
||||
let mode = aura.led_mode()?;
|
||||
let modes = aura.supported_basic_modes()?;
|
||||
let mut pos = modes.iter().position(|m| *m == mode).unwrap() + 1;
|
||||
@@ -512,7 +527,9 @@ fn handle_led_mode(
|
||||
pos = 0;
|
||||
}
|
||||
aura.set_led_mode(modes[pos])?;
|
||||
}
|
||||
} else if mode.prev_mode {
|
||||
for aura in aura {
|
||||
let mode = aura.led_mode()?;
|
||||
let modes = aura.supported_basic_modes()?;
|
||||
let mut pos = modes.iter().position(|m| *m == mode).unwrap();
|
||||
@@ -522,25 +539,25 @@ fn handle_led_mode(
|
||||
pos -= 1;
|
||||
}
|
||||
aura.set_led_mode(modes[pos])?;
|
||||
}
|
||||
} else if let Some(mode) = mode.command.as_ref() {
|
||||
if mode.help_requested() {
|
||||
println!("{}", mode.self_usage());
|
||||
return Ok(());
|
||||
}
|
||||
for aura in aura {
|
||||
aura.set_led_mode_data(<AuraEffect>::from(mode))?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_led_power1(
|
||||
aura: &AuraProxyBlocking,
|
||||
aura: &[AuraProxyBlocking],
|
||||
power: &LedPowerCommand1,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
// if !supported.contains(&AURA_ZBUS_NAME.to_string()) {
|
||||
// println!("This laptop does not support power options");
|
||||
// return Err(PlatformError::NotSupported.into());
|
||||
// }
|
||||
for aura in aura {
|
||||
let dev_type = aura.device_type()?;
|
||||
if !dev_type.is_old_style() && !dev_type.is_tuf_style() {
|
||||
println!("This option applies only to keyboards 2021+");
|
||||
@@ -568,6 +585,7 @@ fn handle_led_power1(
|
||||
handle_led_power_1_do_tuf(aura, power)?;
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
println!("These options are for keyboards of product ID 0x1866 or TUF only");
|
||||
Ok(())
|
||||
@@ -600,7 +618,8 @@ fn handle_led_power_1_do_1866(
|
||||
old_rog: enabled,
|
||||
..Default::default()
|
||||
};
|
||||
aura.set_led_power(data)?; // TODO: verify this
|
||||
|
||||
aura.set_led_power(data.clone())?; // TODO: verify this
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -631,22 +650,20 @@ fn handle_led_power_1_do_tuf(
|
||||
tuf: enabled,
|
||||
..Default::default()
|
||||
};
|
||||
aura.set_led_power(data)?; // TODO: verify this
|
||||
aura.set_led_power(data.clone())?; // TODO: verify this
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_led_power2(
|
||||
aura: &AuraProxyBlocking,
|
||||
aura: &[AuraProxyBlocking],
|
||||
power: &LedPowerCommand2,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
// if !supported.contains(&AURA_ZBUS_NAME.to_string()) {
|
||||
// println!("This laptop does not support power options");
|
||||
// return Err(PlatformError::NotSupported.into());
|
||||
// }
|
||||
for aura in aura {
|
||||
let dev_type = aura.device_type()?;
|
||||
if !dev_type.is_new_style() {
|
||||
println!("This option applies only to keyboards 2021+");
|
||||
continue;
|
||||
}
|
||||
|
||||
if power.command().is_none() {
|
||||
@@ -693,6 +710,7 @@ fn handle_led_power2(
|
||||
|
||||
aura.set_led_power(enabled)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ pub struct AuraConfig {
|
||||
impl AuraConfig {
|
||||
/// Detect the keyboard type and load from default DB if data available
|
||||
pub fn new_with(prod_id: AuraDevice) -> Self {
|
||||
info!("creating new AuraConfig");
|
||||
info!("Setting up AuraConfig for {prod_id:?}");
|
||||
Self::from_default_support(prod_id, &LaptopLedData::get_data())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ use std::collections::BTreeMap;
|
||||
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use inotify::Inotify;
|
||||
use log::info;
|
||||
use log::{info, warn};
|
||||
use rog_aura::advanced::{LedUsbPackets, UsbPackets};
|
||||
use rog_aura::aura_detection::{LaptopLedData, ASUS_KEYBOARD_DEVICES};
|
||||
use rog_aura::aura_detection::LaptopLedData;
|
||||
use rog_aura::usb::{AuraDevice, LED_APPLY, LED_SET};
|
||||
use rog_aura::{AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN};
|
||||
use rog_platform::hid_raw::HidRaw;
|
||||
@@ -59,71 +59,61 @@ pub struct CtrlKbdLed {
|
||||
}
|
||||
|
||||
impl CtrlKbdLed {
|
||||
pub fn new(data: LaptopLedData) -> Result<Self, RogError> {
|
||||
let mut led_prod = AuraDevice::Unknown;
|
||||
let mut usb_node = None;
|
||||
for prod in ASUS_KEYBOARD_DEVICES {
|
||||
match HidRaw::new(prod.into()) {
|
||||
Ok(node) => {
|
||||
led_prod = prod;
|
||||
usb_node = Some(node);
|
||||
info!(
|
||||
"Looked for keyboard controller 0x{}: Found",
|
||||
<&str>::from(prod)
|
||||
);
|
||||
break;
|
||||
pub fn find_all(data: &LaptopLedData) -> Result<Vec<Self>, RogError> {
|
||||
let mut devices = Vec::new();
|
||||
|
||||
let mut enumerator = udev::Enumerator::new().map_err(|err| {
|
||||
warn!("{}", err);
|
||||
err
|
||||
})?;
|
||||
|
||||
enumerator.match_subsystem("hidraw").map_err(|err| {
|
||||
warn!("{}", err);
|
||||
err
|
||||
})?;
|
||||
|
||||
for end_point in enumerator.scan_devices()? {
|
||||
if let Some(usb_device) =
|
||||
end_point.parent_with_subsystem_devtype("usb", "usb_device")?
|
||||
{
|
||||
// Device is something like 002, while its parent is the MCU
|
||||
// Think of it like the device is an endpoint of the USB device attached
|
||||
if let Some(parent_id) = usb_device.attribute_value("idProduct") {
|
||||
let prod_id = AuraDevice::from(parent_id.to_str().unwrap());
|
||||
if prod_id == AuraDevice::Unknown {
|
||||
log::debug!("Unknown or invalid device: {parent_id:?}, skipping");
|
||||
continue;
|
||||
}
|
||||
Err(err) => info!(
|
||||
"Looked for keyboard controller 0x{}: {err}",
|
||||
<&str>::from(prod)
|
||||
),
|
||||
}
|
||||
let dbus_path = dbus_path_for_dev(&usb_device).unwrap_or_default();
|
||||
let dev = HidRaw::from_device(end_point)?;
|
||||
let dev = Self::from_hidraw(dev, dbus_path, data)?;
|
||||
devices.push(dev);
|
||||
}
|
||||
}
|
||||
|
||||
let mut dbus_path = Default::default();
|
||||
let rgb_led = KeyboardLed::new()?;
|
||||
let led_node = if let Some(rog) = usb_node {
|
||||
info!("Found ROG USB keyboard");
|
||||
dbus_path = dbus_path_for_dev(rog.1).unwrap_or_default();
|
||||
LEDNode::Rog(rgb_led, rog.0)
|
||||
} else if rgb_led.has_kbd_rgb_mode() {
|
||||
info!("Found TUF keyboard");
|
||||
LEDNode::KbdLed(rgb_led.clone())
|
||||
} else {
|
||||
return Err(RogError::NoAuraKeyboard);
|
||||
// LEDNode::None
|
||||
};
|
||||
|
||||
// New loads data from the DB also
|
||||
let config = Self::init_config(led_prod, &data);
|
||||
|
||||
let ctrl = CtrlKbdLed {
|
||||
led_prod,
|
||||
led_node, // on TUF this is the same as rgb_led / kd_brightness
|
||||
supported_data: data,
|
||||
per_key_mode_active: false,
|
||||
config,
|
||||
dbus_path,
|
||||
};
|
||||
Ok(ctrl)
|
||||
Ok(devices)
|
||||
}
|
||||
|
||||
pub fn from_device(
|
||||
pub fn from_hidraw(
|
||||
device: HidRaw,
|
||||
dbus_path: OwnedObjectPath,
|
||||
data: LaptopLedData,
|
||||
data: &LaptopLedData,
|
||||
) -> Result<Self, RogError> {
|
||||
let rgb_led = KeyboardLed::new()?;
|
||||
let prod_id = AuraDevice::from(device.prod_id());
|
||||
if prod_id == AuraDevice::Unknown {
|
||||
log::error!("{} is AuraDevice::Unknown", device.prod_id());
|
||||
return Err(RogError::NoAuraNode);
|
||||
}
|
||||
|
||||
// New loads data from the DB also
|
||||
let config = Self::init_config(prod_id, &data);
|
||||
let config = Self::init_config(prod_id, data);
|
||||
|
||||
let ctrl = CtrlKbdLed {
|
||||
led_prod: prod_id,
|
||||
led_node: LEDNode::Rog(rgb_led, device), /* on TUF this is the same as rgb_led /
|
||||
* kd_brightness */
|
||||
supported_data: data,
|
||||
led_node: LEDNode::Rog(rgb_led, device),
|
||||
supported_data: data.clone(),
|
||||
per_key_mode_active: false,
|
||||
config,
|
||||
dbus_path,
|
||||
@@ -348,7 +338,7 @@ mod tests {
|
||||
};
|
||||
let mut controller = CtrlKbdLed {
|
||||
led_prod: AuraDevice::X19b6,
|
||||
led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap()),
|
||||
led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap().0),
|
||||
supported_data: supported_basic_modes,
|
||||
per_key_mode_active: false,
|
||||
config,
|
||||
@@ -386,7 +376,7 @@ mod tests {
|
||||
};
|
||||
let mut controller = CtrlKbdLed {
|
||||
led_prod: AuraDevice::X19b6,
|
||||
led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap()),
|
||||
led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap().0),
|
||||
supported_data: supported_basic_modes,
|
||||
per_key_mode_active: false,
|
||||
config,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// - Add it to Zbus server
|
||||
// - If udev sees device removed then remove the zbus path
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use log::{error, info, warn};
|
||||
@@ -26,7 +26,7 @@ use crate::{CtrlTask, Reloadable};
|
||||
|
||||
pub struct AuraManager {
|
||||
_connection: Connection,
|
||||
_interfaces: Arc<Mutex<HashSet<OwnedObjectPath>>>,
|
||||
interfaces: Arc<Mutex<HashMap<String, OwnedObjectPath>>>,
|
||||
}
|
||||
|
||||
impl AuraManager {
|
||||
@@ -35,27 +35,24 @@ impl AuraManager {
|
||||
let data = LaptopLedData::get_data();
|
||||
|
||||
// Do the initial keyboard detection:
|
||||
match CtrlKbdLed::new(data.clone()) {
|
||||
Ok(ctrl) => {
|
||||
let all = CtrlKbdLed::find_all(&data)?;
|
||||
for ctrl in all {
|
||||
let path = ctrl.dbus_path.clone();
|
||||
let sig_ctx = CtrlAuraZbus::signal_context(&connection)?;
|
||||
let sig_ctx2 = sig_ctx.clone();
|
||||
let zbus = CtrlAuraZbus::new(ctrl, sig_ctx);
|
||||
start_tasks(zbus, &mut connection, sig_ctx2, &path).await?;
|
||||
}
|
||||
Err(err) => {
|
||||
error!("Keyboard control: {}", err);
|
||||
}
|
||||
}
|
||||
|
||||
// connection.object_server().at("/org/asuslinux",
|
||||
// ObjectManager).await.unwrap();
|
||||
|
||||
let manager = Self {
|
||||
_connection: connection,
|
||||
_interfaces: Default::default(),
|
||||
interfaces: Default::default(),
|
||||
};
|
||||
|
||||
let interfaces_copy = manager.interfaces.clone();
|
||||
// detect all plugged in aura devices (eventually)
|
||||
tokio::spawn(async move {
|
||||
let mut monitor = MonitorBuilder::new()?.match_subsystem("hidraw")?.listen()?;
|
||||
@@ -77,10 +74,14 @@ impl AuraManager {
|
||||
};
|
||||
|
||||
if action == "remove" {
|
||||
if let Some(path) = dbus_path_for_dev(parent.clone()) {
|
||||
info!("AuraManager removing: {path:?}");
|
||||
if let Some(id_product) = parent.attribute_value("idProduct") {
|
||||
let id_product = id_product.to_string_lossy().to_string();
|
||||
let interfaces_copy = interfaces_copy.clone();
|
||||
let conn_copy = conn_copy.clone();
|
||||
tokio::spawn(async move {
|
||||
let mut interfaces = interfaces_copy.lock().await;
|
||||
if let Some(path) = interfaces.remove(&id_product) {
|
||||
info!("AuraManager removing: {path:?}");
|
||||
let res = conn_copy
|
||||
.object_server()
|
||||
.remove::<CtrlAuraZbus, _>(&path)
|
||||
@@ -90,6 +91,7 @@ impl AuraManager {
|
||||
e
|
||||
})?;
|
||||
info!("AuraManager removed: {path:?}, {res}");
|
||||
}
|
||||
Ok::<(), RogError>(())
|
||||
});
|
||||
}
|
||||
@@ -97,7 +99,7 @@ impl AuraManager {
|
||||
|
||||
let id_product =
|
||||
if let Some(id_product) = parent.attribute_value("idProduct") {
|
||||
id_product
|
||||
id_product.to_string_lossy().to_string()
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
@@ -113,7 +115,7 @@ impl AuraManager {
|
||||
}
|
||||
|
||||
// try conversion to known idProduct
|
||||
let aura_device = AuraDevice::from(id_product.to_str().unwrap());
|
||||
let aura_device = AuraDevice::from(id_product.as_str());
|
||||
if aura_device != AuraDevice::Unknown {
|
||||
if action == "add" {
|
||||
let dev_node = if let Some(dev_node) = event.devnode() {
|
||||
@@ -125,18 +127,21 @@ impl AuraManager {
|
||||
if let Ok(raw) = HidRaw::from_device(event.device())
|
||||
.map_err(|e| error!("device path error: {e:?}"))
|
||||
{
|
||||
let path = if let Some(path) = dbus_path_for_dev(parent) {
|
||||
let path = if let Some(path) = dbus_path_for_dev(&parent) {
|
||||
path
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
if let Ok(ctrl) =
|
||||
CtrlKbdLed::from_device(raw, path.clone(), data.clone())
|
||||
CtrlKbdLed::from_hidraw(raw, path.clone(), &data)
|
||||
{
|
||||
info!("AuraManager found device at: {:?}", dev_node);
|
||||
let mut conn_copy = conn_copy.clone();
|
||||
let interfaces_copy = interfaces_copy.clone();
|
||||
//
|
||||
tokio::spawn(async move {
|
||||
let mut interfaces = interfaces_copy.lock().await;
|
||||
interfaces.insert(id_product, path.clone());
|
||||
let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?;
|
||||
let zbus = CtrlAuraZbus::new(ctrl, sig_ctx);
|
||||
// Now add it to device list
|
||||
@@ -163,7 +168,7 @@ impl AuraManager {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn dbus_path_for_dev(parent: Device) -> Option<OwnedObjectPath> {
|
||||
pub(crate) fn dbus_path_for_dev(parent: &Device) -> Option<OwnedObjectPath> {
|
||||
if let Some(id_product) = parent.attribute_value("idProduct") {
|
||||
let id_product = id_product.to_string_lossy();
|
||||
let path = if let Some(devnum) = parent.attribute_value("devnum") {
|
||||
|
||||
@@ -719,6 +719,14 @@
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
board_name: "GZ301Z",
|
||||
layout_name: "ga401q",
|
||||
basic_modes: [Static, Breathe, Pulse],
|
||||
basic_zones: [],
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
board_name: "RC71L",
|
||||
layout_name: "ga401q",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-03-14 08:10+0000\n"
|
||||
"POT-Creation-Date: 2024-03-22 04:35+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -12,42 +12,42 @@ msgstr ""
|
||||
"Language: \n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:49
|
||||
#: rog-control-center/ui/main_window.slint:50
|
||||
msgctxt "MainWindow"
|
||||
msgid "ROG"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:51
|
||||
#: rog-control-center/ui/main_window.slint:52
|
||||
msgctxt "Menu1"
|
||||
msgid "System Control"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:52
|
||||
#: rog-control-center/ui/main_window.slint:53
|
||||
msgctxt "Menu2"
|
||||
msgid "Keyboard Aura"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:53
|
||||
#: rog-control-center/ui/main_window.slint:54
|
||||
msgctxt "Menu3"
|
||||
msgid "AniMe Matrix"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:54
|
||||
#: rog-control-center/ui/main_window.slint:55
|
||||
msgctxt "Menu4"
|
||||
msgid "Fan Curves"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:55
|
||||
#: rog-control-center/ui/main_window.slint:56
|
||||
msgctxt "Menu5"
|
||||
msgid "App Settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:56
|
||||
#: rog-control-center/ui/main_window.slint:57
|
||||
msgctxt "Menu6"
|
||||
msgid "About"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:68
|
||||
#: rog-control-center/ui/main_window.slint:69
|
||||
msgctxt "MainWindow"
|
||||
msgid "Quit"
|
||||
msgstr ""
|
||||
@@ -237,7 +237,7 @@ msgctxt "PageAura"
|
||||
msgid "Power Settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:211 rog-control-center/ui/pages/aura.slint:364 rog-control-center/ui/pages/aura.slint:424
|
||||
#: rog-control-center/ui/pages/aura.slint:211 rog-control-center/ui/pages/aura.slint:369 rog-control-center/ui/pages/aura.slint:434
|
||||
msgctxt "PageAura"
|
||||
msgid "Keyboard"
|
||||
msgstr ""
|
||||
@@ -262,22 +262,22 @@ msgctxt "PageAura"
|
||||
msgid "Rear Glow"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:370 rog-control-center/ui/pages/aura.slint:430
|
||||
#: rog-control-center/ui/pages/aura.slint:375 rog-control-center/ui/pages/aura.slint:440
|
||||
msgctxt "PageAura"
|
||||
msgid "Boot"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:375 rog-control-center/ui/pages/aura.slint:435
|
||||
#: rog-control-center/ui/pages/aura.slint:380 rog-control-center/ui/pages/aura.slint:445
|
||||
msgctxt "PageAura"
|
||||
msgid "Awake"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:380 rog-control-center/ui/pages/aura.slint:440
|
||||
#: rog-control-center/ui/pages/aura.slint:385 rog-control-center/ui/pages/aura.slint:450
|
||||
msgctxt "PageAura"
|
||||
msgid "Sleep"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:385 rog-control-center/ui/pages/aura.slint:445
|
||||
#: rog-control-center/ui/pages/aura.slint:390 rog-control-center/ui/pages/aura.slint:455
|
||||
msgctxt "PageAura"
|
||||
msgid "Shutdown"
|
||||
msgstr ""
|
||||
@@ -447,42 +447,42 @@ msgctxt "nv_temp_target"
|
||||
msgid "nv_temp_target"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:289
|
||||
#: rog-control-center/ui/pages/system.slint:290
|
||||
msgctxt "PageSystem"
|
||||
msgid "Energy Performance Preference linked to Throttle Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:293
|
||||
#: rog-control-center/ui/pages/system.slint:294
|
||||
msgctxt "PageSystem"
|
||||
msgid "Change EPP based on Throttle Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:301
|
||||
#: rog-control-center/ui/pages/system.slint:302
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Balanced Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:311
|
||||
#: rog-control-center/ui/pages/system.slint:312
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Performance Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:321
|
||||
#: rog-control-center/ui/pages/system.slint:322
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Quiet Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:339
|
||||
#: rog-control-center/ui/pages/system.slint:340
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy for power state"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:343
|
||||
#: rog-control-center/ui/pages/system.slint:344
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy on Battery"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:353
|
||||
#: rog-control-center/ui/pages/system.slint:354
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy on AC"
|
||||
msgstr ""
|
||||
|
||||
@@ -24,7 +24,7 @@ pub fn main() -> Result<(), Box<dyn Error>> {
|
||||
return Err("RogError::NoAuraKeyboard".into());
|
||||
}
|
||||
|
||||
let node = usb_node.unwrap();
|
||||
let node = usb_node.unwrap().0;
|
||||
|
||||
let mut packet: [u8; 64] = [
|
||||
0x5a, 0xd1, 0x0d, 0x0e, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
@@ -26,7 +26,7 @@ pub fn main() -> Result<(), Box<dyn Error>> {
|
||||
return Err("RogError::NoAuraKeyboard".into());
|
||||
}
|
||||
|
||||
let node = usb_node.unwrap();
|
||||
let node = usb_node.unwrap().0;
|
||||
|
||||
// node.write_bytes(&[0x5a, 0xd1, 0x0a, 0x01])?; // TODO: need to CHECK
|
||||
println!("Set mouse mode for 10 seconds");
|
||||
|
||||
@@ -24,7 +24,7 @@ pub fn main() -> Result<(), Box<dyn Error>> {
|
||||
return Err("RogError::NoAuraKeyboard".into());
|
||||
}
|
||||
|
||||
let node = usb_node.unwrap();
|
||||
let node = usb_node.unwrap().0;
|
||||
|
||||
// node.write_bytes(&[0x5a, 0xd1, 0x0a, 0x01])?; // TODO: need to CHECK
|
||||
println!("Set mouse mode for 10 seconds");
|
||||
|
||||
@@ -27,35 +27,36 @@ impl HidRaw {
|
||||
PlatformError::Udev("match_subsystem failed".into(), err)
|
||||
})?;
|
||||
|
||||
for device in enumerator
|
||||
for endpoint in enumerator
|
||||
.scan_devices()
|
||||
.map_err(|e| PlatformError::IoPath("enumerator".to_owned(), e))?
|
||||
{
|
||||
if let Some(parent_device) = device
|
||||
if let Some(usb_device) = endpoint
|
||||
.parent_with_subsystem_devtype("usb", "usb_device")
|
||||
.map_err(|e| {
|
||||
PlatformError::IoPath(device.devpath().to_string_lossy().to_string(), e)
|
||||
})? {
|
||||
if let Some(parent) = parent_device.attribute_value("idProduct") {
|
||||
if parent == id_product {
|
||||
if let Some(dev_node) = device.devnode() {
|
||||
PlatformError::IoPath(endpoint.devpath().to_string_lossy().to_string(), e)
|
||||
})?
|
||||
{
|
||||
if let Some(parent_id) = usb_device.attribute_value("idProduct") {
|
||||
if parent_id == id_product {
|
||||
if let Some(dev_node) = endpoint.devnode() {
|
||||
info!("Using device at: {:?} for hidraw control", dev_node);
|
||||
return Ok((
|
||||
Self {
|
||||
devfs_path: UnsafeCell::new(dev_node.to_owned()),
|
||||
prod_id: id_product.to_string(),
|
||||
syspath: device.syspath().into(),
|
||||
syspath: endpoint.syspath().into(),
|
||||
},
|
||||
parent_device,
|
||||
usb_device,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Try to see if there is a virtual device created with uhid for testing
|
||||
let dev_path = device.devpath().to_string_lossy();
|
||||
let dev_path = endpoint.devpath().to_string_lossy();
|
||||
if dev_path.contains("virtual") && dev_path.contains(&id_product.to_uppercase()) {
|
||||
if let Some(dev_node) = device.devnode() {
|
||||
if let Some(dev_node) = endpoint.devnode() {
|
||||
info!(
|
||||
"Using device at: {:?} for <TODO: label control> control",
|
||||
dev_node
|
||||
@@ -64,9 +65,9 @@ impl HidRaw {
|
||||
Self {
|
||||
devfs_path: UnsafeCell::new(dev_node.to_owned()),
|
||||
prod_id: id_product.to_string(),
|
||||
syspath: device.syspath().into(),
|
||||
syspath: endpoint.syspath().into(),
|
||||
},
|
||||
device,
|
||||
endpoint,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user