mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Play around and add rog-slash
This commit is contained in:
14
Cargo.lock
generated
14
Cargo.lock
generated
@@ -3907,7 +3907,7 @@ dependencies = [
|
|||||||
"i-slint-compiler",
|
"i-slint-compiler",
|
||||||
"spin_on",
|
"spin_on",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"toml_edit 0.22.8",
|
"toml_edit 0.22.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3932,9 +3932,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.13.1"
|
version = "1.13.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
|
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smithay-client-toolkit"
|
name = "smithay-client-toolkit"
|
||||||
@@ -4112,7 +4112,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "supergfxctl"
|
name = "supergfxctl"
|
||||||
version = "5.2.2"
|
version = "5.2.2"
|
||||||
source = "git+https://gitlab.com/asus-linux/supergfxctl.git#f3465681ac147821bbd2d50aff2bced2d92d529e"
|
source = "git+https://gitlab.com/asus-linux/supergfxctl.git#68c12374d2cc20e5503b7694168afa2bf52af705"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"logind-zbus",
|
"logind-zbus",
|
||||||
@@ -4377,7 +4377,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
"toml_edit 0.22.8",
|
"toml_edit 0.22.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4413,9 +4413,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
version = "0.22.8"
|
version = "0.22.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c12219811e0c1ba077867254e5ad62ee2c9c190b0d957110750ac0cda1ae96cd"
|
checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ tokio = { version = "^1.23.0", default-features = false, features = [
|
|||||||
"sync",
|
"sync",
|
||||||
"time",
|
"time",
|
||||||
"rt",
|
"rt",
|
||||||
|
"rt-multi-thread"
|
||||||
] }
|
] }
|
||||||
concat-idents = "^1.1"
|
concat-idents = "^1.1"
|
||||||
dirs = "^4.0"
|
dirs = "^4.0"
|
||||||
|
|||||||
9
Makefile
9
Makefile
@@ -124,10 +124,11 @@ bindings:
|
|||||||
typeshare ./rog-platform/src/ --lang=typescript --output-file=bindings/ts/platform.ts
|
typeshare ./rog-platform/src/ --lang=typescript --output-file=bindings/ts/platform.ts
|
||||||
|
|
||||||
introspect:
|
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/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/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/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
|
gdbus introspect --system -d org.asuslinux.Daemon -o /org/asuslinux -x > bindings/dbus-xml/org-asuslinux-platform-4.xml
|
||||||
|
gdbus introspect --system -d org.asuslinux.Daemon -o /org/asuslinux/19b6_4_4 -x > bindings/dbus-xml/org-asuslinux-19b6-4-4-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.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.Properties"]' bindings/dbus-xml/org-asuslinux-*
|
||||||
xmlstarlet ed -L -O -d '//interface[@name="org.freedesktop.DBus.Peer"]' bindings/dbus-xml/org-asuslinux-*
|
xmlstarlet ed -L -O -d '//interface[@name="org.freedesktop.DBus.Peer"]' bindings/dbus-xml/org-asuslinux-*
|
||||||
|
|||||||
38
asusctl/examples/slash-steady.rs
Normal file
38
asusctl/examples/slash-steady.rs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
use std::thread::sleep;
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use rog_anime::usb::get_anime_type;
|
||||||
|
use rog_anime::{AnimeDiagonal, AnimeType};
|
||||||
|
use rog_dbus::RogDbusClientBlocking;
|
||||||
|
|
||||||
|
// In usable data:
|
||||||
|
// Top row start at 1, ends at 32
|
||||||
|
|
||||||
|
// 74w x 36h diagonal used by the windows app
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||||
|
|
||||||
|
for step in (2..50).rev() {
|
||||||
|
let mut matrix = AnimeDiagonal::new(AnimeType::GA401, None);
|
||||||
|
for c in (0..60).step_by(step) {
|
||||||
|
for i in matrix.get_mut().iter_mut() {
|
||||||
|
i[c] = 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for c in (0..35).step_by(step) {
|
||||||
|
for i in &mut matrix.get_mut()[c] {
|
||||||
|
*i = 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let anime_type = get_anime_type().unwrap();
|
||||||
|
client
|
||||||
|
.proxies()
|
||||||
|
.anime()
|
||||||
|
.write(matrix.into_data_buffer(anime_type).unwrap())
|
||||||
|
.unwrap();
|
||||||
|
sleep(Duration::from_millis(300));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,7 +50,7 @@ pub static DBUS_IFACE: &str = "org.asuslinux.Daemon";
|
|||||||
/// task_watch_item!(panel_od platform);
|
/// task_watch_item!(panel_od platform);
|
||||||
/// task_watch_item!(gpu_mux_mode platform);
|
/// task_watch_item!(gpu_mux_mode platform);
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```\
|
||||||
/// // TODO: this is kind of useless if it can't trigger some action
|
/// // TODO: this is kind of useless if it can't trigger some action
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! task_watch_item {
|
macro_rules! task_watch_item {
|
||||||
|
|||||||
105
bindings/dbus-xml/org-asuslinux-19b6-4-4-4.xml
Normal file
105
bindings/dbus-xml/org-asuslinux-19b6-4-4-4.xml
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
|
||||||
|
<!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.Aura">
|
||||||
|
<!--
|
||||||
|
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.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>
|
||||||
|
<interface name="org.freedesktop.DBus.Peer">
|
||||||
|
<method name="Ping">
|
||||||
|
</method>
|
||||||
|
<method name="GetMachineId">
|
||||||
|
<arg type="s" direction="out"/>
|
||||||
|
</method>
|
||||||
|
</interface>
|
||||||
|
</node>
|
||||||
@@ -2,7 +2,100 @@
|
|||||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||||
<node>
|
<node>
|
||||||
<interface name="org.asuslinux.Daemon">
|
<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>
|
||||||
|
<interface name="org.asuslinux.FanCurves">
|
||||||
|
<!--
|
||||||
|
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 curves to the defaults of the
|
||||||
|
platform.
|
||||||
|
|
||||||
|
Each platform_profile has a different default and the default can be
|
||||||
|
read only for the currently active profile.
|
||||||
|
-->
|
||||||
|
<method name="SetCurvesToDefaults">
|
||||||
|
<arg name="profile" type="u" 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="ResetProfileCurves">
|
||||||
|
<arg name="profile" type="u" direction="in"/>
|
||||||
|
</method>
|
||||||
|
</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.Platform">
|
||||||
|
<method name="Version">
|
||||||
|
<arg type="s" direction="out"/>
|
||||||
|
</method>
|
||||||
<!--
|
<!--
|
||||||
Returns a list of property names that this system supports
|
Returns a list of property names that this system supports
|
||||||
-->
|
-->
|
||||||
@@ -18,6 +111,11 @@
|
|||||||
-->
|
-->
|
||||||
<method name="NextThrottleThermalPolicy">
|
<method name="NextThrottleThermalPolicy">
|
||||||
</method>
|
</method>
|
||||||
|
<!--
|
||||||
|
Get the `boot_sound` value from platform. Updates the stored value in
|
||||||
|
internal config also.
|
||||||
|
-->
|
||||||
|
<property name="BootSound" type="b" access="readwrite"/>
|
||||||
<property name="ChargeControlEndThreshold" type="y" access="readwrite"/>
|
<property name="ChargeControlEndThreshold" type="y" access="readwrite"/>
|
||||||
<property name="DgpuDisable" type="b" access="read"/>
|
<property name="DgpuDisable" type="b" access="read"/>
|
||||||
<property name="EgpuEnable" type="b" access="read"/>
|
<property name="EgpuEnable" type="b" access="read"/>
|
||||||
@@ -42,10 +140,6 @@
|
|||||||
internal config also.
|
internal config also.
|
||||||
-->
|
-->
|
||||||
<property name="PanelOd" type="b" access="readwrite"/>
|
<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:
|
Set the APU SPPT limit. Shown on full AMD systems only:
|
||||||
* min=5, max=130
|
* min=5, max=130
|
||||||
@@ -94,40 +188,160 @@
|
|||||||
<property name="ThrottleQuietEpp" type="u" access="readwrite"/>
|
<property name="ThrottleQuietEpp" type="u" access="readwrite"/>
|
||||||
<property name="ThrottleThermalPolicy" type="u" access="readwrite"/>
|
<property name="ThrottleThermalPolicy" type="u" access="readwrite"/>
|
||||||
</interface>
|
</interface>
|
||||||
<interface name="org.freedesktop.DBus.Properties">
|
<interface name="org.asuslinux.Anime">
|
||||||
<method name="Get">
|
<!--
|
||||||
<arg name="interface_name" type="s" direction="in"/>
|
Writes a data stream of length. Will force system thread to exit until
|
||||||
<arg name="property_name" type="s" direction="in"/>
|
it is restarted
|
||||||
<arg type="v" direction="out"/>
|
-->
|
||||||
</method>
|
<method name="Write">
|
||||||
<method name="Set">
|
<arg name="input" type="(ays)" direction="in"/>
|
||||||
<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>
|
</method>
|
||||||
<!--
|
<!--
|
||||||
Emits the `org.freedesktop.DBus.Properties.PropertiesChanged` signal.
|
The main loop is the base system set action if the user isn't running
|
||||||
|
the user daemon
|
||||||
-->
|
-->
|
||||||
<signal name="PropertiesChanged">
|
<method name="RunMainLoop">
|
||||||
<arg name="interface_name" type="s"/>
|
<arg name="start" type="b" direction="in"/>
|
||||||
<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>
|
</method>
|
||||||
</interface>
|
<!--
|
||||||
<interface name="org.freedesktop.DBus.Peer">
|
Get the device state as stored by asusd
|
||||||
<method name="Ping">
|
-->
|
||||||
</method>
|
<method name="DeviceState">
|
||||||
<method name="GetMachineId">
|
<arg type="(bub(ssss)bbbu)" direction="out"/>
|
||||||
<arg type="s" direction="out"/>
|
|
||||||
</method>
|
</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>
|
||||||
|
<node name="19b6_4_4">
|
||||||
|
<interface name="org.asuslinux.Aura">
|
||||||
|
<!--
|
||||||
|
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.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>
|
||||||
|
<interface name="org.freedesktop.DBus.Peer">
|
||||||
|
<method name="Ping">
|
||||||
|
</method>
|
||||||
|
<method name="GetMachineId">
|
||||||
|
<arg type="s" direction="out"/>
|
||||||
|
</method>
|
||||||
|
</interface>
|
||||||
|
</node>
|
||||||
</node>
|
</node>
|
||||||
|
|||||||
@@ -727,4 +727,12 @@
|
|||||||
advanced_type: None,
|
advanced_type: None,
|
||||||
power_zones: [Keyboard],
|
power_zones: [Keyboard],
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
board_name: "GA403UI",
|
||||||
|
layout_name: "ga401q",
|
||||||
|
basic_modes: [Static, Breathe, Pulse],
|
||||||
|
basic_zones: [],
|
||||||
|
advanced_type: None,
|
||||||
|
power_zones: [Keyboard],
|
||||||
|
),
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -486,7 +486,7 @@ impl Default for AuraEffect {
|
|||||||
Self {
|
Self {
|
||||||
mode: AuraModeNum::Static,
|
mode: AuraModeNum::Static,
|
||||||
zone: AuraZone::None,
|
zone: AuraZone::None,
|
||||||
colour1: Colour { r: 166, g: 0, b: 0 },
|
colour1: Colour { r: 166, g: 166, b: 166 },
|
||||||
colour2: Colour { r: 0, g: 0, b: 0 },
|
colour2: Colour { r: 0, g: 0, b: 0 },
|
||||||
speed: Speed::Med,
|
speed: Speed::Med,
|
||||||
direction: Direction::Right,
|
direction: Direction::Right,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const BLOCKING_TIME: u64 = 33; // 100ms = 10 FPS, max 50ms = 20 FPS, 40ms = 25 F
|
|||||||
#[proxy(
|
#[proxy(
|
||||||
interface = "org.asuslinux.Aura",
|
interface = "org.asuslinux.Aura",
|
||||||
default_service = "org.asuslinux.Daemon",
|
default_service = "org.asuslinux.Daemon",
|
||||||
default_path = "/org/asuslinux/Aura"
|
default_path = "/org/asuslinux/19b6_4_4"
|
||||||
)]
|
)]
|
||||||
trait Aura {
|
trait Aura {
|
||||||
/// AllModeData method
|
/// AllModeData method
|
||||||
|
|||||||
29
rog-slash/Cargo.toml
Normal file
29
rog-slash/Cargo.toml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
[package]
|
||||||
|
name = "rog_slash"
|
||||||
|
license = "MPL-2.0"
|
||||||
|
version.workspace = true
|
||||||
|
readme = "README.md"
|
||||||
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
repository = "https://gitlab.com/asus-linux/asus-nb-ctrl"
|
||||||
|
homepage = "https://gitlab.com/asus-linux/asus-nb-ctrl"
|
||||||
|
documentation = "https://docs.rs/rog-anime"
|
||||||
|
description = "ASUS Slash display"
|
||||||
|
keywords = ["ROG", "ASUS", "AniMe", "Slash"]
|
||||||
|
edition = "2024"
|
||||||
|
exclude = ["data"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
log.workspace = true
|
||||||
|
serde.workspace = true
|
||||||
|
serde_derive.workspace = true
|
||||||
|
zbus.workspace = true
|
||||||
|
concat-idents.workspace = true
|
||||||
|
udev.workspace = true
|
||||||
|
inotify.workspace = true
|
||||||
|
typeshare.workspace = true
|
||||||
|
|
||||||
|
rusb.workspace = true
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
cargo-husky.workspace = true
|
||||||
|
rog_aura = { path = "../rog-aura" }
|
||||||
3
rog-slash/src/lib.rs
Normal file
3
rog-slash/src/lib.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
/// Provides const methods to create the USB HID control packets
|
||||||
|
pub mod usb;
|
||||||
345
rog-slash/src/usb.rs
Normal file
345
rog-slash/src/usb.rs
Normal file
@@ -0,0 +1,345 @@
|
|||||||
|
//! Utils for writing to the `AniMe` USB device
|
||||||
|
//!
|
||||||
|
//! Use of the device requires a few steps:
|
||||||
|
//! 1. Initialise the device by writing the two packets from
|
||||||
|
//! `get_init_packets()` 2. Write data from `AnimePacketType`
|
||||||
|
//! 3. Write the packet from `get_flush_packet()`, which tells the device to
|
||||||
|
//! display the data from step 2
|
||||||
|
//!
|
||||||
|
//! Step 1 need to applied only on fresh system boot.
|
||||||
|
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use dmi_id::DMIID;
|
||||||
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
use typeshare::typeshare;
|
||||||
|
#[cfg(feature = "dbus")]
|
||||||
|
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||||
|
|
||||||
|
use crate::error::AnimeError;
|
||||||
|
use crate::AnimeType;
|
||||||
|
|
||||||
|
const PACKET_SIZE: usize = 640;
|
||||||
|
const DEV_PAGE: u8 = 0x5e;
|
||||||
|
pub const VENDOR_ID: u16 = 0x0b05;
|
||||||
|
pub const PROD_ID: u16 = 0x193b;
|
||||||
|
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "dbus",
|
||||||
|
derive(Type, Value, OwnedValue),
|
||||||
|
zvariant(signature = "u")
|
||||||
|
)]
|
||||||
|
#[typeshare]
|
||||||
|
#[derive(Debug, Default, PartialEq, Eq, Copy, Clone, Deserialize, Serialize)]
|
||||||
|
/// Base LED brightness of the display
|
||||||
|
pub enum Brightness {
|
||||||
|
Off = 0,
|
||||||
|
Low = 1,
|
||||||
|
#[default]
|
||||||
|
Med = 2,
|
||||||
|
High = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for Brightness {
|
||||||
|
type Err = AnimeError;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
Ok(match s {
|
||||||
|
"Off" | "off" => Brightness::Off,
|
||||||
|
"Low" | "low" => Brightness::Low,
|
||||||
|
"Med" | "med" => Brightness::Med,
|
||||||
|
"High" | "high" => Brightness::High,
|
||||||
|
_ => Brightness::Med,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<u8> for Brightness {
|
||||||
|
fn from(v: u8) -> Brightness {
|
||||||
|
match v {
|
||||||
|
0 => Brightness::Off,
|
||||||
|
1 => Brightness::Low,
|
||||||
|
3 => Brightness::High,
|
||||||
|
_ => Brightness::Med,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<i32> for Brightness {
|
||||||
|
fn from(v: i32) -> Brightness {
|
||||||
|
(v as u8).into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<Brightness> for i32 {
|
||||||
|
fn from(v: Brightness) -> i32 {
|
||||||
|
v as i32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "dbus",
|
||||||
|
derive(Type, Value, OwnedValue),
|
||||||
|
zvariant(signature = "s")
|
||||||
|
)]
|
||||||
|
#[typeshare]
|
||||||
|
#[derive(Debug, Default, PartialEq, Eq, Copy, Clone, Deserialize, Serialize)]
|
||||||
|
pub enum AnimBooting {
|
||||||
|
#[default]
|
||||||
|
GlitchConstruction = 0,
|
||||||
|
StaticEmergence = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for AnimBooting {
|
||||||
|
type Err = AnimeError;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
match s {
|
||||||
|
"GlitchConstruction" => Ok(Self::GlitchConstruction),
|
||||||
|
"StaticEmergence" => Ok(Self::StaticEmergence),
|
||||||
|
_ => Err(AnimeError::ParseError(s.to_owned())),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<i32> for AnimBooting {
|
||||||
|
fn from(value: i32) -> Self {
|
||||||
|
match value {
|
||||||
|
0 => Self::GlitchConstruction,
|
||||||
|
1 => Self::StaticEmergence,
|
||||||
|
_ => Self::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<AnimBooting> for i32 {
|
||||||
|
fn from(value: AnimBooting) -> Self {
|
||||||
|
value as i32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "dbus",
|
||||||
|
derive(Type, Value, OwnedValue),
|
||||||
|
zvariant(signature = "s")
|
||||||
|
)]
|
||||||
|
#[typeshare]
|
||||||
|
#[derive(Debug, Default, PartialEq, Eq, Copy, Clone, Deserialize, Serialize)]
|
||||||
|
pub enum AnimAwake {
|
||||||
|
#[default]
|
||||||
|
BinaryBannerScroll = 0,
|
||||||
|
RogLogoGlitch = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for AnimAwake {
|
||||||
|
type Err = AnimeError;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
match s {
|
||||||
|
"BinaryBannerScroll" => Ok(Self::BinaryBannerScroll),
|
||||||
|
"RogLogoGlitch" => Ok(Self::RogLogoGlitch),
|
||||||
|
_ => Err(AnimeError::ParseError(s.to_owned())),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<i32> for AnimAwake {
|
||||||
|
fn from(value: i32) -> Self {
|
||||||
|
match value {
|
||||||
|
0 => Self::BinaryBannerScroll,
|
||||||
|
1 => Self::RogLogoGlitch,
|
||||||
|
_ => Self::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<AnimAwake> for i32 {
|
||||||
|
fn from(value: AnimAwake) -> Self {
|
||||||
|
value as i32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "dbus",
|
||||||
|
derive(Type, Value, OwnedValue),
|
||||||
|
zvariant(signature = "s")
|
||||||
|
)]
|
||||||
|
#[typeshare]
|
||||||
|
#[derive(Debug, Default, PartialEq, Eq, Copy, Clone, Deserialize, Serialize)]
|
||||||
|
pub enum AnimSleeping {
|
||||||
|
#[default]
|
||||||
|
BannerSwipe = 0,
|
||||||
|
Starfield = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for AnimSleeping {
|
||||||
|
type Err = AnimeError;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
match s {
|
||||||
|
"BannerSwipe" => Ok(Self::BannerSwipe),
|
||||||
|
"Starfield" => Ok(Self::Starfield),
|
||||||
|
_ => Err(AnimeError::ParseError(s.to_owned())),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<i32> for AnimSleeping {
|
||||||
|
fn from(value: i32) -> Self {
|
||||||
|
match value {
|
||||||
|
0 => Self::BannerSwipe,
|
||||||
|
1 => Self::Starfield,
|
||||||
|
_ => Self::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<AnimSleeping> for i32 {
|
||||||
|
fn from(value: AnimSleeping) -> Self {
|
||||||
|
value as i32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "dbus",
|
||||||
|
derive(Type, Value, OwnedValue),
|
||||||
|
zvariant(signature = "s")
|
||||||
|
)]
|
||||||
|
#[typeshare]
|
||||||
|
#[derive(Debug, Default, PartialEq, Eq, Copy, Clone, Deserialize, Serialize)]
|
||||||
|
pub enum AnimShutdown {
|
||||||
|
#[default]
|
||||||
|
GlitchOut = 0,
|
||||||
|
SeeYa = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for AnimShutdown {
|
||||||
|
type Err = AnimeError;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
match s {
|
||||||
|
"GlitchOut" => Ok(Self::GlitchOut),
|
||||||
|
"SeeYa" => Ok(Self::SeeYa),
|
||||||
|
_ => Err(AnimeError::ParseError(s.to_owned())),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<i32> for AnimShutdown {
|
||||||
|
fn from(value: i32) -> Self {
|
||||||
|
match value {
|
||||||
|
0 => Self::GlitchOut,
|
||||||
|
1 => Self::SeeYa,
|
||||||
|
_ => Self::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<AnimShutdown> for i32 {
|
||||||
|
fn from(value: AnimShutdown) -> Self {
|
||||||
|
value as i32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `get_anime_type` is very broad, matching on part of the laptop board name
|
||||||
|
/// only. For this reason `find_node()` must be used also to verify if the USB
|
||||||
|
/// device is available.
|
||||||
|
///
|
||||||
|
/// The currently known USB device is `19b6`.
|
||||||
|
#[inline]
|
||||||
|
pub fn get_anime_type() -> Result<AnimeType, AnimeError> {
|
||||||
|
let dmi = DMIID::new().map_err(|_| AnimeError::NoDevice)?; // TODO: better error
|
||||||
|
let board_name = dmi.board_name;
|
||||||
|
|
||||||
|
if board_name.contains("GA401I") || board_name.contains("GA401Q") {
|
||||||
|
return Ok(AnimeType::GA401);
|
||||||
|
} else if board_name.contains("GA402R") {
|
||||||
|
return Ok(AnimeType::GA402);
|
||||||
|
} else if board_name.contains("GU604V") {
|
||||||
|
return Ok(AnimeType::GU604);
|
||||||
|
}
|
||||||
|
log::warn!("AniMe Matrix device found but not yet supported, will default to a GA402 layout");
|
||||||
|
Ok(AnimeType::Unknown)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the two device initialization packets. These are required for device
|
||||||
|
/// start after the laptop boots.
|
||||||
|
#[inline]
|
||||||
|
pub const fn pkts_for_init() -> [[u8; PACKET_SIZE]; 2] {
|
||||||
|
let mut packets = [[0; PACKET_SIZE]; 2];
|
||||||
|
packets[0][0] = DEV_PAGE; // This is the USB page we're using throughout
|
||||||
|
let mut count = 0;
|
||||||
|
// TODO: memcpy or slice copy
|
||||||
|
let bytes = "ASUS Tech.Inc.".as_bytes();
|
||||||
|
while count < bytes.len() {
|
||||||
|
packets[0][count + 1] = bytes[count];
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
packets[1][0] = DEV_PAGE;
|
||||||
|
packets[1][1] = 0xc2;
|
||||||
|
packets
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Should be written to the device after writing the two main data packets that
|
||||||
|
/// make up the display data packet
|
||||||
|
#[inline]
|
||||||
|
pub const fn pkt_flush() -> [u8; PACKET_SIZE] {
|
||||||
|
let mut pkt = [0; PACKET_SIZE];
|
||||||
|
pkt[0] = DEV_PAGE;
|
||||||
|
pkt[1] = 0xc0;
|
||||||
|
pkt[2] = 0x03;
|
||||||
|
pkt
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Packet for setting the brightness (0-3). Requires
|
||||||
|
/// `pkt_for_apply()` to be written after.
|
||||||
|
#[inline]
|
||||||
|
pub const fn pkt_set_brightness(brightness: Brightness) -> [u8; PACKET_SIZE] {
|
||||||
|
let mut pkt = [0; PACKET_SIZE];
|
||||||
|
pkt[0] = DEV_PAGE;
|
||||||
|
pkt[1] = 0xc0;
|
||||||
|
pkt[2] = 0x04;
|
||||||
|
pkt[3] = brightness as u8;
|
||||||
|
pkt
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Enable the display?
|
||||||
|
#[inline]
|
||||||
|
pub const fn pkt_set_enable_display(status: bool) -> [u8; PACKET_SIZE] {
|
||||||
|
let mut pkt = [0; PACKET_SIZE];
|
||||||
|
pkt[0] = DEV_PAGE;
|
||||||
|
pkt[1] = 0xc3;
|
||||||
|
pkt[2] = 0x01;
|
||||||
|
pkt[3] = if status { 0x00 } else { 0x80 };
|
||||||
|
pkt
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Enable builtin animations?
|
||||||
|
#[inline]
|
||||||
|
pub const fn pkt_set_enable_powersave_anim(status: bool) -> [u8; PACKET_SIZE] {
|
||||||
|
let mut pkt = [0; PACKET_SIZE];
|
||||||
|
pkt[0] = DEV_PAGE;
|
||||||
|
pkt[1] = 0xc4;
|
||||||
|
pkt[2] = 0x01;
|
||||||
|
pkt[3] = if status { 0x00 } else { 0x80 };
|
||||||
|
pkt
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set which animations are shown for each stage
|
||||||
|
#[inline]
|
||||||
|
pub const fn pkt_set_builtin_animations(
|
||||||
|
boot: AnimBooting,
|
||||||
|
awake: AnimAwake,
|
||||||
|
sleep: AnimSleeping,
|
||||||
|
shutdown: AnimShutdown,
|
||||||
|
) -> [u8; PACKET_SIZE] {
|
||||||
|
let mut pkt = [0; PACKET_SIZE];
|
||||||
|
pkt[0] = DEV_PAGE;
|
||||||
|
pkt[1] = 0xc5;
|
||||||
|
pkt[2] = (awake as u8)
|
||||||
|
| ((sleep as u8) << 0x01)
|
||||||
|
| ((shutdown as u8) << 0x02)
|
||||||
|
| ((boot as u8) << 0x03);
|
||||||
|
pkt
|
||||||
|
}
|
||||||
1
squashfs-root/.DirIcon
Normal file
1
squashfs-root/.DirIcon
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32"><defs><linearGradient id="a" x1="2.18" y1="23.255" x2="30.041" y2="8.782" gradientUnits="userSpaceOnUse"><stop offset=".043" stop-color="#ff8618"/><stop offset=".382" stop-color="#ff246e"/><stop offset=".989" stop-color="#af1df5"/></linearGradient></defs><title>ToolBox_trayIcon_colour_32-01</title><path d="M26,22.4713l-6.83,3.8311V23.2578L26,19.4268v3.0445Z" fill="#fff"/><path fill="#000001" d="M16 32.076L30 24.065 30 8.057 16 16.067 16 32.076"/><path fill="#fff" d="M18.925 24.641L18.925 27.041 25.026 23.55 25.026 21.15 18.925 24.641"/><path fill="url(#a)" d="M16 0.076L2 8.057 2 8.057 2 8.057 2 24.065 16 32.076 16 16.067 30 8.057 16 0.076"/></svg>
|
||||||
|
After Width: | Height: | Size: 758 B |
Reference in New Issue
Block a user