gex: begin adding aura control dbus

This commit is contained in:
Luke D. Jones
2023-07-03 23:04:06 +12:00
parent 5c159d2294
commit 622e07505d
12 changed files with 326 additions and 67 deletions

View File

@@ -20,9 +20,6 @@ impl GetSupported for CtrlKbdLed {
fn get_supported() -> Self::A {
// let mode = <&str>::from(&<AuraModes>::from(*mode));
let laptop = LaptopLedData::get_data();
let stock_led_modes = laptop.basic_modes;
let multizone_led_mode = laptop.basic_zones;
let advanced_type = laptop.advanced_type;
let mut prod_id = AuraDevice::Unknown;
for prod in ASUS_KEYBOARD_DEVICES {
@@ -42,9 +39,10 @@ impl GetSupported for CtrlKbdLed {
LedSupportedFunctions {
dev_id: prod_id,
brightness: rgb.is_ok(),
basic_modes: stock_led_modes,
basic_zones: multizone_led_mode,
advanced_type: advanced_type.into(),
basic_modes: laptop.basic_modes,
basic_zones: laptop.basic_zones,
advanced_type: laptop.advanced_type.into(),
power_zones: laptop.power_zones,
}
}
}
@@ -403,7 +401,7 @@ impl CtrlKbdLed {
#[cfg(test)]
mod tests {
use rog_aura::aura_detection::LaptopLedData;
use rog_aura::aura_detection::{LaptopLedData, PowerZones};
use rog_aura::usb::AuraDevice;
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Colour};
use rog_platform::keyboard_led::KeyboardLed;
@@ -423,6 +421,7 @@ mod tests {
basic_modes: vec![AuraModeNum::Static],
basic_zones: vec![],
advanced_type: rog_aura::AdvancedAuraType::None,
power_zones: vec![PowerZones::Keyboard, PowerZones::RearGlow],
};
let mut controller = CtrlKbdLed {
led_prod: AuraDevice::X19b6,
@@ -490,6 +489,7 @@ mod tests {
basic_modes: vec![AuraModeNum::Static],
basic_zones: vec![],
advanced_type: rog_aura::AdvancedAuraType::None,
power_zones: vec![PowerZones::Keyboard, PowerZones::RearGlow],
};
let mut controller = CtrlKbdLed {
led_prod: AuraDevice::X19b6,
@@ -528,6 +528,7 @@ mod tests {
basic_modes: vec![AuraModeNum::Static],
basic_zones: vec![AuraZone::Key1, AuraZone::Key2],
advanced_type: rog_aura::AdvancedAuraType::None,
power_zones: vec![PowerZones::Keyboard, PowerZones::RearGlow],
};
let mut controller = CtrlKbdLed {
led_prod: AuraDevice::X19b6,

View File

@@ -2,7 +2,7 @@
<node>
<interface name="org.asuslinux.Daemon">
<method name="SupportedFunctions">
<arg type="b(b)(bb)(sbasass)(bbbbbb)" direction="out"/>
<arg type="b(b)(bb)(sbasassas)(bbbbbb)" direction="out"/>
</method>
<method name="MeaningOfLife">
<arg name="answer" type="i" direction="out"/>

View File

@@ -115,23 +115,20 @@ export enum AuraDevTuf {
}
/**
* # Bits for older 0x1866, 0x1869, 0x1854 keyboard models
* # Bits for older 0x1866 keyboard model
*
* Keybord and Lightbar require Awake, Boot and Sleep apply to both
* Keybord and Lightbar regardless of if either are enabled (or Awake is
* enabled)
*
* | Byte 1 | Byte 2 | Byte 3 | Byte 4 | function | hex
* |
* |------------|------------|------------|------------|-----------|-------------|
* | 0000, 0000 | 0000, 0000 | 0000, 0010 | 0000, 0000 | Awake |
* 00,00,02,00 | | 0000, 1000 | 0000, 0000 | 0000, 0000 | 0000, 0000 | Keyboard
* | 08,00,00,00 | | 0000, 0100 | 0000, 0101 | 0000, 0000 | 0000, 0000 |
* Lightbar | 04,05,00,00 | | 1100, 0011 | 0001, 0010 | 0000, 1001 | 0000,
* 0000 | Boot/Sht | c3,12,09,00 | | 0011, 0000 | 0000, 1000 | 0000, 0100 |
* 0000, 0000 | Sleep | 30,08,04,00 | | 1111, 1111 | 0001, 1111 | 0000,
* 1111 | 0000, 0000 | all on | | | 0000, 0000 | 0000, 0000 |
* 0000, 0000 | 0000, 0010 | Rear Glow | 00,00,00,02 |
* | Byte 1 | Byte 2 | Byte 3 | function | hex |
* |------------|------------|------------|----------|----------|
* | 0000, 0000 | 0000, 0000 | 0000, 0010 | Awake | 00,00,02 |
* | 0000, 1000 | 0000, 0000 | 0000, 0000 | Keyboard | 08,00,00 |
* | 0000, 0100 | 0000, 0101 | 0000, 0000 | Lightbar | 04,05,00 |
* | 1100, 0011 | 0001, 0010 | 0000, 1001 | Boot/Sht | c3,12,09 |
* | 0011, 0000 | 0000, 1000 | 0000, 0100 | Sleep | 30,08,04 |
* | 1111, 1111 | 0001, 1111 | 0000, 1111 | all on | |
*/
export enum AuraDevRog1 {
Awake = "Awake",
@@ -144,30 +141,28 @@ export enum AuraDevRog1 {
/**
* # Bits for newer 0x18c6, 0x19B6, 0x1a30, keyboard models
*
* byte 4 in the USB packet is for keyboard + logo power states
* default is on, `ff`
* Keyboard and logo use the full range of bits (almost)
*
* | n1 | n2 | hex | action | bit |
* |------|------|-----|-----------------------|-------|
* | 0000 | 0000 | 00 | all off | |
* | 0000 | 0001 | 01 | logo boot | bit 1 |
* | 0000 | 0010 | 02 | keyboard boot | bit 2 |
* | 0000 | 0100 | 04 | logo awake | bit 3 |
* | 0000 | 1000 | 08 | keyboard awake | bit 4 |
* | 0001 | 0000 | 10 | logo sleep off | bit 5 |
* | 0010 | 0000 | 20 | keyboard sleep | bit 6 |
* | 0100 | 0000 | 40 | logo shutdown off | bit 7 |
* | 1000 | 0000 | 80 | keyboard shutdown off | bit 8 |
*
* byte 5 = lightbar
*
* | 1 | 2 | hex | action | bit |
* |------|------|-----|----------------------|-------|
* | 0000 | 0010 | 02 | lightbar off boot | bit 2 |
* | 0000 | 0100 | 04 | lightbar on | bit 3 |
* | 0000 | 1000 | 08 | lightbar off sleep | bit 4 |
* | 0001 | 0000 | 10 | lightbar shtdn off | bit 5 |
* | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Label |
* |--------|---------|---------|---------|----------|
* |00000001| 00000000| 00000000| 00000000|boot_logo_|
* |00000010| 00000000| 00000000| 00000000|boot_keyb_|
* |00000100| 00000000| 00000000| 00000000|awake_logo|
* |00001000| 00000000| 00000000| 00000000|awake_keyb|
* |00010000| 00000000| 00000000| 00000000|sleep_logo|
* |00100000| 00000000| 00000000| 00000000|sleep_keyb|
* |01000000| 00000000| 00000000| 00000000|shut_logo_|
* |10000000| 00000000| 00000000| 00000000|shut_keyb_|
* |00000000| 00000010| 00000000| 00000000|boot_bar__|
* |00000000| 00000100| 00000000| 00000000|awake_bar_|
* |00000000| 00001000| 00000000| 00000000|sleep_bar_|
* |00000000| 00010000| 00000000| 00000000|shut_bar__|
* |00000000| 00000000| 00000001| 00000000|boot_lid__|
* |00000000| 00000000| 00000010| 00000000|awkae_lid_|
* |00000000| 00000000| 00000100| 00000000|sleep_lid_|
* |00000000| 00000000| 00001000| 00000000|shut_lid__|
* |00000000| 00000000| 00000000| 00000001|boot_rear_|
* |00000000| 00000000| 00000000| 00000010|awake_rear|
* |00000000| 00000000| 00000000| 00000100|sleep_rear|
* |00000000| 00000000| 00000000| 00001000|shut_rear_|
*/
export enum AuraDevRog2 {
BootLogo = "BootLogo",
@@ -199,6 +194,20 @@ export interface AuraPowerDev {
x19b6: AuraDevRog2[];
}
/** The powerr zones this laptop supports */
export enum PowerZones {
/** The logo on some laptop lids */
Logo = "Logo",
/** The full keyboard (not zones) */
Keyboard = "Keyboard",
/** The lightbar, typically on the front of the laptop */
Lightbar = "Lightbar",
/** The leds that may be placed around the edge of the laptop lid */
Lid = "Lid",
/** The led strip on the rear of some laptops */
RearGlow = "RearGlow",
}
export enum LedBrightness {
Off = "Off",
Low = "Low",

View File

@@ -2,8 +2,6 @@
Generated by typeshare 1.6.0
*/
import { AuraDevice, AuraModeNum, AuraZone } from "./aura";
export type AnimeSupportedFunctions = boolean;
export interface ChargeSupportedFunctions {
@@ -27,6 +25,7 @@ export interface LedSupportedFunctions {
basic_modes: AuraModeNum[];
basic_zones: AuraZone[];
advanced_type: AdvancedAura;
power_zones: PowerZones[];
}
export interface RogBiosSupportedFunctions {

View File

@@ -10,7 +10,8 @@ import { IndicateMiniLed } from "./modules/indicators/mini_led";
import { QuickMiniLed } from "./modules/quick_toggles/mini_led";
import { SliderChargeLevel } from "./modules/sliders/charge";
import { QuickAnimePower } from "./modules/quick_toggles/anime_power";
import { FeatureMenuToggle } from "./modules/quickmenu";
import { FeatureMenuToggle } from "./modules/quick_menus/laptop_features";
import { AuraDbus } from "./modules/dbus/aura";
class Extension {
private _indicateMiniLed: typeof IndicateMiniLed;
@@ -22,6 +23,7 @@ class Extension {
public dbus_supported: Supported = new Supported;
public dbus_power: Power = new Power;
public dbus_aura: AuraDbus = new AuraDbus;
public dbus_anime: AnimeDbus = new AnimeDbus;
public dbus_platform: Platform = new Platform;
@@ -34,6 +36,7 @@ class Extension {
this._sliderCharge = null;
this.dbus_supported.start();
this.dbus_aura.start();
this.dbus_platform.start();
this.dbus_power.start();
this.dbus_anime.start();
@@ -95,6 +98,7 @@ class Extension {
this.dbus_power.stop();
this.dbus_platform.stop();
this.dbus_anime.stop();
this.dbus_aura.stop();
this.dbus_supported.stop();
}
}

View File

@@ -0,0 +1,88 @@
import { AuraEffect, AuraModeNum, AuraZone, Direction, Speed } from "../../bindings/aura";
import { DbusBase } from "./base";
export class AuraDbus extends DbusBase {
public aura_modes: Map<string, AuraEffect> = new Map;
constructor() {
super("org-asuslinux-aura-4", "/org/asuslinux/Aura");
}
public getLedMode() {
if (this.isRunning()) {
try {
const _data = this.dbus_proxy.LedModeSync();
//@ts-ignore
log("Led Mode:", _data);
} catch (e) {
//@ts-ignore
log("Failed to fetch supported functionalities", e);
}
}
}
// Return a list of the available modes, and the current settings for each
public getLedModes() {
// {'Breathe': ('Breathe', 'None', (166, 0, 0), (0, 0, 0), 'Med', 'Right'),
// 'Comet': ('Comet', 'None', (166, 0, 0), (0, 0, 0), 'Med', 'Right'),
// 'Flash': ('Flash', 'None', (166, 0, 0), (0, 0, 0), 'Med', 'Right'),
// 'Highlight': ('Highlight', 'None', (166, 0, 0), (0, 0, 0), 'Med', 'Right'),
// 'Laser': ('Laser', 'None', (166, 0, 0), (0, 0, 0), 'Med', 'Right'),
// 'Pulse': ('Pulse', 'None', (166, 0, 0), (0, 0, 0), 'Med', 'Right'),
// 'Rain': ('Rain', 'None', (166, 0, 0), (0, 0, 0), 'Med', 'Right'),
// 'Rainbow': ('Rainbow', 'None', (166, 0, 0), (0, 0, 0), 'Med', 'Right'),
// 'Ripple': ('Ripple', 'None', (166, 0, 0), (0, 0, 0), 'Med', 'Right'),
// 'Star': ('Star', 'None', (166, 0, 0), (0, 0, 0), 'Med', 'Right'),
// 'Static': ('Static', 'None', (78, 0, 0), (0, 0, 0), 'Med', 'Right'),
// 'Strobe': ('Strobe', 'None', (166, 0, 0), (0, 0, 0), 'Med', 'Right')}
if (this.isRunning()) {
try {
const _data = this.dbus_proxy.LedModesSync();
for (const key in _data[0]) {
const value = _data[0][key];
const aura: AuraEffect = {
mode: AuraModeNum[value[0] as AuraModeNum],
zone: AuraZone[value[1] as AuraZone],
colour1: {
r: parseInt(value[2][0]),
g: parseInt(value[2][1]),
b: parseInt(value[2][2]),
},
colour2: {
r: parseInt(value[3][0]),
g: parseInt(value[3][1]),
b: parseInt(value[3][2]),
},
speed: Speed[value[4] as Speed],
direction: Direction[value[5] as Direction],
};
this.aura_modes.set(key, aura);
}
for (const [key, value] of this.aura_modes) {
//@ts-ignore
log(key + " = ", value.zone, value.colour1, value.speed, value.direction);
}
} catch (e) {
//@ts-ignore
log("Failed to fetch supported functionalities", e);
}
}
}
async start() {
try {
await super.start();
this.getLedMode();
this.getLedModes();
} catch (e) {
//@ts-ignore
log("Supported DBus initialization failed!", e);
}
}
async stop() {
await super.stop();
}
}

View File

@@ -1,5 +1,5 @@
import { SupportedFunctions, AdvancedAura } from "../../bindings/platform";
import { AuraDevice, AuraModeNum, AuraZone } from "../../bindings/aura";
import { AuraDevice, AuraModeNum, AuraZone, PowerZones } from "../../bindings/aura";
import { DbusBase } from "./base";
export class Supported extends DbusBase {
@@ -21,7 +21,8 @@ export class Supported extends DbusBase {
// 'Comet',
// 'Flash'],
// [],
// 2),
// 'PerKey',
// ['Keyboard', 'Lightbar', 'Logo', 'RearGlow']),
// (False, True, True, True, False, True)
supported: SupportedFunctions = {
@@ -68,11 +69,13 @@ export class Supported extends DbusBase {
this.supported.keyboard_led.basic_modes = _data[3][2].map(function (value: string) {
return AuraModeNum[value as AuraModeNum];
});
this.supported.keyboard_led.basic_zones = _data[3][3].map(function (value: string) {
return AuraZone[value as AuraZone];
});
this.supported.keyboard_led.advanced_type = AdvancedAura[_data[3][4] as AdvancedAura];
this.supported.keyboard_led.power_zones = _data[3][5].map(function (value: string) {
return PowerZones[value as PowerZones];
});
this.supported.rog_bios_ctrl.post_sound = _data[4][0];
this.supported.rog_bios_ctrl.gpu_mux = _data[4][1];

View File

@@ -0,0 +1,61 @@
declare const imports: any;
// REF: https://gjs.guide/extensions/development/creating.html
import { addQuickSettingsItems } from "../helpers";
import { AuraDbus } from "../dbus/aura";
const { GObject } = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Main = imports.ui.main;
const PopupMenu = imports.ui.popupMenu;
const QuickSettings = imports.ui.quickSettings;
export const AuraMenuToggle = GObject.registerClass(
class AuraMenuToggle extends QuickSettings.QuickMenuToggle {
private _dbus_aura: AuraDbus;
constructor(dbus_aura: AuraDbus) {
super({
title: "Laptop",
iconName: "selection-mode-symbolic",
toggleMode: true,
});
this._dbus_aura = dbus_aura;
this.connectObject(
"destroy", () => this._settings.run_dispose(),
this);
this.menu.setHeader("selection-mode-symbolic", "Laptop features");
this._settings = ExtensionUtils.getSettings();
this._itemsSection = new PopupMenu.PopupMenuSection();
this.menu.addMenuItem(this._itemsSection);
// Add an entry-point for more settings
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
const settingsItem = this.menu.addAction("More Settings",
() => ExtensionUtils.openPrefs());
// Ensure the settings are unavailable when the screen is locked
settingsItem.visible = Main.sessionMode.allowSettings;
this.menu._settingsActions[Me.uuid] = settingsItem;
addQuickSettingsItems([this]);
}
sync() {
const checked = false;
switch (this.primary) {
default:
break;
}
if (this.checked !== checked)
this.set({ checked });
}
});

View File

@@ -1,14 +1,14 @@
declare const imports: any;
// REF: https://gjs.guide/extensions/development/creating.html
import { AnimeDbus } from "./dbus/animatrix";
import { Supported } from "./dbus/supported";
import { Platform } from "./dbus/platform";
import { AnimeDbus } from "../dbus/animatrix";
import { Supported } from "../dbus/supported";
import { Platform } from "../dbus/platform";
import { addQuickSettingsItems } from "./helpers";
import { MenuToggleAnimeBuiltins, MenuToggleAnimePower } from "./menu_toggles/anime";
import { MenuTogglePanelOd } from "./menu_toggles/panel_od";
import { MenuToggleMiniLed } from "./menu_toggles/mini_led";
import { addQuickSettingsItems } from "../helpers";
import { MenuToggleAnimeBuiltins, MenuToggleAnimePower } from "../menu_toggles/anime";
import { MenuTogglePanelOd } from "../menu_toggles/panel_od";
import { MenuToggleMiniLed } from "../menu_toggles/mini_led";
const { GObject } = imports.gi;

View File

@@ -5,6 +5,7 @@
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "FA506Q",
@@ -12,6 +13,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "FA507",
@@ -19,6 +21,7 @@
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "FX505D",
@@ -26,6 +29,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "FX506H",
@@ -33,6 +37,7 @@
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "FX506L",
@@ -40,6 +45,7 @@
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "FX507Z",
@@ -47,6 +53,7 @@
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "FX516P",
@@ -54,6 +61,7 @@
basic_modes: [Static, Breathe, Strobe],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G512",
@@ -61,6 +69,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G512LV",
@@ -68,6 +77,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G513I",
@@ -75,6 +85,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar],
),
(
board_name: "G513QE",
@@ -82,6 +93,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G513QM",
@@ -89,6 +101,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G513QR",
@@ -96,6 +109,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G513QY",
@@ -103,6 +117,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G513RC",
@@ -110,6 +125,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar],
),
(
board_name: "G513RM",
@@ -117,6 +133,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar],
),
(
board_name: "G531",
@@ -124,6 +141,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G531",
@@ -131,6 +149,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G531GD",
@@ -138,6 +157,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G531GT",
@@ -145,6 +165,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G531GU",
@@ -152,6 +173,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G531GV",
@@ -159,6 +181,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G531GW",
@@ -166,6 +189,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G532",
@@ -173,6 +197,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G533Q",
@@ -180,6 +205,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G533Z",
@@ -187,6 +213,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G634J",
@@ -194,6 +221,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard, Lightbar, Logo, RearGlow],
),
(
board_name: "G712LI",
@@ -201,6 +229,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G712LV",
@@ -208,6 +237,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G712LW",
@@ -215,6 +245,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G713IC",
@@ -222,6 +253,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G713QM",
@@ -229,6 +261,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G713QR",
@@ -236,6 +269,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G713RM",
@@ -243,6 +277,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G713RS",
@@ -250,6 +285,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G713RW",
@@ -257,6 +293,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G731",
@@ -264,6 +301,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G731GT",
@@ -271,6 +309,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G731GU",
@@ -278,6 +317,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G731GV",
@@ -285,6 +325,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G731GW",
@@ -292,6 +333,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G733C",
@@ -299,6 +341,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Logo, BarLeft, BarRight],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G733Q",
@@ -306,6 +349,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G733Z",
@@ -313,6 +357,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "GA401Q",
@@ -320,6 +365,7 @@
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GA402R",
@@ -327,6 +373,7 @@
basic_modes: [Static, Breathe, Pulse, Rainbow],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GA503Q",
@@ -334,6 +381,7 @@
basic_modes: [Static, Breathe, Pulse, Rainbow, Strobe],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GA503QE",
@@ -341,6 +389,7 @@
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GA503R",
@@ -348,6 +397,7 @@
basic_modes: [Static, Breathe, Pulse, Rainbow, Strobe],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GL503",
@@ -355,6 +405,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GL503V",
@@ -362,6 +413,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GL504G",
@@ -369,6 +421,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4, Logo, BarLeft, BarRight],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GL531",
@@ -376,6 +429,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "GL553VE",
@@ -383,6 +437,7 @@
basic_modes: [Static, Breathe, Strobe],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GL703G",
@@ -390,6 +445,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GM501G",
@@ -397,6 +453,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GU502",
@@ -404,6 +461,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "GU502G",
@@ -411,6 +469,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "GU502L",
@@ -418,6 +477,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "GU502LU",
@@ -425,6 +485,7 @@
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GU603H",
@@ -432,6 +493,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard],
),
(
board_name: "GU603Z",
@@ -439,6 +501,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard],
),
(
board_name: "GU604V",
@@ -446,6 +509,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard],
),
(
board_name: "GV301Q",
@@ -453,6 +517,7 @@
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GV301V",
@@ -460,6 +525,7 @@
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GV301VIC",
@@ -467,6 +533,7 @@
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GV601R",
@@ -474,6 +541,7 @@
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GV601VI",
@@ -481,6 +549,7 @@
basic_modes: [Static, Breathe, Pulse, Strobe],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GV604V",
@@ -488,6 +557,7 @@
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GX502",
@@ -495,6 +565,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "GX531",
@@ -502,6 +573,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GX550L",
@@ -509,6 +581,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "GX551Q",
@@ -516,6 +589,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "GX650P",
@@ -523,6 +597,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "GX701",
@@ -530,6 +605,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "GX703H",
@@ -537,6 +613,7 @@
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GZ301V",
@@ -544,6 +621,7 @@
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "GZ301VIC",
@@ -551,5 +629,6 @@
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
])

View File

@@ -1,5 +1,7 @@
use log::{error, info, warn};
use serde_derive::{Deserialize, Serialize};
use typeshare::typeshare;
use zbus::zvariant::Type;
use crate::usb::AuraDevice;
use crate::{AdvancedAuraType, AuraModeNum, AuraZone};
@@ -19,6 +21,24 @@ pub const ASUS_KEYBOARD_DEVICES: [AuraDevice; 7] = [
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct LedSupportFile(Vec<LaptopLedData>);
/// The powerr zones this laptop supports
#[typeshare]
#[cfg_attr(feature = "dbus", derive(Type), zvariant(signature = "s"))]
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Default, Clone)]
pub enum PowerZones {
/// The logo on some laptop lids
#[default]
Logo,
/// The full keyboard (not zones)
Keyboard,
/// The lightbar, typically on the front of the laptop
Lightbar,
/// The leds that may be placed around the edge of the laptop lid
Lid,
/// The led strip on the rear of some laptops
RearGlow,
}
#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize)]
pub struct LaptopLedData {
/// Found via `cat /sys/class/dmi/id/board_name`, e.g `GU603ZW`.
@@ -33,15 +53,7 @@ pub struct LaptopLedData {
pub basic_modes: Vec<AuraModeNum>,
pub basic_zones: Vec<AuraZone>,
pub advanced_type: AdvancedAuraType,
}
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
pub struct LaptopLedData456 {
pub prod_family: String,
pub board_names: Vec<String>,
pub standard: Vec<AuraModeNum>,
pub multizone: Vec<AuraZone>,
pub per_key: bool,
pub power_zones: Vec<PowerZones>,
}
impl LaptopLedData {
@@ -132,7 +144,7 @@ mod tests {
use super::LaptopLedData;
use crate::advanced::LedCode;
use crate::aura_detection::LedSupportFile;
use crate::aura_detection::{LedSupportFile, PowerZones};
// use crate::zoned::Zone;
use crate::{AdvancedAuraType, AuraModeNum, AuraZone};
@@ -144,6 +156,7 @@ mod tests {
basic_modes: vec![AuraModeNum::Static],
basic_zones: vec![AuraZone::Key1, AuraZone::Logo, AuraZone::BarLeft],
advanced_type: AdvancedAuraType::Zoned(vec![LedCode::LightbarRight]),
power_zones: vec![PowerZones::Keyboard, PowerZones::RearGlow],
};
assert!(ron::to_string(&led).is_ok());

View File

@@ -1,5 +1,6 @@
use std::fmt;
use rog_aura::aura_detection::PowerZones;
use rog_aura::usb::AuraDevice;
use rog_aura::{AdvancedAuraType, AuraModeNum, AuraZone};
use serde_derive::{Deserialize, Serialize};
@@ -61,6 +62,7 @@ pub struct LedSupportedFunctions {
pub basic_modes: Vec<AuraModeNum>,
pub basic_zones: Vec<AuraZone>,
pub advanced_type: AdvancedAura,
pub power_zones: Vec<PowerZones>,
}
#[typeshare]