Improvements to service init

This commit is contained in:
Luke
2020-07-07 16:14:18 +12:00
parent c6c934bf40
commit ae9d0463da
43 changed files with 190 additions and 13 deletions

2
Cargo.lock generated
View File

@@ -710,7 +710,7 @@ dependencies = [
[[package]]
name = "rog-daemon"
version = "0.14.3"
version = "0.14.4"
dependencies = [
"dbus",
"dbus-tokio",

View File

@@ -34,11 +34,13 @@ distclean:
install: all
install -D -m 0755 "target/release/$(BIN)" "$(DESTDIR)$(bindir)/$(BIN)"
install -D -m 0644 "data/$(BIN).rules" "$(DESTDIR)$(sysconfdir)/udev/rules.d/99-$(BIN).rules"
install -D -m 0644 "data/$(BIN).conf" "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN).conf"
install -D -m 0644 "data/$(BIN).service" "$(DESTDIR)$(libdir)/systemd/system/$(BIN).service"
uninstall:
rm -f "$(DESTDIR)$(bindir)/$(BIN)"
rm -f "$(DESTDIR)$(sysconfdir)/udev/rules.d/99-$(BIN).conf"
rm -f "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN).conf"
rm -f "$(DESTDIR)$(libdir)/systemd/system/$(BIN).service"

View File

@@ -91,6 +91,30 @@ gnome-shell extension, or at least limiting use of the power-management parts as
(one or the other will overwrite pstates). I will create a shell extension at some point similar to system76, but using
the rog-core parts. It is safe to leave `system76-power.service` enabled and use for switching between graphics modes.
## Arch Linux, and possibly others
This method of enabling may become default.
Currently there seems to be an issue where the device is not fully initialised and
when rog-core attempts to grab the keyboard it will fail, and you may be left without
input. A way around this is to disable the systemd service (rog-core) if enabled
and create a udev rule in `/etc/udev/rules.d/99-rogcore.rules` with the following
content:
```
ACTION=="bind", SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="1866", TAG+="systemd", ENV{SYSTEMD_WANTS}="rog-core.service"
```
Double-check your `idProduct` with `lsusb |grep 0b05`, this will show a line such
as:
```
Bus 001 Device 006: ID 0b05:1866 ASUSTek Computer, Inc. N-KEY Device
```
where `1866` here is the `idProduct`. Modify the udev rule to suit. If there is
more than one line (such as with an AniMe laptop), prefer using the `N-Key` device.
### Ubuntu PPA
Alternatively, instead of building manually you can use the PPA.
@@ -101,12 +125,7 @@ sudo apt-get update
sudo apt-get install rog-core
```
enable and start the service:
```
sudo systemctl start rog-core.service
sudo systemctl enable rog-core.service
```
the rog-core service will run when the device is initialised.
### Gentoo ebuild

1
data/rog-core.rules Normal file
View File

@@ -0,0 +1 @@
ACTION=="bind", SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="18[0-9][0-9]", TAG+="systemd", ENV{SYSTEMD_WANTS}="rog-core.service"

View File

@@ -1,5 +1,6 @@
[Unit]
Description=ROG Core Daemon
After=dbus.service
[Service]
ExecStart=/usr/bin/rog-core -d

6
debian/changelog vendored
View File

@@ -1,3 +1,9 @@
rog-core (0.14.4) focal; urgency=medium
- Improve how service is initialised on boot
-- Luke Jones <luke@ljones.dev> Tue, 07 Jul 2020 16:14:48 +1200
rog-core (0.14.3) focal; urgency=medium
- Proper fix of laptop mode conversion bug

1
debian/control vendored
View File

@@ -18,6 +18,7 @@ Package: rog-core
Architecture: amd64
Depends:
dbus,
libc6,
systemd,
libusb-1.0-0,
${misc:Depends},

View File

@@ -4,7 +4,12 @@ set -e
case "$1" in
configure)
mv /etc/rogcore.conf /etc/rogcore.save || true
CONF='/etc/rogcore.conf'
if [ -f $CONF ]; then
mv $CONF $CONF.save
fi
#ROG=$(lsusb |grep 0b05 |cut -d ' ' -f 6 |cut -d ':' -f 2)
#sed -i -e "s|==/"1866/"|==/"${ROG}/"|g" /etc/udev/rules.d/99-rog-core.rules
;;
*)

View File

@@ -4,7 +4,10 @@ set -e
case "$1" in
remove)
rm -f /etc/rogcore.conf
CONF='/etc/rogcore.conf'
if [ -f $CONF ]; then
rm -rf $CONF
fi
;;
*)

View File

@@ -0,0 +1,4 @@
cat /sys/class/dmi/id/product_name:ROG Strix G512LU_G512LU
cat /sys/class/dmi/id/product_family: ROG Strix
cat /sys/class/dmi/id/board_name:G512LU

View File

@@ -0,0 +1,28 @@
001:002:002:DESCRIPTOR 1593779817.131018
06 31 FF 09 76 A1 01 85 5A 19 00 2A FF 00 15 00
26 FF 00 75 08 95 05 81 00 19 00 2A FF 00 15 00
26 FF 00 75 08 95 3F B1 00 C0 05 0C 09 01 A1 01
85 02 19 00 2A 3C 02 15 00 26 3C 02 75 10 95 02
81 00 C0 06 31 FF 09 79 A1 01 85 5D 19 00 2A FF
00 15 00 26 FF 00 75 08 95 1F 81 00 19 00 2A FF
00 15 00 26 FF 00 75 08 95 3F 91 00 19 00 2A FF
00 15 00 26 FF 00 75 08 95 3F B1 00 C0 06 31 FF
09 80 A1 01 85 5E 19 00 2A FF 00 15 00 26 FF 00
75 08 95 05 81 00 19 00 2A FF 00 15 00 26 FF 00
75 08 95 3F B1 00 C0
001:002:001:DESCRIPTOR 1593779817.133253
05 01 09 06 A1 01 85 09 75 01 95 08 05 07 19 E0
29 E7 15 00 25 01 81 02 95 08 75 01 81 03 95 05
75 01 05 08 19 01 29 05 91 02 95 01 75 03 91 03
95 F0 75 01 05 07 19 00 29 EF 15 00 25 01 81 02
C0
001:002:000:DESCRIPTOR 1593779817.134955
05 01 09 06 A1 01 85 01 75 01 95 08 05 07 19 E0
29 E7 15 00 25 01 81 02 95 01 75 08 81 03 95 05
75 01 05 08 19 01 29 05 91 02 95 01 75 03 91 03
95 06 75 08 15 00 26 FF 00 05 07 19 00 2A FF 00
81 00 95 C0 75 01 05 07 19 00 29 EF 15 00 25 01
81 02 C0

View File

@@ -0,0 +1,6 @@
distro= Arch Linux
uname -r= 5.7.7-arch1-1
product_name= Zephyrus G GU502DU_GA502DU
product_family= Zephyrus G
board_name= GU502DU
lsusb= Bus 003 Device 002: ID 0b05:1866 ASUSTek Computer, Inc. N-KEY Device

View File

@@ -0,0 +1,54 @@
-- Logs begin at Thu 2020-07-02 17:11:02 CEST, end at Fri 2020-07-03 13:19:49 CEST. --
júl 03 13:19:13 Zephyrus systemd[1]: Started ROG Core Daemon.
júl 03 13:19:13 Zephyrus rog-core[933380]: INFO: Product name: Zephyrus G GU502DU_GA502DU
júl 03 13:19:13 Zephyrus rog-core[933380]: INFO: Board name: GU502DU
júl 03 13:19:13 Zephyrus rog-core[933380]: thread 'main' panicked at 'Unsupported laptop, please request support at
júl 03 13:19:13 Zephyrus rog-core[933380]: https://github.com/flukejones/rog-core', rog-core/src/laptops.rs:89:9
júl 03 13:19:13 Zephyrus rog-core[933380]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
júl 03 13:19:13 Zephyrus systemd[1]: rog-core.service: Main process exited, code=dumped, status=6/ABRT
júl 03 13:19:13 Zephyrus systemd[1]: rog-core.service: Failed with result 'core-dump'.
júl 03 13:19:14 Zephyrus systemd[1]: rog-core.service: Scheduled restart job, restart counter is at 1.
júl 03 13:19:14 Zephyrus systemd[1]: Stopped ROG Core Daemon.
júl 03 13:19:14 Zephyrus systemd[1]: Started ROG Core Daemon.
júl 03 13:19:14 Zephyrus rog-core[933401]: INFO: Product name: Zephyrus G GU502DU_GA502DU
júl 03 13:19:14 Zephyrus rog-core[933401]: INFO: Board name: GU502DU
júl 03 13:19:14 Zephyrus rog-core[933401]: thread 'main' panicked at 'Unsupported laptop, please request support at
júl 03 13:19:14 Zephyrus rog-core[933401]: https://github.com/flukejones/rog-core', rog-core/src/laptops.rs:89:9
júl 03 13:19:14 Zephyrus rog-core[933401]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
júl 03 13:19:14 Zephyrus systemd[1]: rog-core.service: Main process exited, code=dumped, status=6/ABRT
júl 03 13:19:14 Zephyrus systemd[1]: rog-core.service: Failed with result 'core-dump'.
júl 03 13:19:14 Zephyrus systemd[1]: rog-core.service: Scheduled restart job, restart counter is at 2.
júl 03 13:19:14 Zephyrus systemd[1]: Stopped ROG Core Daemon.
júl 03 13:19:14 Zephyrus systemd[1]: Started ROG Core Daemon.
júl 03 13:19:14 Zephyrus rog-core[933420]: INFO: Product name: Zephyrus G GU502DU_GA502DU
júl 03 13:19:14 Zephyrus rog-core[933420]: INFO: Board name: GU502DU
júl 03 13:19:14 Zephyrus rog-core[933420]: thread 'main' panicked at 'Unsupported laptop, please request support at
júl 03 13:19:14 Zephyrus rog-core[933420]: https://github.com/flukejones/rog-core', rog-core/src/laptops.rs:89:9
júl 03 13:19:14 Zephyrus rog-core[933420]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
júl 03 13:19:15 Zephyrus systemd[1]: rog-core.service: Main process exited, code=dumped, status=6/ABRT
júl 03 13:19:15 Zephyrus systemd[1]: rog-core.service: Failed with result 'core-dump'.
júl 03 13:19:15 Zephyrus systemd[1]: rog-core.service: Scheduled restart job, restart counter is at 3.
júl 03 13:19:15 Zephyrus systemd[1]: Stopped ROG Core Daemon.
júl 03 13:19:15 Zephyrus systemd[1]: Started ROG Core Daemon.
júl 03 13:19:15 Zephyrus rog-core[933440]: INFO: Product name: Zephyrus G GU502DU_GA502DU
júl 03 13:19:15 Zephyrus rog-core[933440]: INFO: Board name: GU502DU
júl 03 13:19:15 Zephyrus rog-core[933440]: thread 'main' panicked at 'Unsupported laptop, please request support at
júl 03 13:19:15 Zephyrus rog-core[933440]: https://github.com/flukejones/rog-core', rog-core/src/laptops.rs:89:9
júl 03 13:19:15 Zephyrus rog-core[933440]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
júl 03 13:19:16 Zephyrus systemd[1]: rog-core.service: Main process exited, code=dumped, status=6/ABRT
júl 03 13:19:16 Zephyrus systemd[1]: rog-core.service: Failed with result 'core-dump'.
júl 03 13:19:16 Zephyrus systemd[1]: rog-core.service: Scheduled restart job, restart counter is at 4.
júl 03 13:19:16 Zephyrus systemd[1]: Stopped ROG Core Daemon.
júl 03 13:19:16 Zephyrus systemd[1]: Started ROG Core Daemon.
júl 03 13:19:16 Zephyrus rog-core[933457]: INFO: Product name: Zephyrus G GU502DU_GA502DU
júl 03 13:19:16 Zephyrus rog-core[933457]: INFO: Board name: GU502DU
júl 03 13:19:16 Zephyrus rog-core[933457]: thread 'main' panicked at 'Unsupported laptop, please request support at
júl 03 13:19:16 Zephyrus rog-core[933457]: https://github.com/flukejones/rog-core', rog-core/src/laptops.rs:89:9
júl 03 13:19:16 Zephyrus rog-core[933457]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
júl 03 13:19:17 Zephyrus systemd[1]: rog-core.service: Main process exited, code=dumped, status=6/ABRT
júl 03 13:19:17 Zephyrus systemd[1]: rog-core.service: Failed with result 'core-dump'.
júl 03 13:19:17 Zephyrus systemd[1]: rog-core.service: Scheduled restart job, restart counter is at 5.
júl 03 13:19:17 Zephyrus systemd[1]: Stopped ROG Core Daemon.
júl 03 13:19:17 Zephyrus systemd[1]: rog-core.service: Start request repeated too quickly.
júl 03 13:19:17 Zephyrus systemd[1]: rog-core.service: Failed with result 'core-dump'.
júl 03 13:19:17 Zephyrus systemd[1]: Failed to start ROG Core Daemon.

View File

@@ -0,0 +1,47 @@
003:003:001:DESCRIPTOR 1593775246.732819
05 01 09 02 A1 01 85 02 09 01 A1 00 05 09 19 01
29 10 15 00 25 01 95 10 75 01 81 02 05 01 16 01
F8 26 FF 07 75 0C 95 02 09 30 09 31 81 06 15 81
25 7F 75 08 95 01 09 38 81 06 05 0C 0A 38 02 95
01 81 06 C0 C0 05 0C 09 01 A1 01 85 03 75 10 95
02 15 01 26 8C 02 19 01 2A 8C 02 81 00 C0 05 01
09 80 A1 01 85 04 75 02 95 01 15 01 25 03 09 82
09 81 09 83 81 60 75 06 81 03 C0 06 00 FF 09 01
A1 01 85 10 75 08 95 06 15 00 26 FF 00 09 01 81
00 09 01 91 00 C0 06 00 FF 09 02 A1 01 85 11 75
08 95 13 15 00 26 FF 00 09 02 81 00 09 02 91 00
C0
003:003:000:DESCRIPTOR 1593775246.736060
05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01
75 01 95 08 81 02 81 03 95 05 05 08 19 01 29 05
91 02 95 01 75 03 91 01 95 06 75 08 15 00 26 A4
00 05 07 19 00 2A A4 00 81 00 C0
003:002:002:DESCRIPTOR 1593775246.738826
06 31 FF 09 76 A1 01 85 5A 19 00 2A FF 00 15 00
26 FF 00 75 08 95 05 81 00 19 00 2A FF 00 15 00
26 FF 00 75 08 95 3F B1 00 C0 05 0C 09 01 A1 01
85 02 19 00 2A 3C 02 15 00 26 3C 02 75 10 95 02
81 00 C0 06 31 FF 09 79 A1 01 85 5D 19 00 2A FF
00 15 00 26 FF 00 75 08 95 1F 81 00 19 00 2A FF
00 15 00 26 FF 00 75 08 95 3F 91 00 19 00 2A FF
00 15 00 26 FF 00 75 08 95 3F B1 00 C0 06 31 FF
09 80 A1 01 85 5E 19 00 2A FF 00 15 00 26 FF 00
75 08 95 05 81 00 19 00 2A FF 00 15 00 26 FF 00
75 08 95 3F B1 00 C0
003:002:001:DESCRIPTOR 1593775246.741819
05 01 09 06 A1 01 85 09 75 01 95 08 05 07 19 E0
29 E7 15 00 25 01 81 02 95 08 75 01 81 03 95 05
75 01 05 08 19 01 29 05 91 02 95 01 75 03 91 03
95 F0 75 01 05 07 19 00 29 EF 15 00 25 01 81 02
C0
003:002:000:DESCRIPTOR 1593775246.744821
05 01 09 06 A1 01 85 01 75 01 95 08 05 07 19 E0
29 E7 15 00 25 01 81 02 95 01 75 08 81 03 95 05
75 01 05 08 19 01 29 05 91 02 95 01 75 03 91 03
95 1E 75 08 15 00 26 FF 00 05 07 19 00 2A FF 00
81 00 C0

View File

@@ -1,6 +1,6 @@
[package]
name = "rog-daemon"
version = "0.14.3"
version = "0.14.4"
license = "MPL-2.0"
readme = "README.md"
authors = ["Luke <luke@ljones.dev>"]

View File

@@ -9,7 +9,7 @@ use rog_client::{
};
use std::io::Write;
static VERSION: &str = "0.14.3";
static VERSION: &str = "0.14.4";
#[derive(Options)]
struct CLIStart {

View File

@@ -67,7 +67,7 @@ impl RogCore {
if let Err(err) = dev_handle.set_auto_detach_kernel_driver(true) {
warn!("Auto-detach kernel driver failed: {:?}", err);
let mut fail_count = 10;
let mut fail_count = 5;
while fail_count > 0 {
warn!("Trying device reset");
fail_count -= 1;
@@ -84,7 +84,7 @@ impl RogCore {
if let Err(err) = dev_handle.claim_interface(interface) {
warn!("Could not claim keyboard device interface: {:?}", err);
let mut fail_count = 10;
let mut fail_count = 5;
while fail_count > 0 {
warn!("Sleeping");
fail_count -= 1;