Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
asusctl (ROG laptops) without systemd
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
psycho
Guru
Guru


Joined: 22 Jun 2007
Posts: 534
Location: New Zealand

PostPosted: Wed Jan 12, 2022 7:15 am    Post subject: asusctl (ROG laptops) without systemd Reply with quote

I realise the developer of asusctl is uninterested in supporting anything except systemd, however I find it hard to believe that systemd is really necessary to control these modern ASUS ROG laptops: I'm hopeful that whatever asusctl is doing can be done by other means, like direct edits to files under /sys or whatever. Clearly the kernel support is there or asusctl wouldn't work: has anyone either (a) figured out a way to build and install asusctl on openrc, or (b) figured out a way to achieve any (or better still, all) of the things it achieves, without using it?

My little Zephyrus G14 is working more or less perfectly on recent (5.15+) kernels without any special tools or patches: from a quick test with xev it looks as though every special key except for the dedicated microphone mute is working (with HID_ASUS enabled)...some of them require binding the scancodes to keycodes but the kernel sees them. Bluetooth, WIFI, touchpad and speakers are all great...basically the kernel has caught up with this generation of (formerly problematic) ROG laptops and I can confirm that the Zephyrus G14 works pretty well.

Except for the functions provided by asusctl, which I'm lacking at present. The battery life is the biggest issue: it sucks on Gentoo (a couple of hours when it should be closer to a full day). I'm guessing this is largely because I'm using the Nvidia GPU, so it should be possible to improve this with something like PRIME render offload (integrated graphics for most things, Nvidia just for specific applications), but asusctl looks to be much more flexible, enabling a range of different graphics and power usage settings...I would like to get it working if possible. The lid animations would be nice but are no big deal, so I can live without asusctl's functions if a bit of fiddling with the hybrid graphics setup makes the power usage acceptable...still, asusctl or some equivalent would be nicer.

There are ebuilds for it (in overlays), but again they depend on systemd (not just libraries, but actually using it), and the developer has no interest in making it work with other init systems. Has anyone come up with any kind of a solution for this issue?
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Wed Jan 12, 2022 4:21 pm    Post subject: Reply with quote

From the developer
Quote:

Luke Jones @flukejones · 10 months ago
Owner
No. Only systemd is supported. It really isn't worth my time to support anything not systemd (as systemd is the de-facto init system). Sorry.

You could if you wanted to, write your own init script to load asusd on boot - most of it will work but the new mthod of gfx switching will not.

Can you post the contents of systemd service file asusd?
_________________
:)
Back to top
View user's profile Send private message
psycho
Guru
Guru


Joined: 22 Jun 2007
Posts: 534
Location: New Zealand

PostPosted: Wed Jan 12, 2022 8:08 pm    Post subject: Reply with quote

Thanks for giving me somewhere to start. OK, I've built asusd and it outputs "asusd should only be run from the right systemd service... do not run in your terminal... if you need logs please use journalctl -b -u asusd. asusd will now exit". So I'm not sure how that response relates to his comment about launching it from a non-systemd init script. Anyway here's the contents of asusd.service:
Code:
[Unit]
Description=ASUS Notebook Control
StartLimitInterval=200
StartLimitBurst=2
Before=multi-user.target

[Service]
Environment=IS_SERVICE=1
ExecStartPre=/bin/sleep 2
ExecStart=/usr/bin/asusd
Restart=on-failure
Restart=always
RestartSec=1
Type=dbus
BusName=org.asuslinux.Daemon
SELinuxContext=system_u:system_r:unconfined_t:s0
#SELinuxContext=system_u:object_r:modules_object_t:s0

Does this mean there's a way to invoke it with dbus or something, without systemd, despite its output?
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1660

PostPosted: Wed Jan 12, 2022 8:25 pm    Post subject: Reply with quote

psycho wrote:
Thanks for giving me somewhere to start. OK, I've built asusd and it outputs "asusd should only be run from the right systemd service... do not run in your terminal... if you need logs please use journalctl -b -u asusd. asusd will now exit". So I'm not sure how that response relates to his comment about launching it from a non-systemd init script. Anyway here's the contents of asusd.service:
Code:
[Unit]
Description=ASUS Notebook Control
StartLimitInterval=200
StartLimitBurst=2
Before=multi-user.target

[Service]
Environment=IS_SERVICE=1
ExecStartPre=/bin/sleep 2
ExecStart=/usr/bin/asusd
Restart=on-failure
Restart=always
RestartSec=1
Type=dbus
BusName=org.asuslinux.Daemon
SELinuxContext=system_u:system_r:unconfined_t:s0
#SELinuxContext=system_u:object_r:modules_object_t:s0

Does this mean there's a way to invoke it with dbus or something, without systemd, despite its output?


Did you try:
Code:
IS_SERVICE=1 /usr/bin/asusd


It is likely they just put a message in which is flagged by the environment
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Wed Jan 12, 2022 10:42 pm    Post subject: Reply with quote

Quote:

Does this mean there's a way to invoke it with dbus or something, without systemd, despite its output?

In
/usr/share/dbus-1/services
maybe create a file
org.asuslinux.Daemon.service
containing
Code:

[D-BUS Service]
Name=org.asuslinux.Daemon
Exec=</usr/bin/asusd?>
SystemdService=<asusd.service?>


and pray it works.
Also maybe copy the asusd.service file in
Code:

/lib/systemd/system

directory.
In systemd environment plz run
Code:

equery f asusctl

What is the output?

:)
_________________
:)
Back to top
View user's profile Send private message
psycho
Guru
Guru


Joined: 22 Jun 2007
Posts: 534
Location: New Zealand

PostPosted: Thu Jan 13, 2022 5:47 am    Post subject: Reply with quote

Thanks for all these suggestions. The simple IS_SERVICE=1 trick worked...asusd attempts to launch...but immediately crashes with this output:
Code:
thread 'main' panicked at 'Could not get board_name: Os { code: 2, kind: NotFound, message: "No such file or directory" }', daemon/src/laptops.rs:52:43

As far as I can tell (based on line 52 of laptops.rs) this is triggered by an attempt to do something DMI related. Oh...OK, just before that it says "let dmi = sysfs_class::DmiID::default();" and I can see CONFIG_DMI_SYSFS is not set, in my kernel...so I'm guessing that's the problem now. This feels like progress anyway...the daemon is at least trying to do its thing. I'll enable CONFIG_DMI_SYSFS and try with the new kernel, because that's the only thing I can think of to do now, and will post again with the results.

[Edit]Nope, CONFIG_DMI_SYSFS made no difference, although I guess I'll just leave it enabled now. I'm still getting the same error. If I launch it with RUST_BACKTRACE=full it gives me:
Code:
INFO:        daemon v4.0.7
INFO:     rog-anime v1.3.0
INFO:      rog-aura v1.1.0
INFO:      rog-dbus v4.0.2
INFO:  rog-profiles v1.1.3
INFO: rog-supported v4.0.0
thread 'main' panicked at 'Could not get board_name: Os { code: 2, kind: NotFound, message: "No such file or directory" }', daemon/src/laptops.rs:52:43
stack backtrace:
   0:     0x563114fe21eb - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7c5cbc950a6e98ca
   1:     0x563114ef1aec - core::fmt::write::h6d4e36f71c229c7e
   2:     0x563114fe0d64 - std::io::Write::write_fmt::h9a4d183c6d8e2e45
   3:     0x563114fe12ee - std::panicking::default_hook::{{closure}}::h7077f7ca514617b6
   4:     0x563114fe0ae3 - std::panicking::rust_panic_with_hook::h4f815477eb18bcfb
   5:     0x563114fffb0d - std::panicking::begin_panic_handler::{{closure}}::h7a39573fedeb5d43
   6:     0x563114fffa86 - std::sys_common::backtrace::__rust_end_short_backtrace::h6230e6996d5f866c
   7:     0x563114fffa42 - rust_begin_unwind
   8:     0x563114ec3490 - core::panicking::panic_fmt::h7e065fe499918015
   9:     0x563114ec37c2 - core::result::unwrap_failed::h934e10679b725d01
  10:     0x563114f91862 - daemon::laptops::LaptopLedData::get_data::h85d54e5606addfe9
  11:     0x563114ecf92f - asusd::main::h5142bbdca8f123cc
  12:     0x563114ef03d3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h369a0b99ea8bf28f
  13:     0x563114ee3cd2 - main
  14:     0x7f098a1ab7ed - __libc_start_main
  15:     0x563114ecd02a - _start
  16:                0x0 - <unknown>
Aborted

...and now I'm back to having no clues as to what to do next. I'm sure this is meant to work on G14 laptops (I've read others claiming it does) so don't think it's a hardware issue. Unless...maybe I'm wrong that the latest kernels have everything I need...I'd better double-check that I'm not missing a necessary patch. Or maybe someone who actually understands the output above can point me in another direction?[/Edit]

[Edit2]No, as far as I can tell kernels from 5.11 up should support this without patching. So I'm stuck again.[/Edit2]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum