Cleanup files, prep new release

This commit is contained in:
Luke D. Jones
2024-05-05 20:22:56 +12:00
parent 487d140bd5
commit 1c8e50843b
32 changed files with 616 additions and 1848 deletions

View File

@@ -1,5 +1,6 @@
## Issue description
(** I can not support distros which are outdated by default. This includes Ubuntu at least 50% of the time, and definitely includes Mint. **)
(Summarize the bug encountered)
## Steps to reproduce
@@ -21,4 +22,11 @@
(Paste any relevant logs - use code blocks (```) to format console output, logs, and code, as
it's very hard to read otherwise.)
## System details
- Distro:
- Kernel: (`uname -r`)
- Desktop:
- Xorg or wayland: ??
/label ~bug ~reproducable ~needs-investigation

View File

@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Important note
- The kernel patches from [here](https://lore.kernel.org/platform-driver-x86/20240404001652.86207-1-luke@ljones.dev/) are required. The ppt settings _will_ still apply without the patches but will be called a fail due to the read-back not being implemented (solved with kernel patch). These patches have been upstreamed for kernel 6.10
- Z13 devices will need these Z13 devices will need [these](https://lore.kernel.org/linux-input/20240416090402.31057-1-luke@ljones.dev/T/#t)
### Changed
- Upgrade to zbus 4.0.1
@@ -14,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add ability to start rog-control-center fullscreen with a width and height. This should be useful for devices like the ROG Ally.
- Many small changes due to requirements of slint UI
## Added
### Added
- Support GA402N keyboard
- Support GL553V keyboard
@@ -22,6 +27,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support Z13 lightbar (with kernel patch)
- Resupport the TUF keyboard
### BREAKING
- The aura dbus interface, and well pretty much all dbus interfaces have been changed. The Aura interface in particular works differently to begin implementing _multiple_ aura device support, including _hot-plug_ of devices (USB Aura keybords and others).
- All dbus interfaces except Aura are now in the `/org/asuslinux/` path
- Aura dbus now appear under `/org/asuslinux/<device>` and there may be multiple devices. To find these device you use the `ObjectManager` interface under the `/org/asuslinux` path.
## [v5.0.8]
### Changed

1181
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -25,8 +25,8 @@ default-members = [
resolver = "2"
[workspace.package]
version = "6.0.0-alpha4"
rust-version = "1.76"
version = "6.0.0"
rust-version = "1.77"
[workspace.dependencies]
tokio = { version = "^1.36.0", default-features = false, features = [

View File

@@ -1,5 +1,7 @@
# asusctrl manual
**NOTE:** this manual is in need of an update in some places. If you find issues please file issue reports.
`asusd` is a utility for Linux to control many aspects of various ASUS laptops
but can also be used with non-asus laptops with reduced features.
@@ -8,11 +10,10 @@ but can also be used with non-asus laptops with reduced features.
- `asusd`: The main system daemon. It is autostarted by a udev rule and systemd unit.
- `asusd-user`: The user level daemon. Currently will run an anime sequence, with RGB keyboard sequences soon.
- `asusctl`: The CLI for interacting with the system daemon
- `asus-notify`: A notification daemon with a user systemd unit that can be enabled.
## `asusd`
`asusd` is the main system-level daemon which will control/load/save various settings in a safe way for the user, along with exposing a *safe* dbus interface for these interactions. This section covers only the daemon plus the various configuration file options.
`asusd` is the main system-level daemon which will control/load/save various settings in a safe way for the user, along with exposing a _safe_ dbus interface for these interactions. This section covers only the daemon plus the various configuration file options.
The functionality that `asusd` exposes is:
@@ -56,6 +57,7 @@ Almost all modern ASUS laptops have charging limit control now. This can be cont
```json
"bat_charge_limit": 80,
```
where the number is a percentage.
### Bios control
@@ -63,7 +65,7 @@ where the number is a percentage.
Some options that you find in Armory Crate are available under this controller, so far there is:
- POST sound: this is the sound you hear on bios boot post
- GPU MUX: this controls if the dGPU is the *only* GPU, making it the main GPU and disabling the iGPU
- GPU MUX: this controls if the dGPU is the _only_ GPU, making it the main GPU and disabling the iGPU
These options are not written to the config file as they are stored in efivars. The only way to change these is to use the exposed safe dbus methods, or use the `asusctl` CLI tool.
@@ -72,6 +74,7 @@ These options are not written to the config file as they are stored in efivars.
asusctl can support setting a power profile via platform_profile drivers. This requires [power-profiles-daemon](https://gitlab.freedesktop.org/hadess/power-profiles-daemon) v0.10.0 minimum. It also requires the kernel patch for platform_profile support to be applied form [here](https://lkml.org/lkml/2021/8/18/1022) - this patch is merged to 5.15 kernel upstream.
A common use of asusctl is to bind the `fn+f5` (fan) key to `asusctl profile -n` to cycle through the 3 profiles:
1. Balanced
2. Performance
3. Quiet
@@ -97,7 +100,7 @@ There is one more controller; the support controller. The sole pupose of this co
## asusd-user
`asusd-user` is a usermode daemon. The intended purpose is to provide a method for users to run there own custom per-key keyboard effects and modes, AniMe sequences, and possibly their own profiles - all without overwriting the *base* system config. As such some parts of the system daemon will migrate to the user daemon over time with the expectation that the Linux system runs both.
`asusd-user` is a usermode daemon. The intended purpose is to provide a method for users to run there own custom per-key keyboard effects and modes, AniMe sequences, and possibly their own profiles - all without overwriting the _base_ system config. As such some parts of the system daemon will migrate to the user daemon over time with the expectation that the Linux system runs both.
As of now only AniMe is active in this with configuration in `~/.config/rog/`. On first run defaults are created that are intended to work as examples.
@@ -177,6 +180,7 @@ An Aura config itself is a file with contents:
```
If your laptop supports multizone, `"led"` can also be `"Zone": <one of the following>`
- `SingleZone` // Keyboards with only one zone
- `ZonedKbLeft` // keyboard left
- `ZonedKbLeftMid` // keyboard left-middle
@@ -238,6 +242,7 @@ Each object in the array can be one of:
##### AsusAnimation
`AsusAnimation` is specifically for running the gif files that Armory Crate comes with. `asusctl` includes all of these in `/usr/share/asusd/anime/asus/`
```json
"AsusAnimation": {
"file": "<FILE_PATH>",
@@ -260,7 +265,7 @@ Virtually the same as `AsusAnimation` but for png files, typically created in th
##### ImageAnimation
`ImageAnimation` can play *any* gif of any size.
`ImageAnimation` can play _any_ gif of any size.
```json
"ImageAnimation": {
@@ -319,6 +324,7 @@ Must be full path: `"/usr/share/asusd/anime/asus/gaming/Controller.gif"` or `/ho
**<FLOAT>**
A number from 0.0-1.0.
- `brightness`: If it is brightness it is combined with the system daemon global brightness
- `scale`: 1.0 is the original size with lower number shrinking, larger growing
- `angle`: Rotation angle in radians
@@ -327,6 +333,7 @@ A number from 0.0-1.0.
**<TIME>**
Time is the length of time to run the gif for:
```json
"time": {
"Time": {
@@ -335,17 +342,23 @@ Time is the length of time to run the gif for:
}
},
```
A cycle is how many gif loops to run:
```json
"time": {
"Cycles": 2
},
```
`Infinite` means that this gif will never end:
```json
"time": "Infinite",
```
`Fade` allows an image or gif to fade in and out, and remain at max brightness to n time:
```json
"time": {
"Fade": {
@@ -364,6 +377,7 @@ A cycle is how many gif loops to run:
}
},
```
`show_for` can be `null`, if it is `null` then the `show_for` becomes `gif_time_length - fade_in - fade_out`.
This is period for which the gif or image will be max brightness (as set).
@@ -404,26 +418,19 @@ asusctl <command> <subcommand> --help
To switch to next/previous Aura modes you will need to bind both the aura keys (if available) to one of:
**Next**
```
asusctl led-mode -n
```
**Previous**
```
asusctl led-mode -p
```
To switch Fan/Thermal profiles you need to bind the Fn+F5 key to `asusctl profile -n`.
## User NOTIFICATIONS via dbus
If you have a notifications handler set up, or are using KDE or Gnome then you
can enable the user service to get basic notifications when something changes.
```
systemctl --user enable asus-notify.service
systemctl --user start asus-notify.service
```
# License & Trademarks
Mozilla Public License 2 (MPL-2.0)

View File

@@ -123,15 +123,6 @@ bindings:
typeshare ./rog-profiles/src/ --lang=typescript --output-file=bindings/ts/profiles.ts
typeshare ./rog-platform/src/ --lang=typescript --output-file=bindings/ts/platform.ts
introspect:
gdbus introspect --system -d org.asuslinux.Daemon -o /org/asuslinux/Platform -x > bindings/dbus-xml/org-asuslinux-platform-4.xml
gdbus introspect --system -d org.asuslinux.Daemon -o /org/asuslinux/Aura -x > bindings/dbus-xml/org-asuslinux-aura-4.xml
gdbus introspect --system -d org.asuslinux.Daemon -o /org/asuslinux/Anime -x > bindings/dbus-xml/org-asuslinux-anime-4.xml
gdbus introspect --system -d org.asuslinux.Daemon -o /org/asuslinux/FanCurves -x > bindings/dbus-xml/org-asuslinux-fan-curves-4.xml
xmlstarlet ed -L -O -d '//interface[@name="org.freedesktop.DBus.Introspectable"]' bindings/dbus-xml/org-asuslinux-*
xmlstarlet ed -L -O -d '//interface[@name="org.freedesktop.DBus.Properties"]' bindings/dbus-xml/org-asuslinux-*
xmlstarlet ed -L -O -d '//interface[@name="org.freedesktop.DBus.Peer"]' bindings/dbus-xml/org-asuslinux-*
translate:
find -name \*.slint | xargs slint-tr-extractor -o rog-control-center/translations/en/rog-control-center.po

View File

@@ -11,7 +11,7 @@ Now includes a GUI, `rog-control-center`.
## Kernel support
**The minimum supported kernel version is 6.6**
**The minimum supported kernel version is 6.10**, which will contain the patches from [here](https://lore.kernel.org/platform-driver-x86/20240404001652.86207-1-luke@ljones.dev/). Z13 devices will need [these](https://lore.kernel.org/linux-input/20240416090402.31057-1-luke@ljones.dev/T/#t)
## Goals
@@ -41,7 +41,9 @@ to this:
```
Bus 001 Device 002: ID 0b05:1866 ASUSTek Computer, Inc. N-KEY Device
```
or
```
Bus 003 Device 002: ID 0b05:19b6 ASUSTek Computer, Inc. [unknown]
```
@@ -53,16 +55,16 @@ and AniMe parts should work regardless of your latop make.
The list is a bit outdated as many features have been enabled in the Linux kernel with upstream patches and then supported in asusctl suite.
- [X] System daemon
- [X] GUI app (includes tray and notifications)
- [X] Setting/modifying built-in LED modes
- [X] Per-key LED setting
- [X] Fancy LED modes (See examples) (currently being reworked)
- [X] AniMatrix display on G14 and M16 models that include it
- [X] Set battery charge limit (with kernel supporting this)
- [X] Fan curve control on supported laptops (G14/G15, some TUF like FA507)
- [X] Toggle bios setting for boot/POST sound
- [X] Toggle GPU MUX (g-sync, or called MUX on 2022+ laptops)
- [x] System daemon
- [x] GUI app (includes tray and notifications)
- [x] Setting/modifying built-in LED modes
- [x] Per-key LED setting
- [x] Fancy LED modes (See examples) (currently being reworked)
- [x] AniMatrix display on G14 and M16 models that include it
- [x] Set battery charge limit (with kernel supporting this)
- [x] Fan curve control on supported laptops (G14/G15, some TUF like FA507)
- [x] Toggle bios setting for boot/POST sound
- [x] Toggle GPU MUX (g-sync, or called MUX on 2022+ laptops)
# GUI
@@ -93,6 +95,7 @@ Works with KDE Plasma (without GTK packages)
instructions removed as outdated
## Installing
- Fedora copr = https://copr.fedorainfracloud.org/coprs/lukenukem/asus-linux/
- openSUSE = https://download.opensuse.org/repositories/home:/luke_nukem:/asus/
@@ -101,7 +104,7 @@ instructions removed as outdated
The default init method is to use the udev rule, this ensures that the service is
started when the device is initialised and ready.
You may also need to activate the service for debian install. If running Pop!_OS, I suggest disabling `system76-power` gnome-shell extension and systemd service.
You may also need to activate the service for debian install. If running Pop!\_OS, I suggest disabling `system76-power` gnome-shell extension and systemd service.
## Upgrading
@@ -127,7 +130,7 @@ Dbus introsepction XML requires with `make introspection` requires `anime_sim` t
## AniMe Matrix simulator
A simulator using SDL2 can be built using `cargo build --package rog_simulators` and run with `./target/debug/anime_sim`. Once started `asusd` will need restarting to pick it up. If running this sim on a laptop *with* the display, the simulated display will be used instead of the physical display.
A simulator using SDL2 can be built using `cargo build --package rog_simulators` and run with `./target/debug/anime_sim`. Once started `asusd` will need restarting to pick it up. If running this sim on a laptop _with_ the display, the simulated display will be used instead of the physical display.
## Supporting more laptops

View File

@@ -119,7 +119,11 @@ fn check_service(name: &str) -> bool {
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")
let f = zbus::blocking::fdo::ObjectManagerProxy::new(
&conn,
"org.asuslinux.Daemon",
"/org/asuslinux",
)
.unwrap();
let interfaces = f.get_managed_objects().unwrap();
let mut aura_paths = Vec::new();

View File

@@ -64,7 +64,7 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
let mut connection = Connection::system().await?;
connection
.object_server()
.at("/org", ObjectManager)
.at("/org/asuslinux", ObjectManager)
.await
.unwrap();

View File

@@ -1,95 +0,0 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.asuslinux.Daemon">
<!--
Writes a data stream of length. Will force system thread to exit until
it is restarted
-->
<method name="Write">
<arg name="input" type="(ays)" direction="in"/>
</method>
<!--
The main loop is the base system set action if the user isn't running
the user daemon
-->
<method name="RunMainLoop">
<arg name="start" type="b" direction="in"/>
</method>
<!--
Get the device state as stored by asusd
-->
<method name="DeviceState">
<arg type="(bub(ssss)bbbu)" direction="out"/>
</method>
<!--
Set base brightness level
-->
<!--
Set base brightness level
-->
<property name="Brightness" type="u" access="readwrite"/>
<!--
Set which builtin animation is used for each stage
-->
<property name="BuiltinAnimations" type="(ssss)" access="readwrite"/>
<!--
Enable the builtin animations or not. This is quivalent to "Powersave
animations" in Armory crate
-->
<property name="BuiltinsEnabled" type="b" access="readwrite"/>
<!--
Set whether the AniMe is enabled at all
-->
<property name="EnableDisplay" type="b" access="readwrite"/>
<!--
Set if to turn the AniMe Matrix off when the lid is closed
-->
<property name="OffWhenLidClosed" type="b" access="readwrite"/>
<!--
Set if to turn the AniMe Matrix off when the laptop is suspended
-->
<property name="OffWhenSuspended" type="b" access="readwrite"/>
<!--
Set if to turn the AniMe Matrix off when external power is unplugged
-->
<property name="OffWhenUnplugged" type="b" access="readwrite"/>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface_name" type="s" direction="in"/>
<arg type="a{sv}" direction="out"/>
</method>
<!--
Emits the `org.freedesktop.DBus.Properties.PropertiesChanged` signal.
-->
<signal name="PropertiesChanged">
<arg name="interface_name" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
<interface name="org.freedesktop.DBus.Peer">
<method name="Ping">
</method>
<method name="GetMachineId">
<arg type="s" direction="out"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg type="s" direction="out"/>
</method>
</interface>
</node>

View File

@@ -1,108 +0,0 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.asuslinux.Daemon">
<method name="GetLedModeData">
<arg type="(uu(yyy)(yyy)ss)" direction="out"/>
</method>
<!--
Get the data set for every mode available
-->
<method name="AllModeData">
<arg type="a{u(uu(yyy)(yyy)ss)}" direction="out"/>
</method>
<!--
On machine that have some form of either per-key keyboard or per-zone
this can be used to write custom effects over dbus. The input is a
nested `Vec<Vec<8>>` where `Vec<u8>` is a raw USB packet
-->
<method name="DirectAddressingRaw">
<arg name="data" type="aay" direction="in"/>
</method>
<!--
Return the current LED brightness
-->
<!--
Set the keyboard brightness level (0-3)
-->
<property name="Brightness" type="u" access="readwrite"/>
<!--
Return the device type for this Aura keyboard
-->
<property name="DeviceType" type="s" access="read"/>
<!--
The current mode data
-->
<!--
Set an Aura effect if the effect mode or zone is supported.
On success the aura config file is read to refresh cached values, then
the effect is stored and config written to disk.
-->
<property name="LedMode" type="u" access="readwrite"/>
<!--
The current mode data
-->
<!--
Set an Aura effect if the effect mode or zone is supported.
On success the aura config file is read to refresh cached values, then
the effect is stored and config written to disk.
-->
<property name="LedModeData" type="(uu(yyy)(yyy)ss)" access="readwrite"/>
<!--
Set a variety of states, input is array of enum.
`enabled` sets if the sent array should be disabled or enabled
For Modern ROG devices the "enabled" flag is ignored.
-->
<property name="LedPower" type="(auau((ubbbb)(ubbbb)(ubbbb)(ubbbb)(ubbbb)))" access="readwrite"/>
<!--
The total available modes
-->
<property name="SupportedBasicModes" type="au" access="read"/>
<property name="SupportedBasicZones" type="au" access="read"/>
<!--
Total levels of brightness available
-->
<property name="SupportedBrightness" type="au" access="read"/>
<property name="SupportedPowerZones" type="au" access="read"/>
</interface>
<interface name="org.freedesktop.DBus.Peer">
<method name="Ping">
</method>
<method name="GetMachineId">
<arg type="s" direction="out"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg type="s" direction="out"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface_name" type="s" direction="in"/>
<arg type="a{sv}" direction="out"/>
</method>
<!--
Emits the `org.freedesktop.DBus.Properties.PropertiesChanged` signal.
-->
<signal name="PropertiesChanged">
<arg name="interface_name" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
</node>

View File

@@ -1,94 +0,0 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface_name" type="s" direction="in"/>
<arg type="a{sv}" direction="out"/>
</method>
<!--
Emits the `org.freedesktop.DBus.Properties.PropertiesChanged` signal.
-->
<signal name="PropertiesChanged">
<arg name="interface_name" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
<interface name="org.freedesktop.DBus.Peer">
<method name="Ping">
</method>
<method name="GetMachineId">
<arg type="s" direction="out"/>
</method>
</interface>
<interface name="org.asuslinux.Daemon">
<!--
Set all fan curves for a profile to enabled status. Will also activate a
fan curve if in the same profile mode
-->
<method name="SetFanCurvesEnabled">
<arg name="profile" type="u" direction="in"/>
<arg name="enabled" type="b" direction="in"/>
</method>
<!--
Set a single fan curve for a profile to enabled status. Will also
activate a fan curve if in the same profile mode
-->
<method name="SetProfileFanCurveEnabled">
<arg name="profile" type="u" direction="in"/>
<arg name="fan" type="s" direction="in"/>
<arg name="enabled" type="b" direction="in"/>
</method>
<!--
Get the fan-curve data for the currently active ThrottlePolicy
-->
<method name="FanCurveData">
<arg name="profile" type="u" direction="in"/>
<arg type="a(s(yyyyyyyy)(yyyyyyyy)b)" direction="out"/>
</method>
<!--
Set the fan curve for the specified profile.
Will also activate the fan curve if the user is in the same mode.
-->
<method name="SetFanCurve">
<arg name="profile" type="u" direction="in"/>
<arg name="curve" type="(s(yyyyyyyy)(yyyyyyyy)b)" direction="in"/>
</method>
<!--
Reset the stored (self) and device curve to the defaults of the
platform.
Each platform_profile has a different default and the defualt can be
read only for the currently active profile.
-->
<method name="SetActiveCurveToDefaults">
</method>
<!--
Reset the stored (self) and device curve to the defaults of the
platform.
Each platform_profile has a different default and the defualt can be
read only for the currently active profile.
-->
<method name="ResetProfileCurves">
<arg name="profile" type="u" direction="in"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg type="s" direction="out"/>
</method>
</interface>
</node>

View File

@@ -1,132 +0,0 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.asuslinux.Daemon">
<!--
Returns a list of property names that this system supports
-->
<method name="SupportedProperties">
<arg type="as" direction="out"/>
</method>
<method name="SupportedInterfaces">
<arg type="as" direction="out"/>
</method>
<!--
Toggle to next platform_profile. Names provided by `Profiles`.
If fan-curves are supported will also activate a fan curve for profile.
-->
<method name="NextThrottleThermalPolicy">
</method>
<property name="ChargeControlEndThreshold" type="y" access="readwrite"/>
<property name="DgpuDisable" type="b" access="read"/>
<property name="EgpuEnable" type="b" access="read"/>
<property name="GpuMuxMode" type="y" access="readwrite"/>
<!--
Get the `panel_od` value from platform. Updates the stored value in
internal config also.
-->
<property name="MiniLedMode" type="b" access="readwrite"/>
<!--
Set the dynamic boost limit of the Nvidia dGPU:
* min=5, max=25
-->
<property name="NvDynamicBoost" type="y" access="readwrite"/>
<!--
Set the target temperature limit of the Nvidia dGPU:
* min=75, max=87
-->
<property name="NvTempTarget" type="y" access="readwrite"/>
<!--
Get the `panel_od` value from platform. Updates the stored value in
internal config also.
-->
<property name="PanelOd" type="b" access="readwrite"/>
<!--
***********************************************************************
-->
<property name="PostAnimationSound" type="b" access="readwrite"/>
<!--
Set the APU SPPT limit. Shown on full AMD systems only:
* min=5, max=130
-->
<property name="PptApuSppt" type="y" access="readwrite"/>
<!--
Set the Fast Package Power Tracking Limit of CPU. AMD+Nvidia only:
* min=5, max=250
-->
<property name="PptFppt" type="y" access="readwrite"/>
<!--
***********************************************************************
Set the Package Power Target total of CPU: PL1 on Intel, SPL on AMD.
Shown on Intel+Nvidia or AMD+Nvidia based systems:
* min=5, max=250
-->
<property name="PptPl1Spl" type="y" access="readwrite"/>
<!--
Set the Slow Package Power Tracking Limit of CPU: PL2 on Intel, SPPT,
on AMD. Shown on Intel+Nvidia or AMD+Nvidia based systems:
* min=5, max=250
-->
<property name="PptPl2Sppt" type="y" access="readwrite"/>
<!--
Set the platform SPPT limit. Shown on full AMD systems only:
* min=5, max=130
-->
<property name="PptPlatformSppt" type="y" access="readwrite"/>
<!--
The energy_performance_preference for the balanced throttle/platform
profile
-->
<property name="ThrottleBalancedEpp" type="u" access="readwrite"/>
<!--
The energy_performance_preference for the performance throttle/platform
profile
-->
<property name="ThrottlePerformanceEpp" type="u" access="readwrite"/>
<property name="ThrottlePolicyLinkedEpp" type="b" access="readwrite"/>
<property name="ThrottlePolicyOnAc" type="u" access="readwrite"/>
<property name="ThrottlePolicyOnBattery" type="u" access="readwrite"/>
<!--
The energy_performance_preference for the quiet throttle/platform
profile
-->
<property name="ThrottleQuietEpp" type="u" access="readwrite"/>
<property name="ThrottleThermalPolicy" type="u" access="readwrite"/>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface_name" type="s" direction="in"/>
<arg type="a{sv}" direction="out"/>
</method>
<!--
Emits the `org.freedesktop.DBus.Properties.PropertiesChanged` signal.
-->
<signal name="PropertiesChanged">
<arg name="interface_name" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg type="s" direction="out"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Peer">
<method name="Ping">
</method>
<method name="GetMachineId">
<arg type="s" direction="out"/>
</method>
</interface>
</node>

View File

@@ -1,57 +0,0 @@
/*
Generated by typeshare 1.7.0
*/
export enum AnimBooting {
GlitchConstruction = "GlitchConstruction",
StaticEmergence = "StaticEmergence",
}
export enum AnimAwake {
BinaryBannerScroll = "BinaryBannerScroll",
RogLogoGlitch = "RogLogoGlitch",
}
export enum AnimSleeping {
BannerSwipe = "BannerSwipe",
Starfield = "Starfield",
}
export enum AnimShutdown {
GlitchOut = "GlitchOut",
SeeYa = "SeeYa",
}
export interface Animations {
boot: AnimBooting;
awake: AnimAwake;
sleep: AnimSleeping;
shutdown: AnimShutdown;
}
/** Base LED brightness of the display */
export enum Brightness {
Off = "Off",
Low = "Low",
Med = "Med",
High = "High",
}
export interface DeviceState {
display_enabled: boolean;
display_brightness: Brightness;
builtin_anims_enabled: boolean;
builtin_anims: Animations;
off_when_unplugged: boolean;
off_when_suspended: boolean;
off_when_lid_closed: boolean;
brightness_on_battery: Brightness;
}
export enum AnimeType {
GA401 = "GA401",
GA402 = "GA402",
GU604 = "GU604",
Unknown = "Unknown",
}

View File

@@ -1,233 +0,0 @@
/*
Generated by typeshare 1.7.0
*/
/** Represents the per-key raw USB packets */
export type UsbPackets = number[][];
/**
* A `UsbPackets` contains all data to change the full set of keyboard
* key colours individually.
*
* Each row of the internal array is a full HID packet that can be sent
* to the keyboard EC. One row controls one group of keys, these keys are not
* necessarily all on the same row of the keyboard, with some splitting between
* two rows.
*/
export interface LedUsbPackets {
/** The packet data used to send data to the USB keyboard */
usb_packets: UsbPackets;
/**
* Wether or not this packet collection is zoned. The determines which
* starting bytes are used and what the indexing is for lightbar RGB
* colours
*/
zoned: boolean;
}
export interface Colour {
r: number;
g: number;
b: number;
}
/** Enum of modes that convert to the actual number required by a USB HID packet */
export enum AuraModeNum {
Static = "Static",
Breathe = "Breathe",
Strobe = "Strobe",
Rainbow = "Rainbow",
Star = "Star",
Rain = "Rain",
Highlight = "Highlight",
Laser = "Laser",
Ripple = "Ripple",
Pulse = "Pulse",
Comet = "Comet",
Flash = "Flash",
}
/** Base effects have no zoning, while multizone is 1-4 */
export enum AuraZone {
/** Used if keyboard has no zones, or if setting all */
None = "None",
/** Leftmost zone */
Key1 = "Key1",
/** Zone after leftmost */
Key2 = "Key2",
/** Zone second from right */
Key3 = "Key3",
/** Rightmost zone */
Key4 = "Key4",
/** Logo on the lid (or elsewhere?) */
Logo = "Logo",
/** The left part of a lightbar (typically on the front of laptop) */
BarLeft = "BarLeft",
/** The right part of a lightbar */
BarRight = "BarRight",
}
export enum Speed {
Low = "Low",
Med = "Med",
High = "High",
}
/**
* Used for Rainbow mode.
*
* Enum corresponds to the required integer value
*/
export enum Direction {
Right = "Right",
Left = "Left",
Up = "Up",
Down = "Down",
}
/**
* Default factory modes structure. This easily converts to an USB HID packet
* with:
* ```rust
* // let bytes: [u8; LED_MSG_LEN] = mode.into();
* ```
*/
export interface AuraEffect {
/** The effect type */
mode: AuraModeNum;
/** `AuraZone::None` for no zone or zoneless keyboards */
zone: AuraZone;
/** Primary colour for all modes */
colour1: Colour;
/** Secondary colour in some modes like Breathing or Stars */
colour2: Colour;
/** One of three speeds for modes that support speed (most that animate) */
speed: Speed;
/** Up, down, left, right. Only Rainbow mode seems to use this */
direction: Direction;
}
/** 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 interface KbAuraPowerState {
zone: PowerZones;
boot: boolean;
awake: boolean;
sleep: boolean;
shutdown: boolean;
}
/**
* Track and control the Aura keyboard power state
*
* # Bits for newer 0x18c6, 0x19B6, 0x1a30, keyboard models
*
* | 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 interface AuraPower {
keyboard: KbAuraPowerState;
logo: KbAuraPowerState;
lightbar: KbAuraPowerState;
lid: KbAuraPowerState;
rear_glow: KbAuraPowerState;
}
export enum AuraDevTuf {
Boot = "Boot",
Awake = "Awake",
Sleep = "Sleep",
Keyboard = "Keyboard",
}
/**
* # 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 | 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",
Keyboard = "Keyboard",
Lightbar = "Lightbar",
Boot = "Boot",
Sleep = "Sleep",
}
/** This struct is intended as a helper to pass args to generic dbus interface */
export interface AuraPowerDev {
/**
* TUF laptops use a similar style of control to the older ROG devices but
* through WMI
*/
tuf: AuraDevTuf[];
/**
* Pre-0x19b6 devices use a different smaller scheme to the newer ROG
* devices
*/
old_rog: AuraDevRog1[];
/** ASUS standardised control scheme from 2020 onwards */
rog: AuraPower;
}
export enum LedBrightness {
Off = "Off",
Low = "Low",
Med = "Med",
High = "High",
}
export enum AuraDevice {
Tuf = "Tuf",
X1854 = "X1854",
X1869 = "X1869",
X1866 = "X1866",
X18c6 = "X18c6",
X19b6 = "X19b6",
X1a30 = "X1a30",
X1abe = "X1abe",
Unknown = "Unknown",
}

View File

@@ -1,55 +0,0 @@
/*
Generated by typeshare 1.7.0
*/
export enum CPUGovernor {
Performance = "Performance",
Powersave = "Powersave",
BadValue = "BadValue",
}
export enum CPUEPP {
Default = "Default",
Performance = "Performance",
BalancePerformance = "BalancePerformance",
BalancePower = "BalancePower",
Power = "Power",
}
export enum GpuMode {
Discrete = "Discrete",
Optimus = "Optimus",
Integrated = "Integrated",
Egpu = "Egpu",
Vfio = "Vfio",
Ultimate = "Ultimate",
Error = "Error",
NotSupported = "NotSupported",
}
/** `throttle_thermal_policy` in asus_wmi */
export enum ThrottlePolicy {
Balanced = "Balanced",
Performance = "Performance",
Quiet = "Quiet",
}
/** CamelCase names of the properties. Intended for use with DBUS */
export enum Properties {
ChargeControlEndThreshold = "ChargeControlEndThreshold",
DgpuDisable = "DgpuDisable",
GpuMuxMode = "GpuMuxMode",
PostAnimationSound = "PostAnimationSound",
PanelOd = "PanelOd",
MiniLedMode = "MiniLedMode",
EgpuEnable = "EgpuEnable",
ThrottlePolicy = "ThrottlePolicy",
PptPl1Spl = "PptPl1Spl",
PptPl2Sppt = "PptPl2Sppt",
PptFppt = "PptFppt",
PptApuSppt = "PptApuSppt",
PptPlatformSppt = "PptPlatformSppt",
NvDynamicBoost = "NvDynamicBoost",
NvTempTarget = "NvTempTarget",
}

View File

@@ -1,24 +0,0 @@
/*
Generated by typeshare 1.7.0
*/
export enum FanCurvePU {
CPU = "CPU",
GPU = "GPU",
MID = "MID",
}
export interface CurveData {
fan: FanCurvePU;
pwm: [number, number, number, number, number, number, number, number];
temp: [number, number, number, number, number, number, number, number];
enabled: boolean;
}
/** Main purpose of `FanCurves` is to enable restoring state on system boot */
export interface FanCurveProfiles {
balanced: CurveData[];
performance: CurveData[];
quiet: CurveData[];
}

View File

@@ -74,7 +74,7 @@ pub struct Config461 {
pub startup_in_background: bool,
pub ac_command: String,
pub bat_command: String,
pub enable_notifications: bool,
pub enable_dgpu_notifications: bool,
pub dark_mode: bool,
// This field must be last
pub enabled_notifications: EnabledNotifications,

View File

@@ -94,28 +94,34 @@ fn set_tray_icon_and_tip(
supergfx_active: bool,
) {
if let Some(icons) = ICONS.get() {
match power {
GfxPower::Suspended => tray.set_icon(Some(icons.rog_blue.clone())),
let icon = match power {
GfxPower::Suspended => icons.rog_blue.clone(),
GfxPower::Off => {
if mode == GfxMode::Vfio {
tray.set_icon(Some(icons.rog_red.clone()))
icons.rog_red.clone()
} else {
tray.set_icon(Some(icons.rog_green.clone()))
icons.rog_green.clone()
}
}
GfxPower::AsusDisabled => tray.set_icon(Some(icons.rog_white.clone())),
GfxPower::AsusMuxDiscreet | GfxPower::Active => {
tray.set_icon(Some(icons.rog_red.clone()));
}
GfxPower::AsusDisabled => icons.rog_white.clone(),
GfxPower::AsusMuxDiscreet | GfxPower::Active => icons.rog_red.clone(),
GfxPower::Unknown => {
if supergfx_active {
tray.set_icon(Some(icons.gpu_integrated.clone()));
icons.gpu_integrated.clone()
} else {
tray.set_icon(Some(icons.rog_red.clone()));
icons.rog_red.clone()
}
}
};
// *tray = TrayIconBuilder::<TrayAction>::new()
// .with_icon(icon)
// .with_tooltip(format!("ROG: gpu mode = {mode:?}, gpu power = {power:?}"))
// .with_menu(build_menu())
// .build(do_action)
// .map_err(|e| log::error!("Tray unable to be initialised: {e:?}"))
// .unwrap();
tray.set_icon(Some(icon));
tray.set_tooltip(format!("ROG: gpu mode = {mode:?}, gpu power = {power:?}"));
}
}
@@ -164,6 +170,7 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
};
info!("Started ROGTray");
let mut last_power = GfxPower::Unknown;
loop {
if let Ok(lock) = config.try_lock() {
if !lock.enable_tray_icon {
@@ -172,10 +179,13 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
}
if let Ok(mode) = gfx_proxy.mode() {
if let Ok(power) = gfx_proxy.power() {
if last_power != power {
set_tray_icon_and_tip(mode, power, &mut tray, supergfx_active);
last_power = power;
}
}
sleep(Duration::from_millis(50));
}
sleep(Duration::from_millis(500));
}
}
});

View File

@@ -164,7 +164,7 @@ pub fn setup_app_settings_page(ui: &MainWindow, config: Arc<Mutex<Config>>) {
}
});
let config_copy = config.clone();
global.on_set_enable_notifications(move |enable| {
global.on_set_enable_dgpu_notifications(move |enable| {
if let Ok(mut lock) = config_copy.try_lock() {
lock.notifications.enabled = enable;
lock.write();
@@ -175,6 +175,6 @@ pub fn setup_app_settings_page(ui: &MainWindow, config: Arc<Mutex<Config>>) {
global.set_run_in_background(lock.run_in_background);
global.set_startup_in_background(lock.startup_in_background);
global.set_enable_tray_icon(lock.enable_tray_icon);
global.set_enable_notifications(lock.notifications.enabled);
global.set_enable_dgpu_notifications(lock.notifications.enabled);
}
}

View File

@@ -34,7 +34,11 @@ fn decode_hex(s: &str) -> RgbaColor<u8> {
pub fn has_aura_iface_blocking() -> Result<bool, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system()?;
let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/org")?;
let f = zbus::blocking::fdo::ObjectManagerProxy::new(
&conn,
"org.asuslinux.Daemon",
"/org/asuslinux",
)?;
let interfaces = f.get_managed_objects()?;
let mut aura_paths = Vec::new();
for v in interfaces.iter() {
@@ -51,7 +55,8 @@ pub fn has_aura_iface_blocking() -> Result<bool, Box<dyn std::error::Error>> {
// TODO: return all
async fn find_aura_iface() -> Result<AuraProxy<'static>, Box<dyn std::error::Error>> {
let conn = zbus::Connection::system().await?;
let f = zbus::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/org").await?;
let f =
zbus::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/org/asuslinux").await?;
let interfaces = f.get_managed_objects().await?;
let mut aura_paths = Vec::new();
for v in interfaces.iter() {

View File

@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-05-04 22:54+0000\n"
"POT-Creation-Date: 2024-05-05 08:22+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"
@@ -154,7 +154,7 @@ msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:59
msgctxt "PageAppSettings"
msgid "Enable change notifications"
msgid "Enable dGPU notifications"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:27

View File

@@ -15,6 +15,11 @@ export component PageAbout inherits VerticalLayout {
VerticalBox {
alignment: LayoutAlignment.center;
Text {
wrap: TextWrap.word-wrap;
text: "You will require these patches: https://lore.kernel.org/platform-driver-x86/20240404001652.86207-1-luke@ljones.dev/, they have been merged upstream for kernel 6.10. The main thing is that the PPT settings will apply without them, but the read/back will fail";
}
Text {
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;

View File

@@ -8,8 +8,8 @@ export global AppSettingsPageData {
callback set_startup_in_background(bool);
in-out property <bool> enable_tray_icon;
callback set_enable_tray_icon(bool);
in-out property <bool> enable_notifications;
callback set_enable_notifications(bool);
in-out property <bool> enable_dgpu_notifications;
callback set_enable_dgpu_notifications(bool);
}
export component PageAppSettings inherits VerticalLayout {
@@ -56,10 +56,10 @@ export component PageAppSettings inherits VerticalLayout {
SystemToggle {
width: parent.width * 1px / 2px;
text: @tr("Enable change notifications");
checked <=> AppSettingsPageData.enable_notifications;
text: @tr("Enable dGPU notifications");
checked <=> AppSettingsPageData.enable_dgpu_notifications;
toggled => {
AppSettingsPageData.set_enable_notifications(AppSettingsPageData.enable_notifications)
AppSettingsPageData.set_enable_dgpu_notifications(AppSettingsPageData.enable_dgpu_notifications)
}
}
}

View File

@@ -1,9 +0,0 @@
# If you see this, run "rustup self update" to get rustup 1.23 or newer.
# NOTE: above comment is for older `rustup` (before TOML support was added),
# which will treat the first line as the toolchain name, and therefore show it
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
[toolchain]
channel = "stable"
components = [ "rustfmt", "clippy" ]

View File

@@ -20,11 +20,11 @@ log.workspace = true
glam.workspace = true
uhid-virt = "^0.0.6"
uhid-virt = "^0.0.7"
rog_anime = { path = "../rog-anime", features = ["dbus"] }
[dependencies.sdl2]
version = "0.35"
version = "0.36"
default-features = false
# features = ["gfx"]

View File

@@ -1,92 +0,0 @@
use rog_aura::{GX502Layout, Key, KeyColourArray, KeyLayout};
use rog_dbus::RogDbusClientBlocking;
use std::collections::LinkedList;
#[derive(Debug, Clone)]
struct Ball {
position: (i32, i32),
direction: (i32, i32),
trail: LinkedList<(i32, i32)>,
}
impl Ball {
fn new(x: i32, y: i32, trail_len: u32) -> Self {
let mut trail = LinkedList::new();
for _ in 1..=trail_len {
trail.push_back((x, y));
}
Ball {
position: (x, y),
direction: (1, 1),
trail,
}
}
#[allow(clippy::if_same_then_else)]
fn update(&mut self, key_map: &[[Key; 17]]) {
let pos = self.position;
let dir = self.direction;
if pos.0 + dir.0 > key_map[pos.1 as usize].len() as i32 - 1 || pos.0 + dir.0 < 0 {
self.direction.0 *= -1;
} else if key_map[(pos.1) as usize][(pos.0 + dir.0) as usize] == Key::None {
self.direction.0 *= -1;
}
if pos.1 + dir.1 > key_map.len() as i32 - 1 || pos.1 + dir.1 < 0 {
self.direction.1 *= -1;
} else if key_map[(pos.1 + dir.1) as usize][(pos.0) as usize] == Key::None {
self.direction.1 *= -1;
}
self.trail.pop_front();
self.trail.push_back(self.position);
self.position.0 += self.direction.0;
self.position.1 += self.direction.1;
if self.position.0 > key_map[self.position.1 as usize].len() as i32 {
self.position.0 = key_map[self.position.1 as usize].len() as i32 - 1;
}
}
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let (dbus, _) = RogDbusClientBlocking::new()?;
let mut colours = KeyColourArray::new();
let layout = GX502Layout::default();
let mut balls = [Ball::new(2, 1, 12), Ball::new(4, 6, 12)];
let rows = layout.get_rows();
loop {
for (n, ball) in balls.iter_mut().enumerate() {
ball.update(rows);
for (i, pos) in ball.trail.iter().enumerate() {
if let Some(c) = colours.key(rows[pos.1 as usize][pos.0 as usize]) {
*c.0 = 0;
*c.1 = 0;
*c.2 = 0;
if n == 0 {
*c.0 = i as u8 * (255 / ball.trail.len() as u8);
} else if n == 1 {
*c.1 = i as u8 * (255 / ball.trail.len() as u8);
} else if n == 2 {
*c.2 = i as u8 * (255 / ball.trail.len() as u8);
}
};
}
if let Some(c) = colours.key(rows[ball.position.1 as usize][ball.position.0 as usize]) {
*c.0 = 255;
*c.1 = 255;
*c.2 = 255;
};
}
dbus.proxies().led().set_per_key(&colours)?;
std::thread::sleep(std::time::Duration::from_millis(10));
}
}

View File

@@ -1,28 +0,0 @@
use rog_aura::{GX502Layout, KeyColourArray, KeyLayout};
use rog_dbus::RogDbusClient;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let (dbus, _) = RogDbusClient::new()?;
let layout = GX502Layout::default();
dbus.proxies().led().init_effect()?;
let rows = layout.get_rows();
let mut column = 0;
loop {
let mut key_colours = KeyColourArray::new();
for row in rows {
if let Some(c) = key_colours.key(row[column as usize]) {
*c.0 = 255;
};
}
if column == rows[0].len() - 1 {
column = 0
} else {
column += 1;
}
dbus.proxies().led().set_per_key(&key_colours)?;
}
}

View File

@@ -1,54 +0,0 @@
use rog_aura::{GX502Layout, Key, KeyColourArray, KeyLayout};
use rog_dbus::RogDbusClient;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let (dbus, _) = RogDbusClient::new()?;
let mut key_colours = KeyColourArray::new();
let layout = GX502Layout::default();
dbus.proxies().led().init_effect()?;
let rows = layout.get_rows();
loop {
for (r, row) in rows.iter().enumerate() {
for (k, key) in row.iter().enumerate() {
if let Some(c) = key_colours.key(*key) {
*c.0 = 255;
};
// Last key of previous row
if k == 0 {
if r == 0 {
let k = &rows[rows.len() - 1][rows[rows.len() - 1].len() - 1];
if let Some(c) = key_colours.key(*k) {
*c.0 = 0;
};
} else {
let k = &rows[r - 1][rows[r - 1].len() - 1];
if let Some(c) = key_colours.key(*k) {
*c.0 = 0;
};
}
} else {
let k = &rows[r][k - 1];
if let Some(c) = key_colours.key(*k) {
*c.0 = 0;
};
}
if let Some(c) = key_colours.key(Key::Up) {
*c.0 = 255;
};
*key_colours.key(Key::Left).unwrap().0 = 255;
*key_colours.key(Key::Right).unwrap().0 = 255;
*key_colours.key(Key::Down).unwrap().0 = 255;
*key_colours.key(Key::W).unwrap().0 = 255;
*key_colours.key(Key::A).unwrap().0 = 255;
*key_colours.key(Key::S).unwrap().0 = 255;
*key_colours.key(Key::D).unwrap().0 = 255;
dbus.proxies().led().set_per_key(&key_colours)?;
std::thread::sleep(std::time::Duration::from_millis(100));
}
}
}
}

View File

@@ -1,31 +0,0 @@
use rog_aura::{Key, KeyColourArray};
use rog_dbus::RogDbusClient;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let (dbus, _) = RogDbusClient::new()?;
let mut key_colours = KeyColourArray::new();
dbus.proxies().led().init_effect()?;
loop {
let count = 49;
for _ in 0..count {
*key_colours.key(Key::Rog).unwrap().0 += 5;
*key_colours.key(Key::L).unwrap().0 += 5;
*key_colours.key(Key::I).unwrap().0 += 5;
*key_colours.key(Key::N).unwrap().0 += 5;
*key_colours.key(Key::U).unwrap().0 += 5;
*key_colours.key(Key::X).unwrap().0 += 5;
dbus.proxies().led().set_per_key(&key_colours)?;
}
for _ in 0..count {
*key_colours.key(Key::Rog).unwrap().0 -= 5;
*key_colours.key(Key::L).unwrap().0 -= 5;
*key_colours.key(Key::I).unwrap().0 -= 5;
*key_colours.key(Key::N).unwrap().0 -= 5;
*key_colours.key(Key::U).unwrap().0 -= 5;
*key_colours.key(Key::X).unwrap().0 -= 5;
dbus.proxies().led().set_per_key(&key_colours)?;
}
}
}

View File

@@ -1,38 +0,0 @@
use rog_aura::{GX502Layout, KeyColourArray, KeyLayout};
use rog_dbus::RogDbusClient;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let (dbus, _) = RogDbusClient::new()?;
let mut key_colours = KeyColourArray::new();
let layout = GX502Layout::default();
dbus.proxies().led().init_effect()?;
let rows = layout.get_rows();
let mut fade = 50;
let mut flip = false;
loop {
for row in rows {
for (k, key) in row.iter().enumerate() {
if let Some(c) = key_colours.key(*key) {
*c.0 = 255 / fade / (k + 1) as u8;
};
}
}
dbus.proxies().led().set_per_key(&key_colours)?;
if flip {
if fade > 1 {
fade -= 1;
} else {
flip = !flip;
}
} else if fade < 17 {
fade += 1;
} else {
flip = !flip;
}
}
}

View File

@@ -1,49 +0,0 @@
// TODO: macro
// let conn = zbus::blocking::Connection::system().unwrap();
// let proxy = PlatformProxyBlocking::new(&conn).unwrap();
// //
// let proxy2 = proxy.clone();
// let handle = ui.as_weak();
// ui.global::<SystemPageData>().on_set_charge_limit(move |limit| {
// if let Some(handle) = handle.upgrade() {
// match proxy2.set_charge_control_end_threshold(limit as u8) {
// Ok(_) => handle
// .invoke_show_toast(format!("Charge limit successfully set to {limit}").into()),
// Err(e) => handle.invoke_show_toast(format!("Charge limit failed: {e}").into()),
// }
// }
// });
// let proxy2 = proxy.clone();
// let handle = ui.as_weak();
// ui.global::<SystemPageData>().on_set_panel_od(move |od| {
// if let Some(handle) = handle.upgrade() {
// match proxy2.set_panel_od(od) {
// Ok(_) => handle
// .invoke_show_toast(format!("Panel Overdrive successfully set to {od}").into()),
// Err(e) => handle.invoke_show_toast(format!("Panel Overdrive failed: {e}").into()),
// }
// }
// });
// or
// let handle = ui.as_weak();
// ui.global::<SystemPageData>().on_applied(move || {
// handle
// .upgrade_in_event_loop(|handle| {
// let data = handle.global::<SystemPageData>();
// let charge_changed = data.get_charge_limit() as i32 !=
// data.get_last_charge_limit(); let charge =
// data.get_charge_limit() as u8; tokio::spawn(async move {
// let conn = zbus::Connection::system().await.unwrap();
// let proxy = PlatformProxy::new(&conn).await.unwrap();
// if charge_changed {
// proxy
// .set_charge_control_end_threshold(charge)
// .await
// .unwrap();
// }
// });
// })
// .ok();
// });