From de10fe13e761c94c1b5e9e19818934687b58299b Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 23 May 2020 09:16:34 +1200 Subject: [PATCH] In-progress --- README.md | 84 ++++++++++++++-------------- rog-core/src/daemon.rs | 2 +- rog-core/src/laptops.rs | 2 +- rog-core/src/lib.rs | 6 +- rog-core/src/main.rs | 3 + rog-core/src/{core.rs => rogcore.rs} | 2 +- 6 files changed, 51 insertions(+), 48 deletions(-) rename rog-core/src/{core.rs => rogcore.rs} (99%) diff --git a/README.md b/README.md index 7779e8bd..32611786 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,47 @@ captures from others with different ROG laptops then I should be able to add the I'm now looking at the kernel source to see if I can add the inputs correctly so they show up as proper evdev events. +## Implemented + +- [X] Setting/modifying built-in LED modes +- [X] Per-key LED setting (PARTIALLY COMPLETE) +- [ ] Fancy LED modes (custom programs) +- [X] Daemon mode +- [X] Saving settings for reload +- [ ] System control + + [X] Sleep + + [X] Airplane mode + + [X] Screen off? Now mapped to a keycode but has no effect + + [X] Screen brightness up/down + + [ ] ROG key custom mapping (Can be done in source) + + [X] Fan/Performance mode + + [ ] Screen off?? + + [X] Touchpad toggle (using a virtual keyboard to emit F21...) +- [X] Capture and use hotkeys **Partially completed: aura keys work** + + [X] Aura control by Aura keys + + [X] Volume + media controls work +- [X] Logging - required for journalctl + +## Other Laptops + +**Supported:** + +- GX502 (product 0x1866) (Tested on GX502GW) + +**Partial/Inprogress:** +- GM501 (multizone needs testing) +- G14 (no Lid LED support, all other functions appear to work) + +Both of these laptops appear to have the same USB device ID as the GX502, but with different features enabled. + +**Please help test or provide info for:** + +- GL703(0x1869), GA502 (attempts to use same profile as GX502GW) +- GL553(0x1854) GL753 (attempted support from researching 2nd-hand info, multizone may work) + +If the USB product ID is 0x1866 or 0x1869 then the per-key profile with hotkeys *should* work - 0x1866 is tested as this +is what I have. + ## Requirements for compiling - `rustc` + `cargo` + `make` @@ -46,7 +87,7 @@ sudo apt-get update sudo install rog-core ``` -and if the service isn't enabled: +enable and start the service: ``` sudo systemctl start rog-core.service @@ -106,47 +147,6 @@ If the daemon service is enabled then on boot the following will be reloaded fro The daemon also saves the settings per mode as the keyboard does not do this itself - this means cycling through modes with the Aura keys will use the settings that were used via CLI. -## Implemented - -- [X] Setting/modifying built-in LED modes -- [X] Per-key LED setting (PARTIALLY COMPLETE) -- [ ] Fancy LED modes (custom programs) -- [X] Daemon mode -- [X] Saving settings for reload -- [ ] System control - + [X] Sleep - + [X] Airplane mode - + [X] Screen off? Now mapped to a keycode but has no effect - + [X] Screen brightness up/down - + [ ] ROG key custom mapping (Can be done in source) - + [X] Fan/Performance mode - + [ ] Screen off?? - + [X] Touchpad toggle (using a virtual keyboard to emit F21...) -- [X] Capture and use hotkeys **Partially completed: aura keys work** - + [X] Aura control by Aura keys - + [X] Volume + media controls work -- [X] Logging - required for journalctl - -## Other Laptops - -**Supported:** - -- GX502 (product 0x1866) (Tested on GX502GW) - -**Partial/Inprogress:** -- GM501 -- G14 - -Both of these laptops appear to have the same USB device ID as the GX502, but with different features enabled. - -**Please help test or provide info for:** - -- GL703(0x1869), GA502 (attempts to use same profile as GX502GW) -- GL553(0x1854) GL753 (attempted support from researching 2nd-hand info, multizone may work) - -If the USB product ID is 0x1866 or 0x1869 then the per-key profile with hotkeys *should* work - 0x1866 is tested as this -is what I have. - ### Wireshark captures TODO: see `./wireshark_data/` for some captures. diff --git a/rog-core/src/daemon.rs b/rog-core/src/daemon.rs index 466929f9..2990819f 100644 --- a/rog-core/src/daemon.rs +++ b/rog-core/src/daemon.rs @@ -1,8 +1,8 @@ use crate::{ config::Config, - core::*, laptops::match_laptop, led_control::{AuraCommand, LedWriter}, + rogcore::*, }; use dbus::{ diff --git a/rog-core/src/laptops.rs b/rog-core/src/laptops.rs index f70f2c59..3ccc98d7 100644 --- a/rog-core/src/laptops.rs +++ b/rog-core/src/laptops.rs @@ -1,4 +1,4 @@ -use crate::{config::Config, core::RogCore, led_control::AuraCommand}; +use crate::{config::Config, led_control::AuraCommand, rogcore::RogCore}; use rog_aura::{error::AuraError, BuiltInModeByte}; //use keycode::{KeyMap, KeyMappingId, KeyState, KeyboardState}; use crate::virt_device::ConsumerKeys; diff --git a/rog-core/src/lib.rs b/rog-core/src/lib.rs index d308fc7b..7fb01e9c 100644 --- a/rog-core/src/lib.rs +++ b/rog-core/src/lib.rs @@ -1,14 +1,14 @@ #![deny(unused_must_use)] /// Configuration loading, saving mod config; -/// The core module which allows writing to LEDs or polling the -/// laptop keyboard attached devices -mod core; /// Start the daemon loop pub mod daemon; /// Laptop matching to determine capabilities mod laptops; /// mod led_control; +/// The core module which allows writing to LEDs or polling the +/// laptop keyboard attached devices +pub mod rogcore; /// A virtual "consumer device" to help emit the correct key codes mod virt_device; diff --git a/rog-core/src/main.rs b/rog-core/src/main.rs index 42308656..41f766a1 100644 --- a/rog-core/src/main.rs +++ b/rog-core/src/main.rs @@ -1,4 +1,5 @@ use daemon::daemon::start_daemon; +use daemon::rogcore::FanLevel; use env_logger::{Builder, Target}; use gumdrop::Options; use log::LevelFilter; @@ -19,6 +20,8 @@ struct CLIStart { daemon: bool, #[options(meta = "VAL", help = "")] bright: Option, + #[options(meta = "FAN", help = "")] + fan_mode: Option, #[options(command)] command: Option, } diff --git a/rog-core/src/core.rs b/rog-core/src/rogcore.rs similarity index 99% rename from rog-core/src/core.rs rename to rog-core/src/rogcore.rs index 617f07d4..c61d6549 100644 --- a/rog-core/src/core.rs +++ b/rog-core/src/rogcore.rs @@ -304,7 +304,7 @@ where } #[derive(Debug)] -enum FanLevel { +pub enum FanLevel { Normal, Boost, Silent,