mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Bugfixes to session handler. Add extra profile commands
- Better handling of session tracking - List all profile data - Get active profile name - Get active profile data
This commit is contained in:
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
# [3.2.3] - 2021-03-24
|
||||||
|
### Changed
|
||||||
|
- Better handling of session tracking
|
||||||
|
### Added
|
||||||
|
- List all profile data
|
||||||
|
- Get active profile name
|
||||||
|
- Get active profile data
|
||||||
|
|
||||||
# [3.2.2] - 2021-03-23
|
# [3.2.2] - 2021-03-23
|
||||||
### Changed
|
### Changed
|
||||||
- Fix brightness control, again, for non-RGB keyboards
|
- Fix brightness control, again, for non-RGB keyboards
|
||||||
|
|||||||
9
Cargo.lock
generated
9
Cargo.lock
generated
@@ -28,12 +28,13 @@ dependencies = [
|
|||||||
"daemon",
|
"daemon",
|
||||||
"notify-rust",
|
"notify-rust",
|
||||||
"rog_dbus",
|
"rog_dbus",
|
||||||
|
"rog_types",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusctl"
|
name = "asusctl"
|
||||||
version = "3.1.4"
|
version = "3.1.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"daemon",
|
"daemon",
|
||||||
"gumdrop",
|
"gumdrop",
|
||||||
@@ -196,7 +197,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "daemon"
|
name = "daemon"
|
||||||
version = "3.2.2"
|
version = "3.2.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"intel-pstate",
|
"intel-pstate",
|
||||||
@@ -887,7 +888,7 @@ checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_dbus"
|
name = "rog_dbus"
|
||||||
version = "3.0.0"
|
version = "3.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rog_fan_curve",
|
"rog_fan_curve",
|
||||||
"rog_types",
|
"rog_types",
|
||||||
@@ -908,7 +909,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_types"
|
name = "rog_types"
|
||||||
version = "3.1.1"
|
version = "3.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gumdrop",
|
"gumdrop",
|
||||||
"rog_fan_curve",
|
"rog_fan_curve",
|
||||||
|
|||||||
129
README.md
129
README.md
@@ -5,29 +5,26 @@
|
|||||||
`asusd` is a utility for Linux to control many aspects of various ASUS laptops
|
`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.
|
but can also be used with non-asus laptops with reduced features.
|
||||||
|
|
||||||
**NOTICE:**
|
## Goals
|
||||||
|
|
||||||
This app is developed and tested on fedora only. Support is not provided for Arch or Arch based distros.
|
1. To provide an interface for rootless control of some system functions most users wish to control such as fan speeds, keyboard LEDs, graphics modes.
|
||||||
|
2. Enable third-party apps to use the above with dbus methods
|
||||||
|
3. To make the above as easy as possible for new users
|
||||||
|
|
||||||
|
Point 3 means that the list of supported distros is very narrow - fedora is explicitly
|
||||||
|
supported, while Ubuntu and openSUSE are level-2 support. All other distros are *not*
|
||||||
|
supported (while asusd might still run fine on them). For best support use fedora 32+ Workstation.
|
||||||
|
|
||||||
**NOTICE:**
|
**NOTICE:**
|
||||||
The following is *not* required for 5.11 kernel versions, as this version includes
|
1. The following is *not* required for 5.11 kernel versions, as this version includes all the required patches.
|
||||||
all the required patches.
|
2. 2021 hardware has a new keyboard prod_id and the patch is included in 5.12+
|
||||||
---
|
|
||||||
This program requires the kernel patch [here](https://www.spinics.net/lists/linux-input/msg68977.html) to be applied.
|
|
||||||
Alternatively you may use the dkms module for 'hid-asus-rog` from one of the
|
|
||||||
repositories [here](https://download.opensuse.org/repositories/home:/luke_nukem:/asus/).
|
|
||||||
|
|
||||||
The patch enables the following in kernel:
|
'hid-asus-rog` DKMS module from [here](https://download.opensuse.org/repositories/home:/luke_nukem:/asus/).
|
||||||
|
|
||||||
|
The module enables the following in kernel:
|
||||||
|
|
||||||
|
- Initialising the keyboard
|
||||||
- All hotkeys (FN+Key combos)
|
- All hotkeys (FN+Key combos)
|
||||||
- Control of keyboard brightness using FN+Key combos (not RGB)
|
|
||||||
- FN+F5 (fan) to toggle fan modes
|
|
||||||
|
|
||||||
You will not get RGB control in kernel (yet), and `asusd` + `asusctl` is required
|
|
||||||
to change modes and RGB settings.
|
|
||||||
|
|
||||||
Many other patches for these laptops, AMD and Intel based, are working their way
|
|
||||||
in to the kernel.
|
|
||||||
|
|
||||||
## Discord
|
## Discord
|
||||||
|
|
||||||
@@ -52,13 +49,14 @@ will probably suffer another rename once it becomes generic enough to do so.
|
|||||||
- [X] User notifications daemon
|
- [X] User notifications daemon
|
||||||
- [X] Setting/modifying built-in LED modes
|
- [X] Setting/modifying built-in LED modes
|
||||||
- [X] Per-key LED setting
|
- [X] Per-key LED setting
|
||||||
- [X] Fancy LED modes (See examples)
|
- [X] Fancy LED modes (See examples) (currently being reworked)
|
||||||
- [X] Saving settings for reload
|
- [X] Saving settings for reload
|
||||||
- [X] Logging - required for journalctl
|
- [X] Logging - required for journalctl
|
||||||
- [X] AniMatrix display on G14 models that include it
|
- [X] AniMatrix display on G14 models that include it (currently being reworked)
|
||||||
- [X] Set battery charge limit (with kernel supporting this)
|
- [X] Set battery charge limit (with kernel supporting this)
|
||||||
- [X] Fancy fan control on G14 + G15 thanks to @Yarn1
|
- [X] Fan curve control on G14 + G15 thanks to @Yarn1
|
||||||
- [X] Graphics mode switching between iGPU, dGPU, and On-Demand
|
- [X] Graphics mode switching between iGPU, dGPU, on-demand, and vfio (for VM pass-through)
|
||||||
|
+ [X] Requires only a logout/login
|
||||||
- [X] Toggle bios setting for boot/POST sound
|
- [X] Toggle bios setting for boot/POST sound
|
||||||
- [X] Toggle bios setting for "dedicated gfx" mode on supported laptops (g-sync)
|
- [X] Toggle bios setting for "dedicated gfx" mode on supported laptops (g-sync)
|
||||||
|
|
||||||
@@ -66,13 +64,15 @@ will probably suffer another rename once it becomes generic enough to do so.
|
|||||||
|
|
||||||
## Graphics switching
|
## Graphics switching
|
||||||
|
|
||||||
A new feature has been added to enable switching graphics modes. This can be disabled
|
`asusd` can switch graphics modes between:
|
||||||
in the config with `"manage_gfx": false,`. Additionally there is an extra setting
|
- `integrated`, uses the iGPU only and force-disables the dGPU
|
||||||
for laptops capable of g-sync dedicated gfx mode to enable the graphics switching
|
- `hybrid`, enables Nvidia prime-offload mode
|
||||||
to switch on dedicated gfx for "nvidia" mode.
|
- `nvidia`, uses the Nvidia gpu only
|
||||||
|
- `vfio`, binds the Nvidia gpu to vfio for VM pass-through
|
||||||
|
|
||||||
The CLI option for this does not require root until it asks for it, and provides
|
This can be disabled in the config with `"manage_gfx": false,`. Additionally there
|
||||||
instructions.
|
is an extra setting for laptops capable of g-sync dedicated gfx mode to enable the
|
||||||
|
graphics switching to switch on dedicated gfx for "nvidia" mode.
|
||||||
|
|
||||||
This switcher conflicts with other gpu switchers like optimus-manager, suse-prime
|
This switcher conflicts with other gpu switchers like optimus-manager, suse-prime
|
||||||
or ubuntu-prime, system76-power, and bbswitch. If you have issues with `asusd`
|
or ubuntu-prime, system76-power, and bbswitch. If you have issues with `asusd`
|
||||||
@@ -109,22 +109,18 @@ Models GA401, GA502, GU502 support LED brightness change only (no RGB).
|
|||||||
If you model isn't getting the correct led modes, you can edit the file
|
If you model isn't getting the correct led modes, you can edit the file
|
||||||
`/etc/asusd/asusd-ledmodes.toml`, the LED Mode numbers are as follows:
|
`/etc/asusd/asusd-ledmodes.toml`, the LED Mode numbers are as follows:
|
||||||
|
|
||||||
```
|
- Static
|
||||||
0 STATIC
|
- Breathe
|
||||||
1 BREATHING
|
- Strobe
|
||||||
2 STROBE
|
- Rainbow
|
||||||
3 RAINBOW
|
- Star
|
||||||
4 STAR
|
- Rain
|
||||||
5 RAIN
|
- Highlight
|
||||||
6 HIGHLIGHT
|
- Laser
|
||||||
7 LASER
|
- Ripple
|
||||||
8 RIPPLE
|
- Pulse
|
||||||
10 PULSE
|
- Comet
|
||||||
11 COMET
|
- Flash
|
||||||
12 FLASH
|
|
||||||
13 MULTISTATIC
|
|
||||||
255 PER_KEY
|
|
||||||
```
|
|
||||||
|
|
||||||
use `cat /sys/class/dmi/id/product_name` to get details about your laptop.
|
use `cat /sys/class/dmi/id/product_name` to get details about your laptop.
|
||||||
|
|
||||||
@@ -182,26 +178,8 @@ can be added on request). You will need to install the alternative service from
|
|||||||
|
|
||||||
Run `sudo make uninstall` in the source repo, and remove `/etc/asusd/`.
|
Run `sudo make uninstall` in the source repo, and remove `/etc/asusd/`.
|
||||||
|
|
||||||
## Updating
|
|
||||||
|
|
||||||
If there has been a config file format change your config will be overwritten. This will
|
|
||||||
become less of an issue once the feature set is nailed down. Work is happening to enable
|
|
||||||
parsing of older configs and transferring settings to new.
|
|
||||||
|
|
||||||
# USAGE
|
# USAGE
|
||||||
|
|
||||||
**NOTE! Fan mode toggling requires a newer kernel**. I'm unsure when the patches
|
|
||||||
required for it got merged - I've tested with the 5.6.6 kernel and above only.
|
|
||||||
To see if the fan-mode changed cat either:
|
|
||||||
|
|
||||||
- `cat /sys/devices/platform/asus-nb-wmi/throttle_thermal_policy` or
|
|
||||||
- `cat /sys/devices/platform/asus-nb-wmi/fan_boost_mode`
|
|
||||||
|
|
||||||
The numbers are 0 = Normal/Balanced, 1 = Boost, 2 = Silent.
|
|
||||||
|
|
||||||
Running the program as a daemon manually will require root. Standard (non-daemon)
|
|
||||||
mode expects to be communicating with the daemon mode over dbus.
|
|
||||||
|
|
||||||
Commands are given by:
|
Commands are given by:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -221,23 +199,6 @@ Some commands may have subcommands:
|
|||||||
asusctl <command> <subcommand> --help
|
asusctl <command> <subcommand> --help
|
||||||
```
|
```
|
||||||
|
|
||||||
## Daemon mode
|
|
||||||
|
|
||||||
If the daemon service is enabled then on boot the following will be reloaded from save:
|
|
||||||
|
|
||||||
- LED brightness
|
|
||||||
- Last used built-in mode
|
|
||||||
- fan-boost/thermal mode
|
|
||||||
- battery charging limit
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
Daemon mode creates a config file at `/etc/asusd/asusd.conf` which you can edit a
|
|
||||||
little of. Most parts will be byte arrays, but you can adjust things like
|
|
||||||
`mode_performance`.
|
|
||||||
|
|
||||||
## User NOTIFICATIONS via dbus
|
## User NOTIFICATIONS via dbus
|
||||||
|
|
||||||
If you have a notifications handler set up, or are using KDE or Gnome then you
|
If you have a notifications handler set up, or are using KDE or Gnome then you
|
||||||
@@ -249,10 +210,6 @@ systemctl --user start asus-notify.service
|
|||||||
```
|
```
|
||||||
# OTHER
|
# OTHER
|
||||||
|
|
||||||
## DBUS Input
|
|
||||||
|
|
||||||
See [README_DBUS.md](./README_DBUS.md).
|
|
||||||
|
|
||||||
## AniMe input
|
## AniMe input
|
||||||
|
|
||||||
You will want to look at what MeuMeu has done with [https://github.com/Meumeu/ZephyrusBling/](https://github.com/Meumeu/ZephyrusBling/)
|
You will want to look at what MeuMeu has done with [https://github.com/Meumeu/ZephyrusBling/](https://github.com/Meumeu/ZephyrusBling/)
|
||||||
@@ -278,11 +235,3 @@ omit_drivers+=" nvidia nvidia-drm nvidia-modeset nvidia-uvm "
|
|||||||
# License
|
# License
|
||||||
|
|
||||||
Mozilla Public License 2 (MPL-2.0)
|
Mozilla Public License 2 (MPL-2.0)
|
||||||
|
|
||||||
# Credits
|
|
||||||
|
|
||||||
- [flukejones](https://github.com/flukejones/), project maintainer.
|
|
||||||
- [tuxuser](https://github.com/tuxuser/)
|
|
||||||
- [aspann](https://github.com/aspann)
|
|
||||||
- [meumeu](https://github.com/Meumeu)
|
|
||||||
- Anyone missed? Please contact me
|
|
||||||
|
|||||||
115
README_DBUS.md
115
README_DBUS.md
@@ -1,115 +0,0 @@
|
|||||||
# DBUS Guide
|
|
||||||
|
|
||||||
**WARNING: In progress updates**
|
|
||||||
|
|
||||||
Interface name = org.asuslinux.Daemon
|
|
||||||
|
|
||||||
Paths:
|
|
||||||
- `/org/asuslinux/Gfx`
|
|
||||||
+ `SetVendor` (string)
|
|
||||||
+ `NotifyVendor` (recv vendor label string)
|
|
||||||
- `/org/asuslinux/Led`
|
|
||||||
+ `LedMode` (AuraMode as json)
|
|
||||||
+ `LedModes` (array[AuraMode] as json)
|
|
||||||
+ `SetLedMode` (AuraMode -> json)
|
|
||||||
+ `NotifyLed` (recv json data)
|
|
||||||
- `/org/asuslinux/Anime`
|
|
||||||
+ `SetAnime` (byte array data)
|
|
||||||
- `/org/asuslinux/Charge`
|
|
||||||
+ `Limit` (u8)
|
|
||||||
+ `SetLimit` (u8)
|
|
||||||
+ `NotifyCharge` (recv i8)
|
|
||||||
- `/org/asuslinux/Profile`
|
|
||||||
+ `Profile` (recv current profile data as json string)
|
|
||||||
+ `Profiles` (recv profiles data as json string (map))
|
|
||||||
+ `SetProfile` (event -> json)
|
|
||||||
+ `NotifyProfile` (recv current profile name)
|
|
||||||
|
|
||||||
All `Notify*` methods are signals.
|
|
||||||
|
|
||||||
### SetLed
|
|
||||||
|
|
||||||
This method expects a string of JSON as input. The JSON is of format such:
|
|
||||||
|
|
||||||
```
|
|
||||||
{
|
|
||||||
"Static": {
|
|
||||||
"colour": [ 255, 0, 0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The possible contents of a mode are:
|
|
||||||
|
|
||||||
- `"colour": [u8, u8, u8],`
|
|
||||||
- `"speed": <String>,` <Low, Med, High>
|
|
||||||
- `"direction": <String>,` <Up, Down, Left, Right>
|
|
||||||
|
|
||||||
Modes may or may not be available for a specific laptop (TODO: dbus getter for
|
|
||||||
supported modes). Modes are:
|
|
||||||
|
|
||||||
- `"Static": { "colour": <colour> },`
|
|
||||||
- `"Pulse": { "colour": <colour> },`
|
|
||||||
- `"Comet": { "colour": <colour> },`
|
|
||||||
- `"Flash": { "colour": <colour> },`
|
|
||||||
- `"Strobe": { "speed": <speed> },`
|
|
||||||
- `"Rain": { "speed": <speed> },`
|
|
||||||
- `"Laser": { "colour": <colour>, "speed": <speed> },`
|
|
||||||
- `"Ripple": { "colour": <colour>, "speed": <speed> },`
|
|
||||||
- `"Highlight": { "colour": <colour>, "speed": <speed> },`
|
|
||||||
- `"Rainbow": { "direction": <direction>, "speed": <speed> },`
|
|
||||||
- `"Breathe": { "colour": <colour>, "colour2": <colour>, "speed": <speed> },`
|
|
||||||
- `"Star": { "colour": <colour>, "colour2": <colour>, "speed": <speed> },`
|
|
||||||
- `"MultiStatic": { "colour1": <colour>, "colour2": <colour>, , "colour3": <colour>, "colour4": <colour> },`
|
|
||||||
|
|
||||||
Additionally to the above there is `"RGB": [[u8; 64]; 11]` which is for per-key
|
|
||||||
setting of LED's but this requires some refactoring to make it easily useable over
|
|
||||||
dbus.
|
|
||||||
|
|
||||||
Lastly, there is `"LedBrightness": <u8>` which accepts 0-3 for off, low, med, high.
|
|
||||||
|
|
||||||
### SetFanMode
|
|
||||||
|
|
||||||
Accepts an integer from the following:
|
|
||||||
|
|
||||||
- `0`: Normal
|
|
||||||
- `1`: Boost mode
|
|
||||||
- `2`: Silent mode
|
|
||||||
|
|
||||||
## dbus-send examples:
|
|
||||||
|
|
||||||
```
|
|
||||||
dbus-send --system --type=method_call --dest=org.asuslinux.Daemon /org/asuslinux/Profile org.asuslinux.Daemon.NextProfile
|
|
||||||
```
|
|
||||||
|
|
||||||
## dbus-send examples OUTDATED
|
|
||||||
|
|
||||||
```
|
|
||||||
dbus-send --system --type=method_call --dest=org.asuslinux.Daemon /org/asuslinux/Daemon org.asuslinux.Daemon.SetKeyBacklight string:'{"Static": {"colour": [ 80, 0, 40]}}'
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
dbus-send --system --type=method_call --dest=org.asuslinux.Daemon /org/asuslinux/Daemon org.asuslinux.Daemon.SetKeyBacklight string:'{"Star":{"colour":[0,255,255],"colour2":[0,0,0],"speed":"Med"}}'
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note:** setting colour2 to `[0,0,255]` activates random star colour. Colour2 has no effect on the
|
|
||||||
mode otherwise.
|
|
||||||
```
|
|
||||||
dbus-send --system --type=method_call --dest=org.asuslinux.Daemon /org/asuslinux/Daemon org.asuslinux.Daemon.SetKeyBacklight string:'{"Star":{"colour":[0,255,255],"colour2":[0,0,255],"speed":"Med"}}'
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
dbus-send --system --type=method_call --dest=org.asuslinux.Daemon /org/asuslinux/Daemon org.asuslinux.Daemon.SetKeyBacklight string:'{"LedBrightness":3}'
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
dbus-send --system --type=method_call --dest=org.asuslinux.Daemon /org/asuslinux/Daemon org.asuslinux.Daemon.SetFanMode byte:'2'
|
|
||||||
```
|
|
||||||
|
|
||||||
Monitoring dbus while sending commands via `rog-core` will give you the json structure if you are otherwise unsure, e.g: `dbus-monitor --system |grep -A2 asuslinux`.
|
|
||||||
|
|
||||||
## Getting an introspection .xml
|
|
||||||
|
|
||||||
```
|
|
||||||
dbus-send --system --print-reply --dest=org.asuslinux.Daemon /org/asuslinux/Charge org.freedesktop.DBus.Introspectable.Introspect > xml/asusd-charge.xml
|
|
||||||
```
|
|
||||||
7
TODO.md
7
TODO.md
@@ -1,7 +0,0 @@
|
|||||||
# TODO
|
|
||||||
|
|
||||||
- There is lots of code duplication. This should be turned in to macros (dbus stuff etc)
|
|
||||||
- Add a little more information to profile notifications such as freq min/max, fan curves
|
|
||||||
- Finish splitting out controllers to own crates
|
|
||||||
- Finish move to zbus in client when zbus has client signal watch
|
|
||||||
- Consider a rename again because the project is getting a lot less ASUS centric
|
|
||||||
@@ -10,6 +10,7 @@ edition = "2018"
|
|||||||
# serialisation
|
# serialisation
|
||||||
serde_json = "^1.0"
|
serde_json = "^1.0"
|
||||||
rog_dbus = { path = "../rog-dbus" }
|
rog_dbus = { path = "../rog-dbus" }
|
||||||
|
rog_types = { path = "../rog-types" }
|
||||||
daemon = { path = "../daemon" }
|
daemon = { path = "../daemon" }
|
||||||
|
|
||||||
[dependencies.notify-rust]
|
[dependencies.notify-rust]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use daemon::config::Profile;
|
|
||||||
use notify_rust::{Hint, Notification, NotificationHandle};
|
use notify_rust::{Hint, Notification, NotificationHandle};
|
||||||
use rog_dbus::{DbusProxies, Signals};
|
use rog_dbus::{DbusProxies, Signals};
|
||||||
|
use rog_types::profile::Profile;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "asusctl"
|
name = "asusctl"
|
||||||
version = "3.1.4"
|
version = "3.1.5"
|
||||||
authors = ["Luke D Jones <luke@ljones.dev>"]
|
authors = ["Luke D Jones <luke@ljones.dev>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
@@ -389,6 +389,9 @@ fn handle_profile(
|
|||||||
if !cmd.next
|
if !cmd.next
|
||||||
&& !cmd.create
|
&& !cmd.create
|
||||||
&& !cmd.list
|
&& !cmd.list
|
||||||
|
&& !cmd.active_name
|
||||||
|
&& !cmd.active_data
|
||||||
|
&& !cmd.profiles_data
|
||||||
&& cmd.remove.is_none()
|
&& cmd.remove.is_none()
|
||||||
&& cmd.curve.is_none()
|
&& cmd.curve.is_none()
|
||||||
&& cmd.max_percentage.is_none()
|
&& cmd.max_percentage.is_none()
|
||||||
@@ -419,12 +422,31 @@ fn handle_profile(
|
|||||||
|
|
||||||
if cmd.next {
|
if cmd.next {
|
||||||
dbus.proxies().profile().next_fan()?;
|
dbus.proxies().profile().next_fan()?;
|
||||||
} else if cmd.list {
|
}
|
||||||
let profile_names = dbus.proxies().profile().profile_names()?;
|
if let Some(profile) = &cmd.remove {
|
||||||
println!("Available profiles are {}", profile_names);
|
|
||||||
} else if let Some(profile) = &cmd.remove {
|
|
||||||
dbus.proxies().profile().remove(profile)?
|
dbus.proxies().profile().remove(profile)?
|
||||||
} else {
|
}
|
||||||
|
if cmd.list {
|
||||||
|
let profile_names = dbus.proxies().profile().profile_names()?;
|
||||||
|
println!("Available profiles are {:?}", profile_names);
|
||||||
|
}
|
||||||
|
if cmd.active_name {
|
||||||
|
println!("Active profile: {:?}", dbus.proxies().profile().active_profile_name()?);
|
||||||
|
}
|
||||||
|
if cmd.active_data {
|
||||||
|
println!("Active profile:");
|
||||||
|
for s in dbus.proxies().profile().active_profile_data()?.lines() {
|
||||||
|
println!("{}", s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if cmd.profiles_data {
|
||||||
|
println!("Profiles:");
|
||||||
|
for s in dbus.proxies().profile().all_profile_data()?.lines() {
|
||||||
|
println!("{}", s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if cmd.profile.is_some() {
|
||||||
dbus.proxies()
|
dbus.proxies()
|
||||||
.profile()
|
.profile()
|
||||||
.write_command(&ProfileEvent::Cli(cmd.clone()))?
|
.write_command(&ProfileEvent::Cli(cmd.clone()))?
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "daemon"
|
name = "daemon"
|
||||||
version = "3.2.2"
|
version = "3.2.3"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use log::{error, info, warn};
|
use log::{error, info, warn};
|
||||||
use rog_fan_curve::Curve;
|
use rog_types::{gfx_vendors::GfxVendors, profile::Profile};
|
||||||
use rog_types::gfx_vendors::GfxVendors;
|
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::fs::{File, OpenOptions};
|
use std::fs::{File, OpenOptions};
|
||||||
@@ -136,45 +135,3 @@ impl Config {
|
|||||||
.unwrap_or_else(|err| error!("Could not write config: {}", err));
|
.unwrap_or_else(|err| error!("Could not write config: {}", err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
|
||||||
pub struct Profile {
|
|
||||||
pub min_percentage: u8,
|
|
||||||
pub max_percentage: u8,
|
|
||||||
pub turbo: bool,
|
|
||||||
pub fan_preset: u8,
|
|
||||||
pub fan_curve: Option<Curve>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[deprecated]
|
|
||||||
pub type CPUSettings = Profile;
|
|
||||||
|
|
||||||
impl Default for Profile {
|
|
||||||
fn default() -> Self {
|
|
||||||
Profile {
|
|
||||||
min_percentage: 0,
|
|
||||||
max_percentage: 100,
|
|
||||||
turbo: false,
|
|
||||||
fan_preset: 0,
|
|
||||||
fan_curve: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Profile {
|
|
||||||
pub fn new(
|
|
||||||
min_percentage: u8,
|
|
||||||
max_percentage: u8,
|
|
||||||
turbo: bool,
|
|
||||||
fan_preset: u8,
|
|
||||||
fan_curve: Option<Curve>,
|
|
||||||
) -> Self {
|
|
||||||
Profile {
|
|
||||||
min_percentage,
|
|
||||||
max_percentage,
|
|
||||||
turbo,
|
|
||||||
fan_preset,
|
|
||||||
fan_curve,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
use rog_types::{aura_modes::AuraEffect, gfx_vendors::GfxVendors};
|
use rog_types::{aura_modes::AuraEffect, gfx_vendors::GfxVendors, profile::Profile};
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use crate::config::{Config, Profile};
|
use crate::config::{Config};
|
||||||
|
|
||||||
/// for parsing old v2.1.2 config
|
/// for parsing old v2.1.2 config
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use crate::error::RogError;
|
use crate::error::RogError;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{Config, Profile},
|
config::{Config},
|
||||||
GetSupported,
|
GetSupported,
|
||||||
};
|
};
|
||||||
use log::{info, warn};
|
use log::{info, warn};
|
||||||
use rog_types::profile::{FanLevel, ProfileEvent};
|
use rog_types::profile::{FanLevel, ProfileEvent, Profile};
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
@@ -90,60 +90,59 @@ impl DbusFanAndCpu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Fetch the active profile name
|
/// Fetch the active profile name
|
||||||
fn active_profile_name(&mut self) -> String {
|
fn active_profile_name(&mut self) -> zbus::fdo::Result<String> {
|
||||||
if let Ok(ctrl) = self.inner.try_lock() {
|
if let Ok(ctrl) = self.inner.try_lock() {
|
||||||
if let Ok(mut cfg) = ctrl.config.try_lock() {
|
if let Ok(mut cfg) = ctrl.config.try_lock() {
|
||||||
cfg.read();
|
cfg.read();
|
||||||
return cfg.active_profile.clone();
|
return Ok(cfg.active_profile.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"Failed".to_string()
|
Err(Error::Failed("Failed to get active profile name".to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Profile can't implement Type because of Curve
|
||||||
/// Fetch the active profile details
|
/// Fetch the active profile details
|
||||||
fn profile(&mut self) -> String {
|
fn profile(&mut self) -> zbus::fdo::Result<String> {
|
||||||
if let Ok(ctrl) = self.inner.try_lock() {
|
if let Ok(ctrl) = self.inner.try_lock() {
|
||||||
if let Ok(mut cfg) = ctrl.config.try_lock() {
|
if let Ok(mut cfg) = ctrl.config.try_lock() {
|
||||||
cfg.read();
|
cfg.read();
|
||||||
if let Some(profile) = cfg.power_profiles.get(&cfg.active_profile) {
|
if let Some(profile) = cfg.power_profiles.get(&cfg.active_profile) {
|
||||||
if let Ok(json) = serde_json::to_string(profile) {
|
if let Ok(json) = serde_json::to_string_pretty(profile) {
|
||||||
return json;
|
return Ok(json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"Failed".to_string()
|
Err(Error::Failed("Failed to get active profile details".to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn profiles(&mut self) -> String {
|
/// Fetch all profile data
|
||||||
|
fn profiles(&mut self) -> zbus::fdo::Result<String> {
|
||||||
if let Ok(ctrl) = self.inner.try_lock() {
|
if let Ok(ctrl) = self.inner.try_lock() {
|
||||||
if let Ok(mut cfg) = ctrl.config.try_lock() {
|
if let Ok(mut cfg) = ctrl.config.try_lock() {
|
||||||
cfg.read();
|
cfg.read();
|
||||||
if let Ok(json) = serde_json::to_string(&cfg.power_profiles) {
|
if let Ok(json) = serde_json::to_string_pretty(&cfg.power_profiles) {
|
||||||
return json;
|
return Ok(json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"Failed".to_string()
|
Err(Error::Failed("Failed to get all profile details".to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn profile_names(&self) -> String {
|
fn profile_names(&self) -> zbus::fdo::Result<Vec<String>> {
|
||||||
if let Ok(ctrl) = self.inner.try_lock() {
|
if let Ok(ctrl) = self.inner.try_lock() {
|
||||||
if let Ok(mut cfg) = ctrl.config.try_lock() {
|
if let Ok(mut cfg) = ctrl.config.try_lock() {
|
||||||
cfg.read();
|
cfg.read();
|
||||||
|
let profile_names = cfg
|
||||||
let profile_names: String = cfg
|
|
||||||
.power_profiles
|
.power_profiles
|
||||||
.keys()
|
.keys()
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>();
|
||||||
.join(", ");
|
return Ok(profile_names);
|
||||||
|
|
||||||
return profile_names;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"Failed".to_string()
|
Err(Error::Failed("Failed to get all profile names".to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn remove(&self, profile: &str) -> zbus::fdo::Result<()> {
|
fn remove(&self, profile: &str) -> zbus::fdo::Result<()> {
|
||||||
@@ -172,7 +171,7 @@ impl DbusFanAndCpu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Err(Error::Failed("Failed to lock configuration".to_string()));
|
Err(Error::Failed("Failed to lock configuration".to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_interface(signal)]
|
#[dbus_interface(signal)]
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ pub enum GfxError {
|
|||||||
DisplayManagerAction(String, ExitStatus),
|
DisplayManagerAction(String, ExitStatus),
|
||||||
DisplayManagerTimeout(String),
|
DisplayManagerTimeout(String),
|
||||||
GsyncModeActive,
|
GsyncModeActive,
|
||||||
|
VfioBuiltin,
|
||||||
|
MissingModule(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for GfxError {
|
impl fmt::Display for GfxError {
|
||||||
@@ -28,6 +30,14 @@ impl fmt::Display for GfxError {
|
|||||||
f,
|
f,
|
||||||
"Can not switch gfx modes when dedicated/G-Sync mode is active"
|
"Can not switch gfx modes when dedicated/G-Sync mode is active"
|
||||||
),
|
),
|
||||||
|
GfxError::VfioBuiltin => write!(
|
||||||
|
f,
|
||||||
|
"Can not switch to vfio mode if the modules are built in to kernel"
|
||||||
|
),
|
||||||
|
GfxError::MissingModule(m) => write!(
|
||||||
|
f,
|
||||||
|
"The module {} is missing", m
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,7 @@ use ctrl_gfx::error::GfxError;
|
|||||||
use ctrl_gfx::*;
|
use ctrl_gfx::*;
|
||||||
use ctrl_rog_bios::CtrlRogBios;
|
use ctrl_rog_bios::CtrlRogBios;
|
||||||
use log::{error, info, warn};
|
use log::{error, info, warn};
|
||||||
use logind_zbus::{
|
use logind_zbus::{ManagerProxy, SessionProxy, types::{SessionClass, SessionInfo, SessionState, SessionType}};
|
||||||
types::{SessionClass, SessionInfo, SessionType},
|
|
||||||
ManagerProxy, SessionProxy,
|
|
||||||
};
|
|
||||||
use rog_types::gfx_vendors::{GfxRequiredUserAction, GfxVendors};
|
use rog_types::gfx_vendors::{GfxRequiredUserAction, GfxVendors};
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
use std::{io::Write, ops::Add, path::Path, time::Instant};
|
use std::{io::Write, ops::Add, path::Path, time::Instant};
|
||||||
@@ -326,6 +323,12 @@ impl CtrlGraphics {
|
|||||||
{
|
{
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
if output
|
||||||
|
.stderr
|
||||||
|
.ends_with("is builtin.\n".as_bytes())
|
||||||
|
{
|
||||||
|
return Err(GfxError::VfioBuiltin.into());
|
||||||
|
}
|
||||||
if output.stderr.ends_with("Permission denied\n".as_bytes()) {
|
if output.stderr.ends_with("Permission denied\n".as_bytes()) {
|
||||||
warn!(
|
warn!(
|
||||||
"{} {} failed: {:?}",
|
"{} {} failed: {:?}",
|
||||||
@@ -336,6 +339,9 @@ impl CtrlGraphics {
|
|||||||
warn!("GFX: It may be safe to ignore the above error, run `lsmod |grep {}` to confirm modules loaded", driver);
|
warn!("GFX: It may be safe to ignore the above error, run `lsmod |grep {}` to confirm modules loaded", driver);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
if String::from_utf8_lossy(&output.stderr).contains(&format!("Module {} not found", driver)) {
|
||||||
|
return Err(GfxError::MissingModule(driver.into()).into());
|
||||||
|
}
|
||||||
if count >= MAX_TRIES {
|
if count >= MAX_TRIES {
|
||||||
let msg = format!(
|
let msg = format!(
|
||||||
"{} {} failed: {:?}",
|
"{} {} failed: {:?}",
|
||||||
@@ -350,7 +356,7 @@ impl CtrlGraphics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
count += 1;
|
count += 1;
|
||||||
std::thread::sleep(std::time::Duration::from_millis(250));
|
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,7 +461,6 @@ impl CtrlGraphics {
|
|||||||
Self::unbind_remove_nvidia(&devices)?;
|
Self::unbind_remove_nvidia(&devices)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,9 +473,10 @@ impl CtrlGraphics {
|
|||||||
if session_proxy.get_class()? == SessionClass::User {
|
if session_proxy.get_class()? == SessionClass::User {
|
||||||
match session_proxy.get_type()? {
|
match session_proxy.get_type()? {
|
||||||
SessionType::X11 | SessionType::Wayland | SessionType::MIR => {
|
SessionType::X11 | SessionType::Wayland | SessionType::MIR => {
|
||||||
//if session_proxy.get_active()? {
|
match session_proxy.get_state()? {
|
||||||
return Ok(true);
|
SessionState::Online | SessionState::Active => return Ok(true),
|
||||||
//}
|
SessionState::Closing | SessionState::Invalid => {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
@@ -499,8 +505,7 @@ impl CtrlGraphics {
|
|||||||
loop {
|
loop {
|
||||||
let tmp = manager.list_sessions()?;
|
let tmp = manager.list_sessions()?;
|
||||||
if !tmp.iter().eq(&sessions) {
|
if !tmp.iter().eq(&sessions) {
|
||||||
warn!("GFX: Sessions list changed");
|
info!("GFX thread: Sessions list changed");
|
||||||
warn!("GFX: Old list:\n{:?}\nNew list:\n{:?}", &sessions, &tmp);
|
|
||||||
sessions = tmp;
|
sessions = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,30 +528,15 @@ impl CtrlGraphics {
|
|||||||
sleep(SLEEP_PERIOD);
|
sleep(SLEEP_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("GFX: all graphical user sessions ended, continuing");
|
info!("GFX thread: all graphical user sessions ended, continuing");
|
||||||
Self::do_display_manager_action("stop")?;
|
Self::do_display_manager_action("stop")?;
|
||||||
|
Self::wait_display_manager_state("inactive")?;
|
||||||
match Self::wait_display_manager_state("inactive") {
|
|
||||||
Ok(_) => info!("GFX: display-manager stopped"),
|
|
||||||
Err(err) => {
|
|
||||||
warn!("GFX: {}", err);
|
|
||||||
warn!("GFX: Retry stop display manager");
|
|
||||||
Self::do_display_manager_action("stop")?;
|
|
||||||
Self::wait_display_manager_state("inactive")?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Self::do_vendor_tasks(vendor, &devices, &bus)?;
|
Self::do_vendor_tasks(vendor, &devices, &bus)?;
|
||||||
Self::do_display_manager_action("start")?;
|
Self::do_display_manager_action("restart")?;
|
||||||
|
|
||||||
if Self::wait_display_manager_state("active").is_err() {
|
|
||||||
error!("GFX: display-manager failed to start normally, attempting restart");
|
|
||||||
Self::do_display_manager_action("restart")?;
|
|
||||||
Self::wait_display_manager_state("active")?;
|
|
||||||
}
|
|
||||||
// Save selected mode in case of reboot
|
// Save selected mode in case of reboot
|
||||||
Self::save_gfx_mode(vendor, config);
|
Self::save_gfx_mode(vendor, config);
|
||||||
info!("GFX: display-manager started");
|
info!("GFX thread: display-manager started");
|
||||||
|
|
||||||
let v: &str = vendor.into();
|
let v: &str = vendor.into();
|
||||||
info!("GFX: Graphics mode changed to {} successfully", v);
|
info!("GFX: Graphics mode changed to {} successfully", v);
|
||||||
@@ -560,7 +550,7 @@ impl CtrlGraphics {
|
|||||||
info!("GFX: Cancelling previous thread");
|
info!("GFX: Cancelling previous thread");
|
||||||
tx.send(true)
|
tx.send(true)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
warn!("GFX: {}", err);
|
warn!("GFX thread: {}", err);
|
||||||
})
|
})
|
||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rog_dbus"
|
name = "rog_dbus"
|
||||||
version = "3.0.0"
|
version = "3.1.0"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ trait Daemon {
|
|||||||
fn profiles(&self) -> zbus::Result<String>;
|
fn profiles(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
/// ProfileNames method
|
/// ProfileNames method
|
||||||
fn profile_names(&self) -> zbus::Result<String>;
|
fn profile_names(&self) -> zbus::Result<Vec<String>>;
|
||||||
|
|
||||||
/// Remove method
|
/// Remove method
|
||||||
fn remove(&self, profile: &str) -> zbus::Result<()>;
|
fn remove(&self, profile: &str) -> zbus::Result<()>;
|
||||||
@@ -72,6 +72,16 @@ impl<'a> ProfileProxy<'a> {
|
|||||||
self.0.active_profile_name()
|
self.0.active_profile_name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn active_profile_data(&self) -> Result<String> {
|
||||||
|
self.0.profile()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn all_profile_data(&self) -> Result<String> {
|
||||||
|
self.0.profiles()
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn next_fan(&self) -> Result<()> {
|
pub fn next_fan(&self) -> Result<()> {
|
||||||
self.0.next_profile()
|
self.0.next_profile()
|
||||||
@@ -89,7 +99,7 @@ impl<'a> ProfileProxy<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn profile_names(&self) -> Result<String> {
|
pub fn profile_names(&self) -> Result<Vec<String>> {
|
||||||
self.0.profile_names()
|
self.0.profile_names()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rog_types"
|
name = "rog_types"
|
||||||
version = "3.1.1"
|
version = "3.2.0"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
|||||||
@@ -3,6 +3,49 @@ use rog_fan_curve::{Curve, Fan};
|
|||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
pub struct Profile {
|
||||||
|
pub min_percentage: u8,
|
||||||
|
pub max_percentage: u8,
|
||||||
|
pub turbo: bool,
|
||||||
|
pub fan_preset: u8,
|
||||||
|
pub fan_curve: Option<Curve>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[deprecated]
|
||||||
|
pub type CPUSettings = Profile;
|
||||||
|
|
||||||
|
impl Default for Profile {
|
||||||
|
fn default() -> Self {
|
||||||
|
Profile {
|
||||||
|
min_percentage: 0,
|
||||||
|
max_percentage: 100,
|
||||||
|
turbo: false,
|
||||||
|
fan_preset: 0,
|
||||||
|
fan_curve: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Profile {
|
||||||
|
pub fn new(
|
||||||
|
min_percentage: u8,
|
||||||
|
max_percentage: u8,
|
||||||
|
turbo: bool,
|
||||||
|
fan_preset: u8,
|
||||||
|
fan_curve: Option<Curve>,
|
||||||
|
) -> Self {
|
||||||
|
Profile {
|
||||||
|
min_percentage,
|
||||||
|
max_percentage,
|
||||||
|
turbo,
|
||||||
|
fan_preset,
|
||||||
|
fan_curve,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub enum ProfileEvent {
|
pub enum ProfileEvent {
|
||||||
Cli(ProfileCommand),
|
Cli(ProfileCommand),
|
||||||
@@ -80,8 +123,16 @@ pub struct ProfileCommand {
|
|||||||
pub next: bool,
|
pub next: bool,
|
||||||
#[options(help = "create the profile if it doesn't exist")]
|
#[options(help = "create the profile if it doesn't exist")]
|
||||||
pub create: bool,
|
pub create: bool,
|
||||||
|
#[options(meta = "", help = "remove a profile by name")]
|
||||||
|
pub remove: Option<String>,
|
||||||
#[options(help = "list available profiles")]
|
#[options(help = "list available profiles")]
|
||||||
pub list: bool,
|
pub list: bool,
|
||||||
|
#[options(help = "get active profile name")]
|
||||||
|
pub active_name: bool,
|
||||||
|
#[options(help = "get active profile data")]
|
||||||
|
pub active_data: bool,
|
||||||
|
#[options(help = "get all profile data")]
|
||||||
|
pub profiles_data: bool,
|
||||||
|
|
||||||
#[options(meta = "", help = "enable or disable cpu turbo")]
|
#[options(meta = "", help = "enable or disable cpu turbo")]
|
||||||
pub turbo: Option<bool>,
|
pub turbo: Option<bool>,
|
||||||
@@ -100,6 +151,4 @@ pub struct ProfileCommand {
|
|||||||
pub curve: Option<Curve>,
|
pub curve: Option<Curve>,
|
||||||
#[options(free)]
|
#[options(free)]
|
||||||
pub profile: Option<String>,
|
pub profile: Option<String>,
|
||||||
#[options(help = "remove a profile by name")]
|
|
||||||
pub remove: Option<String>,
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user