Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@ These options are not written to the config file as they are stored in efivars.

### Profiles

asusctl can support setting a power profile via platform_profile drivers. This requires [power-profiles-daemon](https://gitlab.freedesktop.org/hadess/power-profiles-daemon) v0.10.0 minimum. It also requires the kernel patch for platform_profile support to be applied form [here](https://lkml.org/lkml/2021/8/18/1022) - this patch is merged to 5.15 kernel upstream.
asusctl supports setting power profiles via ACPI `platform_profile` drivers.

> [!IMPORTANT]
> **Compatibility with `power-profiles-daemon`**:
> Do **NOT** run `power-profiles-daemon` alongside `asusd`. Running both services concurrently causes race conditions and contention over `/sys/firmware/acpi/platform_profile` and CPU EPP preferences.
>
> To allow `asusd` to manage platform profiles, EPP, custom fan curves, and PPT limits cleanly, disable `power-profiles-daemon`:
> ```bash
> sudo systemctl disable --now power-profiles-daemon.service

A common use of asusctl is to bind the `fn+f5` (fan) key to `asusctl profile -n` to cycle through the 3 profiles:

Expand Down
12 changes: 12 additions & 0 deletions asusctl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,18 @@ fn handle_throttle_profile(
}

let proxy = PlatformProxyBlocking::new(conn)?;

if let Ok(dbus_proxy) = zbus::blocking::fdo::DBusProxy::new(conn) {
if let Ok(ppd_name) = zbus::names::BusName::try_from("net.hadess.PowerProfiles") {
if dbus_proxy.name_has_owner(ppd_name).unwrap_or(false) {
eprintln!("WARN: 'power-profiles-daemon' is running concurrently with asusd!");
eprintln!("This causes EPP and platform_profile contention.");
eprintln!(
"Disable it via: 'sudo systemctl disable --now power-profiles-daemon.service'"
);
}
}
}
let current = proxy.platform_profile()?;
let choices = proxy.platform_profile_choices()?;

Expand Down
24 changes: 24 additions & 0 deletions asusd/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,30 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
Err(e) => error!("XG Mobile LED: {e}"),
}

// Check if power-profiles-daemon is running
if let Ok(dbus_proxy) = zbus::fdo::DBusProxy::new(&server).await {
let ppd_name = zbus::names::BusName::try_from("net.hadess.PowerProfiles");
let ppd_owned = match ppd_name {
Ok(ref name) => dbus_proxy
.name_has_owner(name.clone())
.await
.unwrap_or(false),
Err(_) => false,
};

if ppd_owned {
warn!(
"********************************************************************************"
);
warn!("WARN: 'power-profiles-daemon' (or another PPD provider) is active on system D-Bus!");
warn!("Running power-profiles-daemon concurrently with asusd causes EPP and platform_profile contention.");
warn!("To allow asusd to manage profiles, EPP, fan curves, and KDE/GNOME sliders natively, disable it via:");
warn!(" sudo systemctl disable --now power-profiles-daemon.service");
warn!(
"********************************************************************************"
);
}
}
// Request dbus name after finishing initalizing all functions
server.request_name(DBUS_NAME).await?;

Expand Down
71 changes: 71 additions & 0 deletions distro-packaging/asusctl.install
Original file line number Diff line number Diff line change
@@ -1,5 +1,76 @@
#!/hint/bash
post_upgrade() {
local missing=0
if [[ $2 == 3* ]]; then
echo -e "\033[0;34m"
echo "-> Upgrading from asusctl 3.X.X"

if [[ -f "/etc/asusd/asusd.conf" ]]; then
echo -e "\033[0;33m"
echo "-> Old config found"
echo "-> Because of breaking changes your config will be moved too /etc/asusd/asusd.conf.old.3.X.X"
mv /etc/asusd/asusd.conf /etc/asusd/asusd.conf.old.3.X.X
echo -e "\033[0m"
fi

echo -e "\033[0m"
fi;

# test for features every upgrade, not just major 3.x -> 4.x

platform_profile_choices=$(cat /sys/firmware/acpi/platform_profile_choices)

if [[ $platform_profile_choices != "quiet balanced performance" ]]; then
if [[ $platform_profile_choices != "low-power balanced performance" ]]; then
echo -e "\033[0;31m"
echo "-> Platform profile support not found in current running kernel"
echo "-> Make sure you are using a kernel with patch: https://lore.kernel.org/lkml/20210818190731.19170-1-luke@ljones.dev/"
echo "-> and asus_wmi driver is loaded"
echo -e "\033[0m"
missing=1
fi
fi

# FIXME: test for fan control support here

if false; then # FIXME
echo -e "\033[0;31m"
echo "-> Fan control support not found in current running kernel"
echo "-> Make sure you are using a kernel with patch: https://lore.kernel.org/lkml/20211024033705.5595-1-luke@ljones.dev/"
echo "-> and asus_wmi driver is loaded"
echo -e "\033[0m"
missing=1

fi

if (( missing != 0 )); then
echo -e "\033[0;31m"
echo "==> Missing kernel support detected: the linux-g14 kernel includes support for all features."
echo -e "\033[0m"
fi

if [ -d '/etc/mkinitcpio.conf.d' ]; then
if [ ! -f "/etc/mkinitcpio.conf.d/asus.conf" ]; then
echo -e "\033[0;33m"
echo "-> Adding asus modules to mkinitcpio.conf"
echo "MODULES+=(hid_asus asus_wmi asus_nb_wmi)" > /etc/mkinitcpio.conf.d/asus.conf
for f in /etc/mkinitcpio.d/*; do
all_config_fixed=$(cat $f | grep "#ALL_config" | wc -l)
default_config_fixed=$(cat $f | grep "#default_config" | wc -l)
if [[ $all_config_fixed == 0 ]]; then
sed -i 's/^ALL_config/#&/' $f
fi
if [[ $default_config_fixed == 0 ]]; then
sed -i 's/^default_config/#&/' $f
fi

mkinitcpio -p $(basename -s .preset $f)
done
echo -e "\033[0m"
fi
fi

# we might have missed this in a prior upgrade from 3.x
cleanup_asusd_leftovers
systemctl restart asusd.service
}
Expand Down
13 changes: 13 additions & 0 deletions rog-control-center/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ async fn main() -> Result<()> {
// return Ok(());
}

if let Ok(dbus_proxy) = zbus::blocking::fdo::DBusProxy::new(&zbus_con) {
if let Ok(ppd_name) = zbus::names::BusName::try_from("net.hadess.PowerProfiles") {
if dbus_proxy.name_has_owner(ppd_name).unwrap_or(false) {
warn!("********************************************************************************");
warn!("WARN: 'power-profiles-daemon' is active on system D-Bus!");
warn!("Running power-profiles-daemon concurrently causes EPP and platform_profile contention.");
warn!("To allow asusd to manage profiles, EPP, fan curves, and KDE/GNOME sliders natively, disable it:");
warn!(" sudo systemctl disable --now power-profiles-daemon.service");
warn!("********************************************************************************");
}
}
}

// start tokio
let rt = Runtime::new().expect("Unable to create Runtime");
// Enter the runtime so that `tokio::spawn` is available immediately.
Expand Down