mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
gex: trial of dbus mthods
This commit is contained in:
15
Makefile
15
Makefile
@@ -122,12 +122,15 @@ 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:
|
||||||
dbus-send --system --type=method_call --print-reply --dest=org.asuslinux.Daemon /org/asuslinux/Aura org.freedesktop.DBus.Introspectable.Introspect > 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
|
||||||
dbus-send --system --type=method_call --print-reply --dest=org.asuslinux.Daemon /org/asuslinux/Anime org.freedesktop.DBus.Introspectable.Introspect > 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
|
||||||
dbus-send --system --type=method_call --print-reply --dest=org.asuslinux.Daemon /org/asuslinux/Platform org.freedesktop.DBus.Introspectable.Introspect > 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
|
||||||
dbus-send --system --type=method_call --print-reply --dest=org.asuslinux.Daemon /org/asuslinux/Power org.freedesktop.DBus.Introspectable.Introspect > bindings/dbus-xml/org-asuslinux-power-4.xml
|
gdbus introspect --system -d org.asuslinux.Daemon -o /org/asuslinux/Power -x > bindings/dbus-xml/org-asuslinux-power-4.xml
|
||||||
dbus-send --system --type=method_call --print-reply --dest=org.asuslinux.Daemon /org/asuslinux/Profile org.freedesktop.DBus.Introspectable.Introspect > bindings/dbus-xml/org-asuslinux-profile-4.xml
|
gdbus introspect --system -d org.asuslinux.Daemon -o /org/asuslinux/Profile -x > bindings/dbus-xml/org-asuslinux-profile-4.xml
|
||||||
dbus-send --system --type=method_call --print-reply --dest=org.asuslinux.Daemon /org/asuslinux/Supported org.freedesktop.DBus.Introspectable.Introspect > bindings/dbus-xml/org-asuslinux-supported-4.xml
|
gdbus introspect --system -d org.asuslinux.Daemon -o /org/asuslinux/Supported -x > bindings/dbus-xml/org-asuslinux-supported-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-*
|
||||||
|
|
||||||
build:
|
build:
|
||||||
ifeq ($(VENDORED),1)
|
ifeq ($(VENDORED),1)
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ pub struct SupportedFunctions(rog_platform::supported::SupportedFunctions);
|
|||||||
|
|
||||||
#[dbus_interface(name = "org.asuslinux.Daemon")]
|
#[dbus_interface(name = "org.asuslinux.Daemon")]
|
||||||
impl SupportedFunctions {
|
impl SupportedFunctions {
|
||||||
pub fn supported_functions(&self) -> &rog_platform::supported::SupportedFunctions {
|
pub fn supported_functions(
|
||||||
&self.0
|
&self,
|
||||||
|
) -> zbus::fdo::Result<&rog_platform::supported::SupportedFunctions> {
|
||||||
|
Ok(&self.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_interface(out_args("answer", "question"))]
|
#[dbus_interface(out_args("answer", "question"))]
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
method return time=1687861003.317863 sender=:1.463 -> destination=:1.470 serial=9 reply_serial=2
|
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||||
string "
|
|
||||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
|
||||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
|
||||||
<node>
|
<node>
|
||||||
<interface name="org.freedesktop.DBus.Introspectable">
|
|
||||||
<method name="Introspect">
|
|
||||||
<arg type="s" direction="out"/>
|
|
||||||
</method>
|
|
||||||
</interface>
|
|
||||||
<interface name="org.asuslinux.Daemon">
|
<interface name="org.asuslinux.Daemon">
|
||||||
<!--
|
<!--
|
||||||
Writes a data stream of length. Will force system thread to exit until
|
Writes a data stream of length. Will force system thread to exit until
|
||||||
@@ -70,36 +62,4 @@ method return time=1687861003.317863 sender=:1.463 -> destination=:1.470 serial=
|
|||||||
<arg name="data" type="(bsb(ssss))"/>
|
<arg name="data" type="(bsb(ssss))"/>
|
||||||
</signal>
|
</signal>
|
||||||
</interface>
|
</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>
|
||||||
"
|
|
||||||
|
|||||||
@@ -1,32 +1,5 @@
|
|||||||
method return time=1687861003.313639 sender=:1.463 -> destination=:1.469 serial=8 reply_serial=2
|
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||||
string "
|
|
||||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
|
||||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
|
||||||
<node>
|
<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.asuslinux.Daemon">
|
<interface name="org.asuslinux.Daemon">
|
||||||
<!--
|
<!--
|
||||||
Set the keyboard brightness level (0-3)
|
Set the keyboard brightness level (0-3)
|
||||||
@@ -130,17 +103,4 @@ method return time=1687861003.313639 sender=:1.463 -> destination=:1.469 serial=
|
|||||||
-->
|
-->
|
||||||
<property name="LedBrightness" type="n" access="read"/>
|
<property name="LedBrightness" type="n" access="read"/>
|
||||||
</interface>
|
</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>
|
</node>
|
||||||
"
|
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
method return time=1687861003.321770 sender=:1.463 -> destination=:1.471 serial=10 reply_serial=2
|
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||||
string "
|
|
||||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
|
||||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
|
||||||
<node>
|
<node>
|
||||||
<interface name="org.asuslinux.Daemon">
|
<interface name="org.asuslinux.Daemon">
|
||||||
<method name="SetGpuMuxMode">
|
<method name="SetGpuMuxMode">
|
||||||
@@ -67,41 +64,4 @@ method return time=1687861003.321770 sender=:1.463 -> destination=:1.471 serial=
|
|||||||
<arg name="enable" type="b"/>
|
<arg name="enable" type="b"/>
|
||||||
</signal>
|
</signal>
|
||||||
</interface>
|
</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.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>
|
|
||||||
</node>
|
</node>
|
||||||
"
|
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
method return time=1687861003.325159 sender=:1.463 -> destination=:1.472 serial=11 reply_serial=2
|
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||||
string "
|
|
||||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
|
||||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
|
||||||
<node>
|
<node>
|
||||||
<interface name="org.freedesktop.DBus.Introspectable">
|
|
||||||
<method name="Introspect">
|
|
||||||
<arg type="s" direction="out"/>
|
|
||||||
</method>
|
|
||||||
</interface>
|
|
||||||
<interface name="org.asuslinux.Daemon">
|
<interface name="org.asuslinux.Daemon">
|
||||||
<method name="SetChargeControlEndThreshold">
|
<method name="SetChargeControlEndThreshold">
|
||||||
<arg name="limit" type="y" direction="in"/>
|
<arg name="limit" type="y" direction="in"/>
|
||||||
@@ -25,36 +17,4 @@ method return time=1687861003.325159 sender=:1.463 -> destination=:1.472 serial=
|
|||||||
<arg name="on" type="b"/>
|
<arg name="on" type="b"/>
|
||||||
</signal>
|
</signal>
|
||||||
</interface>
|
</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.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>
|
</node>
|
||||||
"
|
|
||||||
|
|||||||
@@ -1,32 +1,5 @@
|
|||||||
method return time=1687861003.328608 sender=:1.463 -> destination=:1.473 serial=12 reply_serial=2
|
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||||
string "
|
|
||||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
|
||||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
|
||||||
<node>
|
<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.asuslinux.Daemon">
|
<interface name="org.asuslinux.Daemon">
|
||||||
<!--
|
<!--
|
||||||
Fetch profile names
|
Fetch profile names
|
||||||
@@ -104,17 +77,4 @@ method return time=1687861003.328608 sender=:1.463 -> destination=:1.473 serial=
|
|||||||
<arg name="profile" type="s"/>
|
<arg name="profile" type="s"/>
|
||||||
</signal>
|
</signal>
|
||||||
</interface>
|
</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>
|
</node>
|
||||||
"
|
|
||||||
|
|||||||
@@ -1,52 +1,12 @@
|
|||||||
method return time=1687945851.162246 sender=:1.3354 -> destination=:1.3359 serial=8 reply_serial=2
|
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||||
string "
|
|
||||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
|
||||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
|
||||||
<node>
|
<node>
|
||||||
<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">
|
<interface name="org.asuslinux.Daemon">
|
||||||
<method name="SupportedFunctions">
|
<method name="SupportedFunctions">
|
||||||
<arg type="(b(b)(bb)(sbasass)(bbbbbb))" direction="out"/>
|
<arg type="b(b)(bb)(sbasass)(bbbbbb)" direction="out"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="MeaningOfLife">
|
<method name="MeaningOfLife">
|
||||||
<arg name="answer" type="i" direction="out"/>
|
<arg name="answer" type="i" direction="out"/>
|
||||||
<arg name="question" type="s" direction="out"/>
|
<arg name="question" type="s" direction="out"/>
|
||||||
</method>
|
</method>
|
||||||
</interface>
|
</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>
|
|
||||||
</node>
|
</node>
|
||||||
"
|
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
rm -rf _build
|
rm -rf _build
|
||||||
mkdir -p _build/modules
|
mkdir -p _build/modules
|
||||||
mkdir -p _build/bindings
|
mkdir -p _build/bindings
|
||||||
|
mkdir -p _build/resources
|
||||||
cp -r target/modules/*js _build/modules/
|
cp -r target/modules/*js _build/modules/
|
||||||
cp -r target/bindings/*.js _build/bindings/
|
cp -r target/bindings/*.js _build/bindings/
|
||||||
cp -r metadata.json schemas target/*.js _build
|
cp -r metadata.json schemas target/*.js _build
|
||||||
|
cp -r ../../bindings/dbus-xml _build/resources/dbus
|
||||||
# cp -r icons resources *.css _build
|
# cp -r icons resources *.css _build
|
||||||
# cp src/prefs.ui _build/
|
# cp src/prefs.ui _build/
|
||||||
|
|
||||||
|
|||||||
@@ -9,17 +9,20 @@ find target/ -type f -print0 | while IFS= read -r -d $'\0' file; do \
|
|||||||
|
|
||||||
sed -i -E 's|export class (\w+)|var \1 = class \1|g' $file; \
|
sed -i -E 's|export class (\w+)|var \1 = class \1|g' $file; \
|
||||||
|
|
||||||
|
sed -i -E "s|import \* as (\w+) from '.\/(\w+)\/(\w+)'|const \1 = Me.imports.\2.\3|g" $file; \
|
||||||
sed -i -E "s|import \* as (\w+) from '..\/(\w+)\/(\w+)'|const \1 = Me.imports.\2.\3|g" $file; \
|
sed -i -E "s|import \* as (\w+) from '..\/(\w+)\/(\w+)'|const \1 = Me.imports.\2.\3|g" $file; \
|
||||||
# root
|
# root
|
||||||
sed -i -E "s|import \* as (\w+) from '..\/(\w+)'|const \1 = Me.imports.\2|g" $file; \
|
|
||||||
# nested by one dir
|
|
||||||
sed -i -E "s|import \* as (\w+) from '.\/(\w+)\/(\w+)'|const \1 = Me.imports.\2.\3|g" $file; \
|
|
||||||
# root
|
|
||||||
sed -i -E "s|import \* as (\w+) from '.\/(\w+)'|const \1 = Me.imports.\2|g" $file; \
|
sed -i -E "s|import \* as (\w+) from '.\/(\w+)'|const \1 = Me.imports.\2|g" $file; \
|
||||||
|
sed -i -E "s|import \* as (\w+) from '..\/(\w+)'|const \1 = Me.imports.\2|g" $file; \
|
||||||
|
|
||||||
sed -i -E "s|from '.\/modules\/(\w+)'|= Me.imports.modules.\1|g" $file; \
|
sed -i -E "s|from '.\/modules\/(\w+)'|= Me.imports.modules.\1|g" $file; \
|
||||||
|
sed -i -E "s|from '..\/modules\/(\w+)'|= Me.imports.modules.\1|g" $file; \
|
||||||
|
|
||||||
|
sed -i -E "s|from '.\/bindings\/(\w+)'|= Me.imports.bindings.\1|g" $file; \
|
||||||
|
sed -i -E "s|from '..\/bindings\/(\w+)'|= Me.imports.bindings.\1|g" $file; \
|
||||||
|
|
||||||
sed -i -E "s|from '.\/(\w+)'|= Me.imports.\1|g" $file; \
|
sed -i -E "s|from '.\/(\w+)'|= Me.imports.\1|g" $file; \
|
||||||
|
sed -i -E "s|from '..\/(\w+)'|= Me.imports.\1|g" $file; \
|
||||||
|
|
||||||
sed -i -E "s|import \{|var \{|g" $file; \
|
sed -i -E "s|import \{|var \{|g" $file; \
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ const ThisModule = imports.misc.extensionUtils.getCurrentExtension();
|
|||||||
// const TestProxy = Gio.DBusProxy.makeProxyWrapper(interfaceXml);
|
// const TestProxy = Gio.DBusProxy.makeProxyWrapper(interfaceXml);
|
||||||
|
|
||||||
import * as Platform from './bindings/platform';
|
import * as Platform from './bindings/platform';
|
||||||
|
import { ChargingLimit } from './modules/charge_dbus';
|
||||||
|
import { Supported } from './modules/supported_dbus';
|
||||||
|
|
||||||
const QuickMiniLed = GObject.registerClass(
|
const QuickMiniLed = GObject.registerClass(
|
||||||
class QuickMiniLed extends QuickSettings.QuickToggle {
|
class QuickMiniLed extends QuickSettings.QuickToggle {
|
||||||
@@ -133,6 +135,9 @@ class Extension {
|
|||||||
private _naff: Platform.GpuMode;
|
private _naff: Platform.GpuMode;
|
||||||
private _indicateMiniLed: typeof IndicateMiniLed;
|
private _indicateMiniLed: typeof IndicateMiniLed;
|
||||||
private _indicatePanelOd: typeof IndicatePanelOd;
|
private _indicatePanelOd: typeof IndicatePanelOd;
|
||||||
|
private _dbus_charge!: ChargingLimit;
|
||||||
|
private _dbus_supported!: Supported;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this._indicateMiniLed = null;
|
this._indicateMiniLed = null;
|
||||||
this._indicatePanelOd = null;
|
this._indicatePanelOd = null;
|
||||||
@@ -142,6 +147,16 @@ class Extension {
|
|||||||
enable() {
|
enable() {
|
||||||
this._indicateMiniLed = new IndicateMiniLed();
|
this._indicateMiniLed = new IndicateMiniLed();
|
||||||
this._indicatePanelOd = new IndicatePanelOd();
|
this._indicatePanelOd = new IndicatePanelOd();
|
||||||
|
this._dbus_charge = new ChargingLimit();
|
||||||
|
this._dbus_charge.start().then(() => {
|
||||||
|
//@ts-ignore
|
||||||
|
log(`DOOOOOM!, charge limit =`, this._dbus_charge.lastState);
|
||||||
|
});
|
||||||
|
this._dbus_supported = new Supported();
|
||||||
|
this._dbus_supported.start().then(() => {
|
||||||
|
//@ts-ignore
|
||||||
|
log(`DOOOOOM!, supported =`, this._dbus_supported.supported);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
disable() {
|
disable() {
|
||||||
@@ -149,6 +164,9 @@ class Extension {
|
|||||||
this._indicateMiniLed = null;
|
this._indicateMiniLed = null;
|
||||||
this._indicatePanelOd.destroy();
|
this._indicatePanelOd.destroy();
|
||||||
this._indicatePanelOd = null;
|
this._indicatePanelOd = null;
|
||||||
|
|
||||||
|
this._dbus_charge.stop();
|
||||||
|
this._dbus_supported.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,36 +5,18 @@ const ThisModule = imports.misc.extensionUtils.getCurrentExtension();
|
|||||||
|
|
||||||
import * as Resources from './resources';
|
import * as Resources from './resources';
|
||||||
|
|
||||||
const {Gio} = imports.gi;
|
const { Gio } = imports.gi;
|
||||||
|
|
||||||
export class AnimeDbus {
|
import { DbusBase } from '../modules/dbus';
|
||||||
asusLinuxProxy: any = null; // type: Gio.DbusProxy (donno how to add)
|
|
||||||
connected: boolean = false;
|
export class AnimeDbus extends DbusBase {
|
||||||
state: boolean = true;
|
state: boolean = true;
|
||||||
brightness: number = 255;
|
brightness: number = 255;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// nothing for now
|
super('org-asuslinux-anime-4', '/org/asuslinux/Anime');
|
||||||
}
|
}
|
||||||
|
|
||||||
// currently there is no DBUS method because this can't be read from
|
|
||||||
// hardware (as to @fluke).
|
|
||||||
// https://gitlab.com/asus-linux/asusctl/-/issues/138
|
|
||||||
|
|
||||||
// public getOnOffState() {
|
|
||||||
// if (this.isRunning()) {
|
|
||||||
// try {
|
|
||||||
// let currentState = this.asusLinuxProxy.AwakeEnabled;
|
|
||||||
|
|
||||||
// return currentState;
|
|
||||||
// } catch (e) {
|
|
||||||
// log(`Failed to fetch AniMe!`, e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return this.state;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public setOnOffState(state: boolean | null) {
|
public setOnOffState(state: boolean | null) {
|
||||||
if (this.isRunning()) {
|
if (this.isRunning()) {
|
||||||
try {
|
try {
|
||||||
@@ -46,7 +28,7 @@ export class AnimeDbus {
|
|||||||
}
|
}
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`Setting AniMe Power to ${state}`);
|
log(`Setting AniMe Power to ${state}`);
|
||||||
return this.asusLinuxProxy.SetOnOffSync(state);
|
return this.dbus_proxy.SetOnOffSync(state);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`AniMe DBus set power failed!`, e);
|
log(`AniMe DBus set power failed!`, e);
|
||||||
@@ -55,24 +37,20 @@ export class AnimeDbus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setBrightness(brightness: number) {
|
public setBrightness(brightness: number) {
|
||||||
if (this.isRunning()) {
|
if (this.isRunning()) {
|
||||||
try {
|
try {
|
||||||
if (this.brightness !== brightness) {
|
if (this.brightness !== brightness) {
|
||||||
this.brightness = brightness;
|
this.brightness = brightness;
|
||||||
}
|
}
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`Setting AniMe Brightness to ${brightness}`);
|
log(`Setting AniMe Brightness to ${brightness}`);
|
||||||
return this.asusLinuxProxy.SetBrightnessSync(brightness);
|
return this.dbus_proxy.SetBrightnessSync(brightness);
|
||||||
// Panel.Actions.spawnCommandLine(`asusctl anime leds -b ${brightness}`);
|
// Panel.Actions.spawnCommandLine(`asusctl anime leds -b ${brightness}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`AniMe DBus set brightness failed!`, e);
|
log(`AniMe DBus set brightness failed!`, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
isRunning(): boolean {
|
|
||||||
return this.connected;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
@@ -82,7 +60,7 @@ export class AnimeDbus {
|
|||||||
try {
|
try {
|
||||||
// creating the proxy
|
// creating the proxy
|
||||||
let xml = Resources.File.DBus('org-asuslinux-anime-4')
|
let xml = Resources.File.DBus('org-asuslinux-anime-4')
|
||||||
this.asusLinuxProxy = new Gio.DBusProxy.makeProxyWrapper(xml)(
|
this.dbus_proxy = new Gio.DBusProxy.makeProxyWrapper(xml)(
|
||||||
Gio.DBus.system,
|
Gio.DBus.system,
|
||||||
'org.asuslinux.Daemon',
|
'org.asuslinux.Daemon',
|
||||||
'/org/asuslinux/Anime'
|
'/org/asuslinux/Anime'
|
||||||
@@ -109,14 +87,7 @@ export class AnimeDbus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
async stop() {
|
||||||
//@ts-ignore
|
await super.stop();
|
||||||
log(`Stopping AniMe DBus client...`);
|
|
||||||
|
|
||||||
if (this.isRunning()) {
|
|
||||||
this.connected = false;
|
|
||||||
this.asusLinuxProxy = null;
|
|
||||||
this.state = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,33 +3,38 @@ declare var asusctlGexInstance: any;
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
import * as Resources from './resources';
|
import { DbusBase } from '../modules/dbus';
|
||||||
|
|
||||||
const {Gio, GLib} = imports.gi;
|
// function getMethods(obj: { [x: string]: { toString: () => string; }; }) {
|
||||||
|
// var result = [];
|
||||||
|
// for (var id in obj) {
|
||||||
|
// try {
|
||||||
|
// if (typeof(obj[id]) == "function") {
|
||||||
|
// result.push(id + ": " + obj[id].toString());
|
||||||
|
// }
|
||||||
|
// } catch (err) {
|
||||||
|
// result.push(id + ": inaccessible");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
export class ChargingLimit {
|
export class ChargingLimit extends DbusBase {
|
||||||
asusLinuxProxy: any = null; // type: Gio.DbusProxy (donno how to add)
|
|
||||||
connected: boolean = false;
|
|
||||||
lastState: number = 100;
|
lastState: number = 100;
|
||||||
pollerDelayTicks: number = 0;
|
|
||||||
timeoutChargePoller: number | null = null;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// nothing for now
|
super('org-asuslinux-power-4', '/org/asuslinux/Power');
|
||||||
}
|
}
|
||||||
|
|
||||||
public getChargingLimit() {
|
public getChargingLimit() {
|
||||||
if (this.isRunning()) {
|
if (this.isRunning()) {
|
||||||
try {
|
try {
|
||||||
let currentState = this.asusLinuxProxy.LimitSync().toString().trim();
|
this.lastState = this.dbus_proxy.ChargeControlEndThresholdSync();
|
||||||
|
|
||||||
return currentState;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`Failed to fetch Charging Limit!`, e);
|
log(`Failed to fetch Charging Limit!`, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.lastState;
|
return this.lastState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +45,7 @@ export class ChargingLimit {
|
|||||||
// update state
|
// update state
|
||||||
this.lastState = limit;
|
this.lastState = limit;
|
||||||
}
|
}
|
||||||
return this.asusLinuxProxy.SetLimitSync(limit);
|
return this.dbus_proxy.SetChargeControlEndThresholdSync(limit);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`Profile DBus set power profile failed!`, e);
|
log(`Profile DBus set power profile failed!`, e);
|
||||||
@@ -48,102 +53,28 @@ export class ChargingLimit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateChargingLimit(curState: number) {
|
|
||||||
// return false;
|
|
||||||
if (curState > 0 && this.lastState !== curState) {
|
|
||||||
// disable the signal handler so we don't run in an infinite loop
|
|
||||||
// of notifying, setting, notifying, setting...
|
|
||||||
asusctlGexInstance.chargingLimit.chargingLimitSlider.block_signal_handler(asusctlGexInstance.chargingLimit._sliderChangedId);
|
|
||||||
asusctlGexInstance.chargingLimit.chargingLimitSlider.value = curState/100;
|
|
||||||
asusctlGexInstance.chargingLimit.chargingLimitSlider.unblock_signal_handler(asusctlGexInstance.chargingLimit._sliderChangedId);
|
|
||||||
|
|
||||||
asusctlGexInstance.chargingLimit.chargeLimitLabel.set_text(`${curState}%`);
|
|
||||||
|
|
||||||
// update state
|
|
||||||
this.lastState = curState;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pollerChargingLimit() {
|
|
||||||
if(this.isRunning() && this.pollerDelayTicks <= 0){
|
|
||||||
try {
|
|
||||||
let currentLimit = this.getChargingLimit();
|
|
||||||
if (currentLimit !== this.lastState){
|
|
||||||
this.updateChargingLimit(currentLimit);
|
|
||||||
|
|
||||||
// Panel.Actions.notify(
|
|
||||||
// 'ASUS Notebook Control',
|
|
||||||
// `Charging Limit changed to ${currentLimit}%`,
|
|
||||||
// 'scalable/battery-symbolic.svg'
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
//@ts-ignore
|
|
||||||
log(`Charging Limit poller init failed!`, e);
|
|
||||||
} finally {
|
|
||||||
return this.isRunning() ? GLib.SOURCE_CONTINUE : GLib.SOURCE_REMOVE;
|
|
||||||
}
|
|
||||||
} else if (this.isRunning() && this.pollerDelayTicks > 0) {
|
|
||||||
this.pollerDelayTicks--;
|
|
||||||
return GLib.SOURCE_CONTINUE;
|
|
||||||
} else {
|
|
||||||
return GLib.SOURCE_REMOVE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
isRunning(): boolean {
|
|
||||||
return this.connected;
|
|
||||||
}
|
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
//@ts-ignore
|
|
||||||
log(`Starting Charging Limit DBus client...`);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// creating the proxy
|
await super.start();
|
||||||
let xml = Resources.File.DBus('org-asuslinux-charge-4')
|
this.getChargingLimit();
|
||||||
this.asusLinuxProxy = new Gio.DBusProxy.makeProxyWrapper(xml)(
|
|
||||||
Gio.DBus.system,
|
|
||||||
'org.asuslinux.Daemon',
|
|
||||||
'/org/asuslinux/Charge'
|
|
||||||
);
|
|
||||||
|
|
||||||
this.connected = true;
|
this.dbus_proxy.connectSignal(
|
||||||
this.lastState = this.getChargingLimit();
|
"NotifyChargeControlEndThreshold",
|
||||||
|
|
||||||
this.asusLinuxProxy.connectSignal(
|
|
||||||
"NotifyCharge",
|
|
||||||
(proxy: any = null, name: string, data: string) => {
|
(proxy: any = null, name: string, data: string) => {
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`Charging Limit has changed to ${data}% (${name}).`);
|
log(`Charging Limit has changed to ${data}% (${name}).`);
|
||||||
this.updateChargingLimit(parseInt(data));
|
this.lastState = parseInt(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
|
||||||
this.timeoutChargePoller = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 5, this.pollerChargingLimit.bind(this));
|
|
||||||
} catch (e) {
|
|
||||||
//@ts-ignore
|
|
||||||
log(`Charging Limit DBus Poller initialization failed!`, e);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`Charging Limit DBus initialization failed!`, e);
|
log(`Charging Limit DBus initialization failed!`, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
async stop() {
|
||||||
//@ts-ignore
|
await super.stop();
|
||||||
log(`Stopping Charging Limit DBus client...`);
|
|
||||||
|
|
||||||
if (this.isRunning()) {
|
|
||||||
this.connected = false;
|
|
||||||
this.asusLinuxProxy = null;
|
|
||||||
this.lastState = 100;
|
|
||||||
GLib.Source.remove(this.timeoutChargePoller);
|
|
||||||
this.timeoutChargePoller = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
54
desktop-extensions/gnome/src/modules/dbus.ts
Normal file
54
desktop-extensions/gnome/src/modules/dbus.ts
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
declare const global: any, imports: any;
|
||||||
|
//@ts-ignore
|
||||||
|
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
import * as Resources from '../modules/resources';
|
||||||
|
|
||||||
|
const { Gio } = imports.gi;
|
||||||
|
|
||||||
|
export class DbusBase {
|
||||||
|
dbus_proxy: any = null; // type: Gio.DbusProxy
|
||||||
|
connected: boolean = false;
|
||||||
|
xml_resource: string = '';
|
||||||
|
dbus_path: string = '';
|
||||||
|
|
||||||
|
constructor(resource: string, dbus_path: string) {
|
||||||
|
this.xml_resource = resource;
|
||||||
|
this.dbus_path = dbus_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
async start() {
|
||||||
|
//@ts-ignore
|
||||||
|
log(`Starting ${this.dbus_path} dbus module`);
|
||||||
|
try {
|
||||||
|
let xml = Resources.File.DBus(this.xml_resource);
|
||||||
|
this.dbus_proxy = new Gio.DBusProxy.makeProxyWrapper(xml)(
|
||||||
|
Gio.DBus.system,
|
||||||
|
'org.asuslinux.Daemon',
|
||||||
|
this.dbus_path,
|
||||||
|
);
|
||||||
|
|
||||||
|
this.connected = true;
|
||||||
|
//@ts-ignore
|
||||||
|
log(`${this.dbus_path} client started successfully.`);
|
||||||
|
} catch (e) {
|
||||||
|
//@ts-ignore
|
||||||
|
log(`${this.xml_resource} dbus init failed!`, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async stop() {
|
||||||
|
//@ts-ignore
|
||||||
|
log(`Stopping ${this.xml_resource} dbus module`);
|
||||||
|
|
||||||
|
if (this.connected) {
|
||||||
|
this.dbus_proxy.destroy();
|
||||||
|
this.connected = false;
|
||||||
|
this.dbus_proxy = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isRunning(): boolean {
|
||||||
|
return this.connected;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,20 +3,20 @@ declare var asusctlGexInstance: any;
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
import * as Bios from '../bindings/platform';
|
import * as bios from '../bindings/platform';
|
||||||
import * as Dbus from './dbus';
|
import { DbusBase } from '../modules/dbus';
|
||||||
|
|
||||||
export class Platform extends Dbus.DbusClass {
|
export class Platform extends DbusBase {
|
||||||
bios: Bios.RogBiosSupportedFunctions = asusctlGexInstance.supported.connector.supported;
|
bios: bios.RogBiosSupportedFunctions = asusctlGexInstance.supported.connector.supported;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('org-asuslinus-platform-4', '/org/asuslinux/Platform');
|
super('org-asuslinux-platform-4', '/org/asuslinux/Platform');
|
||||||
}
|
}
|
||||||
|
|
||||||
public getPostBootSound() {
|
public getPostBootSound() {
|
||||||
if (this.isRunning()) {
|
if (this.isRunning()) {
|
||||||
try {
|
try {
|
||||||
let currentState = this.asusLinuxProxy.PostBootSoundSync();
|
let currentState = this.dbus_proxy.PostBootSoundSync();
|
||||||
return parseInt(currentState) == 1 ? true : false;
|
return parseInt(currentState) == 1 ? true : false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
@@ -32,7 +32,7 @@ export class Platform extends Dbus.DbusClass {
|
|||||||
if (state !== this.bios.post_sound) {
|
if (state !== this.bios.post_sound) {
|
||||||
this.bios.post_sound = state;
|
this.bios.post_sound = state;
|
||||||
}
|
}
|
||||||
return this.asusLinuxProxy.SetPostBootSoundSync(state);
|
return this.dbus_proxy.SetPostBootSoundSync(state);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`Platform DBus set Post Boot Sound failed!`, e);
|
log(`Platform DBus set Post Boot Sound failed!`, e);
|
||||||
@@ -43,7 +43,7 @@ export class Platform extends Dbus.DbusClass {
|
|||||||
public getMUX() {
|
public getMUX() {
|
||||||
if (this.isRunning()) {
|
if (this.isRunning()) {
|
||||||
try {
|
try {
|
||||||
let currentState = this.asusLinuxProxy.GpuMuxModeSync();
|
let currentState = this.dbus_proxy.GpuMuxModeSync();
|
||||||
return parseInt(currentState) == 0 ? true : false;
|
return parseInt(currentState) == 0 ? true : false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
@@ -59,7 +59,7 @@ export class Platform extends Dbus.DbusClass {
|
|||||||
if (!state !== this.bios.gpu_mux) {
|
if (!state !== this.bios.gpu_mux) {
|
||||||
this.bios.gpu_mux = !state;
|
this.bios.gpu_mux = !state;
|
||||||
}
|
}
|
||||||
return this.asusLinuxProxy.SetGpuMuxModeSync(!state);
|
return this.dbus_proxy.SetGpuMuxModeSync(!state);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`Switching the MUX failed!`, e);
|
log(`Switching the MUX failed!`, e);
|
||||||
@@ -70,7 +70,7 @@ export class Platform extends Dbus.DbusClass {
|
|||||||
public getOverdrive() {
|
public getOverdrive() {
|
||||||
if (this.isRunning()) {
|
if (this.isRunning()) {
|
||||||
try {
|
try {
|
||||||
let currentState = this.asusLinuxProxy.PanelOverdriveSync();
|
let currentState = this.dbus_proxy.PanelOverdriveSync();
|
||||||
return parseInt(currentState) == 1 ? true : false;
|
return parseInt(currentState) == 1 ? true : false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
@@ -86,7 +86,7 @@ export class Platform extends Dbus.DbusClass {
|
|||||||
if (state !== this.bios.panel_overdrive) {
|
if (state !== this.bios.panel_overdrive) {
|
||||||
this.bios.panel_overdrive = state;
|
this.bios.panel_overdrive = state;
|
||||||
}
|
}
|
||||||
return this.asusLinuxProxy.SetPanelOverdriveSync(state);
|
return this.dbus_proxy.SetPanelOverdriveSync(state);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`Overdrive DBus set overdrive state failed!`, e);
|
log(`Overdrive DBus set overdrive state failed!`, e);
|
||||||
@@ -94,17 +94,13 @@ export class Platform extends Dbus.DbusClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isRunning(): boolean {
|
|
||||||
return this.connected;
|
|
||||||
}
|
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
try {
|
try {
|
||||||
super.start();
|
await super.start();
|
||||||
|
|
||||||
if (asusctlGexInstance.supported.connector.supportedAttributes.bios_toggleSound) {
|
if (asusctlGexInstance.supported.connector.supportedAttributes.bios_toggleSound) {
|
||||||
this.bios.post_sound = this.getPostBootSound();
|
this.bios.post_sound = this.getPostBootSound();
|
||||||
this.asusLinuxProxy.connectSignal(
|
this.dbus_proxy.connectSignal(
|
||||||
"NotifyPostBootSound",
|
"NotifyPostBootSound",
|
||||||
(proxy: any = null, _name: string, data: boolean) => {
|
(proxy: any = null, _name: string, data: boolean) => {
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
@@ -118,7 +114,7 @@ export class Platform extends Dbus.DbusClass {
|
|||||||
|
|
||||||
if (asusctlGexInstance.supported.connector.supportedAttributes.bios_overdrive) {
|
if (asusctlGexInstance.supported.connector.supportedAttributes.bios_overdrive) {
|
||||||
this.bios.panel_overdrive = this.getOverdrive();
|
this.bios.panel_overdrive = this.getOverdrive();
|
||||||
this.asusLinuxProxy.connectSignal(
|
this.dbus_proxy.connectSignal(
|
||||||
"NotifyPanelOverdrive",
|
"NotifyPanelOverdrive",
|
||||||
(proxy: any = null, _name: string, data: boolean) => {
|
(proxy: any = null, _name: string, data: boolean) => {
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
@@ -132,7 +128,7 @@ export class Platform extends Dbus.DbusClass {
|
|||||||
|
|
||||||
if (asusctlGexInstance.supported.connector.supportedAttributes.bios_toggleMUX) {
|
if (asusctlGexInstance.supported.connector.supportedAttributes.bios_toggleMUX) {
|
||||||
this.bios.gpu_mux = this.getMUX();
|
this.bios.gpu_mux = this.getMUX();
|
||||||
this.asusLinuxProxy.connectSignal(
|
this.dbus_proxy.connectSignal(
|
||||||
"NotifyGpuMuxMode",
|
"NotifyGpuMuxMode",
|
||||||
(proxy: any = null, _name: string, data: boolean) => {
|
(proxy: any = null, _name: string, data: boolean) => {
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
@@ -157,7 +153,7 @@ export class Platform extends Dbus.DbusClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async stop() {
|
async stop() {
|
||||||
super.stop();
|
await super.stop();
|
||||||
this.bios.post_sound = false;
|
this.bios.post_sound = false;
|
||||||
this.bios.panel_overdrive = false;
|
this.bios.panel_overdrive = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,11 @@ declare const global: any, imports: any;
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
import * as Resources from './resources';
|
import { SupportedFunctions, AdvancedAura } from '../bindings/platform';
|
||||||
|
import { AuraDevice, AuraModeNum, AuraZone } from '../bindings/aura';
|
||||||
import * as Platform from '../bindings/platform';
|
import { DbusBase } from '../modules/dbus';
|
||||||
import * as Aura from '../bindings/aura';
|
|
||||||
|
|
||||||
const { Gio } = imports.gi;
|
|
||||||
|
|
||||||
export class Supported {
|
|
||||||
supportedProxy: any = null; // type: Gio.DbusProxy (donno how to add)
|
|
||||||
connectedSupported: boolean = false;
|
|
||||||
|
|
||||||
|
export class Supported extends DbusBase {
|
||||||
// False,
|
// False,
|
||||||
// (True,),
|
// (True,),
|
||||||
// (True, True),
|
// (True, True),
|
||||||
@@ -34,7 +28,7 @@ export class Supported {
|
|||||||
// 2),
|
// 2),
|
||||||
// (False, True, True, True, False, True)
|
// (False, True, True, True, False, True)
|
||||||
|
|
||||||
supported: Platform.SupportedFunctions = {
|
supported: SupportedFunctions = {
|
||||||
anime_ctrl: false,
|
anime_ctrl: false,
|
||||||
charge_ctrl: {
|
charge_ctrl: {
|
||||||
charge_level_set: false
|
charge_level_set: false
|
||||||
@@ -44,11 +38,11 @@ export class Supported {
|
|||||||
fan_curves: false
|
fan_curves: false
|
||||||
},
|
},
|
||||||
keyboard_led: {
|
keyboard_led: {
|
||||||
dev_id: Aura.AuraDevice.Unknown,
|
dev_id: AuraDevice.Unknown,
|
||||||
brightness: false,
|
brightness: false,
|
||||||
basic_modes: [],
|
basic_modes: [],
|
||||||
basic_zones: [],
|
basic_zones: [],
|
||||||
advanced_type: Platform.AdvancedAura.None
|
advanced_type: AdvancedAura.None
|
||||||
},
|
},
|
||||||
rog_bios_ctrl: {
|
rog_bios_ctrl: {
|
||||||
post_sound: false,
|
post_sound: false,
|
||||||
@@ -61,13 +55,13 @@ export class Supported {
|
|||||||
};
|
};
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// nothing for now
|
super('org-asuslinux-supported-4', '/org/asuslinux/Supported');
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSupported() {
|
public getSupported() {
|
||||||
if (this.isRunning()) {
|
if (this.isRunning()) {
|
||||||
try {
|
try {
|
||||||
let _supportedAttributes = this.supportedProxy.SupportedFunctionsSync();
|
let _supportedAttributes = this.dbus_proxy.SupportedFunctionsSync();
|
||||||
if (_supportedAttributes.length > 0) {
|
if (_supportedAttributes.length > 0) {
|
||||||
let valueString: string = '';
|
let valueString: string = '';
|
||||||
|
|
||||||
@@ -93,15 +87,15 @@ export class Supported {
|
|||||||
case 3:
|
case 3:
|
||||||
let ledArray = valueString.split(',');
|
let ledArray = valueString.split(',');
|
||||||
// let t: keyof typeof AuraDevice = ledArray[0]; // can't conevert
|
// let t: keyof typeof AuraDevice = ledArray[0]; // can't conevert
|
||||||
this.supported.keyboard_led.dev_id = Aura.AuraDevice[ledArray[0] as Aura.AuraDevice];
|
this.supported.keyboard_led.dev_id = AuraDevice[ledArray[0] as AuraDevice];
|
||||||
this.supported.keyboard_led.brightness = (ledArray[1] == 'true' ? true : false);
|
this.supported.keyboard_led.brightness = (ledArray[1] == 'true' ? true : false);
|
||||||
this.supported.keyboard_led.basic_modes = ledArray[2].split(',').map(function (value) {
|
this.supported.keyboard_led.basic_modes = ledArray[2].split(',').map(function (value) {
|
||||||
return Aura.AuraModeNum[value as Aura.AuraModeNum]
|
return AuraModeNum[value as AuraModeNum]
|
||||||
});
|
});
|
||||||
this.supported.keyboard_led.basic_zones = ledArray[3].split(',').map(function (value) {
|
this.supported.keyboard_led.basic_zones = ledArray[3].split(',').map(function (value) {
|
||||||
return Aura.AuraZone[value as Aura.AuraZone]
|
return AuraZone[value as AuraZone]
|
||||||
});
|
});
|
||||||
this.supported.keyboard_led.advanced_type = Platform.AdvancedAura[ledArray[4] as Platform.AdvancedAura];
|
this.supported.keyboard_led.advanced_type = AdvancedAura[ledArray[4] as AdvancedAura];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
@@ -126,38 +120,17 @@ export class Supported {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isRunning(): boolean {
|
|
||||||
return this.connectedSupported;
|
|
||||||
}
|
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
try {
|
try {
|
||||||
// creating the proxy
|
await super.start();
|
||||||
let xml = Resources.File.DBus('org-asuslinux-supported-4');
|
|
||||||
this.supportedProxy = new Gio.DBusProxy.makeProxyWrapper(xml)(
|
|
||||||
Gio.DBus.system,
|
|
||||||
'org.asuslinux.Daemon',
|
|
||||||
'/org/asuslinux/Supported'
|
|
||||||
);
|
|
||||||
|
|
||||||
this.connectedSupported = true;
|
|
||||||
|
|
||||||
this.getSupported();
|
this.getSupported();
|
||||||
//@ts-ignore
|
|
||||||
log(`Supported Daemon client started successfully.`);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`Supported DBus initialization failed!`, e);
|
log(`Supported DBus initialization failed!`, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
async stop() {
|
||||||
//@ts-ignore
|
await super.stop()
|
||||||
log(`Stopping Supported DBus client...`);
|
|
||||||
|
|
||||||
if (this.isRunning()) {
|
|
||||||
this.connectedSupported = false;
|
|
||||||
this.supportedProxy = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user