mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Document dbus a bit better
This commit is contained in:
@@ -5,6 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Changed
|
||||||
|
- Further refine the way setting LED modes works so it is more universal, this
|
||||||
|
also allows for setting the brightness through `SetKeyBacklight`
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- REDME_DBUS.md to document DBUS interface
|
||||||
|
|
||||||
## [0.13.1] - 2020-29-06
|
## [0.13.1] - 2020-29-06
|
||||||
### Fixed
|
### Fixed
|
||||||
- Properly initialise the device
|
- Properly initialise the device
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -225,17 +225,7 @@ little of. Most parts will be byte arrays, but you can adjust things like
|
|||||||
|
|
||||||
### DBUS Input
|
### DBUS Input
|
||||||
|
|
||||||
Paths:
|
See [README_DBUS.md](./README_DBUS.md).
|
||||||
|
|
||||||
```rust
|
|
||||||
pub static DBUS_NAME: &str = "org.rogcore.Daemon";
|
|
||||||
pub static DBUS_PATH: &str = "/org/rogcore/Daemon";
|
|
||||||
pub static DBUS_IFACE: &str = "org.rogcore.Daemon";
|
|
||||||
```
|
|
||||||
|
|
||||||
Commands: `FanMode`, `LedWriteBytes`, `LedWriteMultizone`, `LedWriteEffect`
|
|
||||||
|
|
||||||
TODO: fill in this info
|
|
||||||
|
|
||||||
### AniMe input
|
### AniMe input
|
||||||
|
|
||||||
|
|||||||
105
README_DBUS.md
Normal file
105
README_DBUS.md
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
# DBUS Guide
|
||||||
|
|
||||||
|
```rust
|
||||||
|
pub static DBUS_NAME: &str = "org.rogcore.Daemon";
|
||||||
|
pub static DBUS_PATH: &str = "/org/rogcore/Daemon";
|
||||||
|
pub static DBUS_IFACE: &str = "org.rogcore.Daemon";
|
||||||
|
```
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
- `SetKeyBacklight`
|
||||||
|
- `AnimatrixWrite`
|
||||||
|
- `SetFanMode`
|
||||||
|
- `GetFanMode`
|
||||||
|
- `SetChargeLimit`
|
||||||
|
- `GetChargeLimit`
|
||||||
|
- TODO: GetLEDModes
|
||||||
|
|
||||||
|
## Signals
|
||||||
|
|
||||||
|
- `KeyBacklightChanged`
|
||||||
|
- `FanModeChanged`
|
||||||
|
- `ChargeLimitChanged`
|
||||||
|
|
||||||
|
## Method Inputs
|
||||||
|
|
||||||
|
### SetKeyBacklight
|
||||||
|
|
||||||
|
This method expects a string of JSON as input. The JSON is of format such:
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"Stable": {
|
||||||
|
"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:
|
||||||
|
|
||||||
|
- `"Stable": { "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.
|
||||||
|
|
||||||
|
### AnimatrixWrite
|
||||||
|
|
||||||
|
Used to write data to the AniMe display if available. Currently is takes `[[u8; 640]; 2]`
|
||||||
|
which must be the byte data that will be written directly to the USB device.
|
||||||
|
|
||||||
|
### SetFanMode
|
||||||
|
|
||||||
|
Accepts an integer from the following:
|
||||||
|
|
||||||
|
- `0`: Normal
|
||||||
|
- `1`: Boost mode
|
||||||
|
- `2`: Silent mode
|
||||||
|
|
||||||
|
### GetFanMode
|
||||||
|
|
||||||
|
Returns the integer set from above.
|
||||||
|
|
||||||
|
### SetChargeLimit
|
||||||
|
|
||||||
|
Accepts an integer in the range of 20-100.
|
||||||
|
|
||||||
|
### GetChargeLimit
|
||||||
|
|
||||||
|
Returns the integer set from above.
|
||||||
|
|
||||||
|
## Signal Outs
|
||||||
|
|
||||||
|
### KeyBacklightChanged
|
||||||
|
|
||||||
|
When emitted, it will emit a true or false.
|
||||||
|
|
||||||
|
### FanModeChanged
|
||||||
|
|
||||||
|
When emitted, it will include the integer the fan mode was changed to.
|
||||||
|
|
||||||
|
### ChargeLimitChanged
|
||||||
|
|
||||||
|
When emitted, it will include the integer the charging limit was changed to.
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
{
|
|
||||||
"fan_mode": 1,
|
|
||||||
"bat_charge_limit": 100,
|
|
||||||
"brightness": 1,
|
|
||||||
"current_mode": 0,
|
|
||||||
"builtin_modes": [
|
|
||||||
{
|
|
||||||
"Stable": {
|
|
||||||
"help": false,
|
|
||||||
"colour": [
|
|
||||||
255,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Breathe": {
|
|
||||||
"help": false,
|
|
||||||
"colour": [
|
|
||||||
255,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"colour2": [
|
|
||||||
255,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"speed": "Med"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Strobe": {
|
|
||||||
"help": false,
|
|
||||||
"speed": "Med"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Rainbow": {
|
|
||||||
"help": false,
|
|
||||||
"direction": "Up",
|
|
||||||
"speed": "Low"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Star": {
|
|
||||||
"help": false,
|
|
||||||
"colour": [
|
|
||||||
255,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"colour2": [
|
|
||||||
255,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"speed": "Med"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Rain": {
|
|
||||||
"help": false,
|
|
||||||
"speed": "Med"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Highlight": {
|
|
||||||
"help": false,
|
|
||||||
"colour": [
|
|
||||||
255,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"speed": "Med"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Laser": {
|
|
||||||
"help": false,
|
|
||||||
"colour": [
|
|
||||||
255,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"speed": "Med"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Ripple": {
|
|
||||||
"help": false,
|
|
||||||
"colour": [
|
|
||||||
255,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"speed": "Med"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Pulse": {
|
|
||||||
"help": false,
|
|
||||||
"colour": [
|
|
||||||
255,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Comet": {
|
|
||||||
"help": false,
|
|
||||||
"colour": [
|
|
||||||
255,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Flash": {
|
|
||||||
"help": false,
|
|
||||||
"colour": [
|
|
||||||
255,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"mode_performance": {
|
|
||||||
"normal": {
|
|
||||||
"min_percentage": 0,
|
|
||||||
"max_percentage": 100,
|
|
||||||
"no_turbo": false
|
|
||||||
},
|
|
||||||
"boost": {
|
|
||||||
"min_percentage": 0,
|
|
||||||
"max_percentage": 100,
|
|
||||||
"no_turbo": false
|
|
||||||
},
|
|
||||||
"silent": {
|
|
||||||
"min_percentage": 0,
|
|
||||||
"max_percentage": 80,
|
|
||||||
"no_turbo": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -125,7 +125,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
if let Some(n) = lock.take() {
|
if let Some(n) = lock.take() {
|
||||||
let mut config = config1.lock().await;
|
let mut config = config1.lock().await;
|
||||||
rogcore
|
rogcore
|
||||||
.fan_mode_set(n, &mut config)
|
.set_fan_mode(n, &mut config)
|
||||||
.unwrap_or_else(|err| warn!("{:?}", err));
|
.unwrap_or_else(|err| warn!("{:?}", err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ impl RogCore {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fan_mode_set(&mut self, n: u8, config: &mut Config) -> Result<(), Box<dyn Error>> {
|
pub fn set_fan_mode(&mut self, n: u8, config: &mut Config) -> Result<(), Box<dyn Error>> {
|
||||||
let path = RogCore::get_fan_path()?;
|
let path = RogCore::get_fan_path()?;
|
||||||
let mut fan_ctrl = OpenOptions::new().read(true).write(true).open(path)?;
|
let mut fan_ctrl = OpenOptions::new().read(true).write(true).open(path)?;
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ impl RogCore {
|
|||||||
} else {
|
} else {
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
self.fan_mode_set(n, config)
|
self.set_fan_mode(n, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_pstate_for_fan_mode(
|
fn set_pstate_for_fan_mode(
|
||||||
|
|||||||
Reference in New Issue
Block a user