Complete rename
1
.github/FUNDING.yml
vendored
@@ -1 +0,0 @@
|
||||
patreon: lukenukem
|
||||
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,35 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: flukejones
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behaviour:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Please provide the following:**
|
||||
- Distro:
|
||||
- Kernel (`uname -r`):
|
||||
- `cat /sys/class/dmi/id/product_name`:
|
||||
- `cat /sys/class/dmi/id/product_family`:
|
||||
- `cat /sys/class/dmi/id/board_name`:
|
||||
- `lsusb |grep 0b05`
|
||||
+ `sudo lsusb -vd 0b05:<all devices from above> > ~/laptop_info`, and attach to issue.
|
||||
- `sudo journalctl -b --unit rog-core > rog-core.log` and attach to issue.
|
||||
- `sudo usbhid-dump > usbhid.log` and attach to issue.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
78
.github/workflows/rust.yml
vendored
@@ -1,78 +0,0 @@
|
||||
on: [push, pull_request]
|
||||
|
||||
name: Rust
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install deps
|
||||
run: sudo apt-get install libusb-1.0-0-dev libdbus-1-dev llvm libclang-dev
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install stable toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Run cargo check
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
|
||||
test:
|
||||
name: Test Suite
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install deps
|
||||
run: sudo apt-get install libusb-1.0-0-dev libdbus-1-dev llvm libclang-dev
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install stable toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Run cargo test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
|
||||
lints:
|
||||
name: Lints
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install deps
|
||||
run: sudo apt-get install libusb-1.0-0-dev libdbus-1-dev llvm libclang-dev
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install stable toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Run cargo fmt
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --all -- --check
|
||||
|
||||
- name: Run cargo clippy
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
args: -- -D warnings
|
||||
2
.idea/.gitignore
generated
vendored
@@ -1,2 +0,0 @@
|
||||
# Default ignored files
|
||||
/workspace.xml
|
||||
10
.idea/dictionaries/luke.xml
generated
@@ -1,10 +0,0 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="luke">
|
||||
<words>
|
||||
<w>backlight</w>
|
||||
<w>dbus</w>
|
||||
<w>hotkey</w>
|
||||
<w>rogcore</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
8
.idea/modules.xml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/rog-core.iml" filepath="$PROJECT_DIR$/.idea/rog-core.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
28
.idea/rog-core.iml
generated
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="CPP_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/examples" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/benches" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/rog-core/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/rog-core/examples" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/rog-core/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/rog-core/benches" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/rog-lib/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/rog-lib/examples" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/rog-lib/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/rog-lib/benches" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/aura/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/aura/examples" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/rog-client/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/rog-client/examples" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/rog-core/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/rog-lib/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
6
.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
68
Cargo.lock
generated
@@ -15,6 +15,40 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "asus-nb"
|
||||
version = "0.15.0"
|
||||
dependencies = [
|
||||
"dbus",
|
||||
"gumdrop",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"tinybmp",
|
||||
"yansi-term",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "asus-nb-ctrl"
|
||||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"asus-nb",
|
||||
"async-trait",
|
||||
"dbus",
|
||||
"dbus-tokio",
|
||||
"env_logger",
|
||||
"gumdrop",
|
||||
"intel-pstate",
|
||||
"log",
|
||||
"rusb",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sysfs-class",
|
||||
"tokio",
|
||||
"udev",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.36"
|
||||
@@ -639,40 +673,6 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
|
||||
|
||||
[[package]]
|
||||
name = "rog-client"
|
||||
version = "0.15.0"
|
||||
dependencies = [
|
||||
"dbus",
|
||||
"gumdrop",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"tinybmp",
|
||||
"yansi-term",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rog-daemon"
|
||||
version = "0.15.3"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"dbus",
|
||||
"dbus-tokio",
|
||||
"env_logger",
|
||||
"gumdrop",
|
||||
"intel-pstate",
|
||||
"log",
|
||||
"rog-client",
|
||||
"rusb",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sysfs-class",
|
||||
"tokio",
|
||||
"udev",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rusb"
|
||||
version = "0.6.0"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[workspace]
|
||||
members = ["rog-core", "rog-client"]
|
||||
members = ["asus-nb-ctrl", "asus-nb"]
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
@@ -12,6 +12,5 @@ debug = false
|
||||
opt-level = 1
|
||||
|
||||
[profile.bench]
|
||||
lto = true
|
||||
debug = false
|
||||
opt-level = 3
|
||||
25
Makefile
@@ -11,7 +11,8 @@ SRC = Cargo.toml Cargo.lock Makefile $(shell find -type f -wholename '**/src/*.r
|
||||
|
||||
.PHONY: all clean distclean install uninstall update
|
||||
|
||||
BIN=rog-core
|
||||
BIN_C=asusctl
|
||||
BIN_D=asusd
|
||||
|
||||
DEBUG ?= 0
|
||||
ifeq ($(DEBUG),0)
|
||||
@@ -24,7 +25,7 @@ ifeq ($(VENDORED),1)
|
||||
ARGS += "--frozen"
|
||||
endif
|
||||
|
||||
all: target/release/$(BIN)
|
||||
all: target/release/$(BIN_D)
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
@@ -33,16 +34,18 @@ distclean:
|
||||
rm -rf .cargo vendor vendor.tar.xz
|
||||
|
||||
install: all
|
||||
install -D -m 0755 "target/release/$(BIN)" "$(DESTDIR)$(bindir)/$(BIN)"
|
||||
install -D -m 0644 "data/$(BIN).rules" "$(DESTDIR)/lib/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)/lib/systemd/system/$(BIN).service"
|
||||
install -D -m 0755 "target/release/$(BIN_C)" "$(DESTDIR)$(bindir)/$(BIN_C)"
|
||||
install -D -m 0755 "target/release/$(BIN_D)" "$(DESTDIR)$(bindir)/$(BIN_D)"
|
||||
install -D -m 0644 "data/$(BIN_D).rules" "$(DESTDIR)/lib/udev/rules.d/99-$(BIN_D).rules"
|
||||
install -D -m 0644 "data/$(BIN_D).conf" "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN_D).conf"
|
||||
install -D -m 0644 "data/$(BIN_D).service" "$(DESTDIR)/lib/systemd/system/$(BIN_D).service"
|
||||
|
||||
uninstall:
|
||||
rm -f "$(DESTDIR)$(bindir)/$(BIN)"
|
||||
rm -f "$(DESTDIR)/lib/udev/rules.d/99-$(BIN).rules"
|
||||
rm -f "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN).conf"
|
||||
rm -f "$(DESTDIR)/lib/systemd/system/$(BIN).service"
|
||||
rm -f "$(DESTDIR)$(bindir)/$(BIN_C)"
|
||||
rm -f "$(DESTDIR)$(bindir)/$(BIN_D)"
|
||||
rm -f "$(DESTDIR)/lib/udev/rules.d/99-$(BIN_D).rules"
|
||||
rm -f "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN_D).conf"
|
||||
rm -f "$(DESTDIR)/lib/systemd/system/$(BIN_D).service"
|
||||
|
||||
update:
|
||||
cargo update
|
||||
@@ -54,7 +57,7 @@ vendor:
|
||||
tar pcfJ vendor.tar.xz vendor
|
||||
rm -rf vendor
|
||||
|
||||
target/release/$(BIN): $(SRC)
|
||||
target/release/$(BIN_D): $(SRC)
|
||||
ifeq ($(VENDORED),1)
|
||||
tar pxf vendor.tar.xz
|
||||
endif
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
[package]
|
||||
name = "rog-daemon"
|
||||
version = "0.15.3"
|
||||
name = "asus-nb-ctrl"
|
||||
version = "1.0.0"
|
||||
license = "MPL-2.0"
|
||||
readme = "README.md"
|
||||
authors = ["Luke <luke@ljones.dev>"]
|
||||
repository = "https://github.com/flukejones/rog-core"
|
||||
homepage = "https://github.com/flukejones/rog-core"
|
||||
repository = "https://gitlab.com/asus-linux/asus-nb-ctrl"
|
||||
homepage = "https://gitlab.com/asus-linux/asus-nb-ctrl"
|
||||
description = "A daemon app for ASUS GX502 and similar laptops to control missing features"
|
||||
edition = "2018"
|
||||
|
||||
@@ -14,11 +14,15 @@ name = "daemon"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "rog-core"
|
||||
name = "asusctl"
|
||||
path = "src/main.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "asusd"
|
||||
path = "src/daemon.rs"
|
||||
|
||||
[dependencies]
|
||||
rog-client = { path = "../rog-client" }
|
||||
asus-nb = { path = "../asus-nb" }
|
||||
rusb = "^0.6.0"
|
||||
udev = "^0.4.0"
|
||||
async-trait = "0.1.36"
|
||||
@@ -1,9 +1,9 @@
|
||||
use rog_client::aura_modes::AuraModes;
|
||||
use asus_nb::aura_modes::AuraModes;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::{Read, Write};
|
||||
|
||||
pub static CONFIG_PATH: &str = "/etc/rogcore.conf";
|
||||
pub static CONFIG_PATH: &str = "/etc/asusd.conf";
|
||||
|
||||
#[derive(Default, Deserialize, Serialize)]
|
||||
pub struct Config {
|
||||
@@ -11,7 +11,7 @@ const SET: u8 = 0xc4;
|
||||
|
||||
use crate::config::Config;
|
||||
use log::{error, info, warn};
|
||||
use rog_client::error::AuraError;
|
||||
use asus_nb::error::AuraError;
|
||||
use rusb::{Device, DeviceHandle};
|
||||
use std::error::Error;
|
||||
use std::sync::Arc;
|
||||
@@ -47,7 +47,7 @@ impl crate::Controller for CtrlCharge {
|
||||
}
|
||||
|
||||
impl CtrlCharge {
|
||||
pub(super) fn new() -> Result<Self, Box<dyn Error>> {
|
||||
pub fn new() -> Result<Self, Box<dyn Error>> {
|
||||
let path = CtrlCharge::get_battery_path()?;
|
||||
info!("Device has battery charge threshold control");
|
||||
Ok(CtrlCharge { path })
|
||||
@@ -71,7 +71,7 @@ impl crate::Controller for CtrlFanAndCPU {
|
||||
}
|
||||
|
||||
impl CtrlFanAndCPU {
|
||||
pub(super) fn new() -> Result<Self, Box<dyn Error>> {
|
||||
pub fn new() -> Result<Self, Box<dyn Error>> {
|
||||
let path = CtrlFanAndCPU::get_fan_path()?;
|
||||
info!("Device has thermal throttle control");
|
||||
Ok(CtrlFanAndCPU { path })
|
||||
@@ -5,7 +5,7 @@ static LED_SET: [u8; 17] = [0x5d, 0xb5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
use crate::{config::Config, error::RogError};
|
||||
use dbus::{channel::Sender, nonblock::SyncConnection, tree::Signal};
|
||||
use log::{info, warn};
|
||||
use rog_client::{
|
||||
use asus_nb::{
|
||||
aura_brightness_bytes, aura_modes::AuraModes, fancy::KeyColourArray, DBUS_IFACE, DBUS_PATH,
|
||||
LED_MSG_LEN,
|
||||
};
|
||||
@@ -1,17 +1,33 @@
|
||||
use crate::{
|
||||
use daemon::{
|
||||
config::Config, ctrl_anime::CtrlAnimeDisplay, ctrl_charge::CtrlCharge, ctrl_fan_cpu::CtrlFanAndCPU,
|
||||
ctrl_leds::CtrlKbdBacklight, dbus::dbus_create_tree, laptops::match_laptop,
|
||||
};
|
||||
|
||||
use dbus::{channel::Sender, nonblock::SyncConnection, tree::Signal};
|
||||
|
||||
use crate::Controller;
|
||||
use daemon::Controller;
|
||||
use dbus_tokio::connection;
|
||||
use log::{error, warn};
|
||||
use rog_client::{DBUS_IFACE, DBUS_NAME, DBUS_PATH};
|
||||
use log::{error, warn, info};
|
||||
use asus_nb::{DBUS_IFACE, DBUS_NAME, DBUS_PATH};
|
||||
use std::error::Error;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::Mutex;
|
||||
use std::io::Write;
|
||||
use log::LevelFilter;
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut logger = env_logger::Builder::new();
|
||||
logger
|
||||
.target(env_logger::Target::Stdout)
|
||||
.format(|buf, record| writeln!(buf, "{}: {}", record.level(), record.args()))
|
||||
.filter(None, LevelFilter::Info)
|
||||
.init();
|
||||
|
||||
info!("Version: {}", daemon::VERSION);
|
||||
start_daemon().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Timing is such that:
|
||||
// - interrupt write is minimum 1ms (sometimes lower)
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::config::Config;
|
||||
use dbus::tree::{Factory, MTSync, Method, MethodErr, Signal, Tree};
|
||||
use log::warn;
|
||||
use rog_client::{aura_modes::AuraModes, DBUS_IFACE, DBUS_PATH};
|
||||
use asus_nb::{aura_modes::AuraModes, DBUS_IFACE, DBUS_PATH};
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::{
|
||||
mpsc::{channel, Receiver, Sender},
|
||||
@@ -171,7 +171,7 @@ fn set_charge_limit(sender: Mutex<Sender<u8>>) -> Method<MTSync, ()> {
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub(super) fn dbus_create_tree(
|
||||
pub fn dbus_create_tree(
|
||||
config: Arc<Mutex<Config>>,
|
||||
) -> (
|
||||
Tree<MTSync, ()>,
|
||||
@@ -1,12 +1,12 @@
|
||||
use log::{info, warn};
|
||||
use rog_client::aura_modes::{
|
||||
use asus_nb::aura_modes::{
|
||||
AuraModes, BREATHING, COMET, FLASH, HIGHLIGHT, LASER, MULTISTATIC, PULSE, RAIN, RAINBOW, RGB,
|
||||
RIPPLE, SINGLE, STAR, STROBE,
|
||||
};
|
||||
|
||||
static HELP_ADDRESS: &str = "https://github.com/flukejones/rog-core";
|
||||
static HELP_ADDRESS: &str = "https://gitlab.com/asus-linux/asus-nb-ctrl";
|
||||
|
||||
pub(crate) fn match_laptop() -> LaptopBase {
|
||||
pub fn match_laptop() -> LaptopBase {
|
||||
for device in rusb::devices().unwrap().iter() {
|
||||
let device_desc = device.device_descriptor().unwrap();
|
||||
if device_desc.vendor_id() == 0x0b05 {
|
||||
@@ -107,16 +107,16 @@ fn select_1866_device(prod: String) -> LaptopBase {
|
||||
laptop
|
||||
}
|
||||
|
||||
pub(super) struct LaptopBase {
|
||||
pub struct LaptopBase {
|
||||
usb_product: String,
|
||||
supported_modes: Vec<u8>,
|
||||
}
|
||||
|
||||
impl LaptopBase {
|
||||
pub(super) fn usb_product(&self) -> &str {
|
||||
pub fn usb_product(&self) -> &str {
|
||||
&self.usb_product
|
||||
}
|
||||
pub(super) fn supported_modes(&self) -> &[u8] {
|
||||
pub fn supported_modes(&self) -> &[u8] {
|
||||
&self.supported_modes
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,18 @@
|
||||
#![deny(unused_must_use)]
|
||||
/// Configuration loading, saving
|
||||
mod config;
|
||||
pub mod config;
|
||||
///
|
||||
mod ctrl_anime;
|
||||
pub mod ctrl_anime;
|
||||
///
|
||||
mod ctrl_charge;
|
||||
pub mod ctrl_charge;
|
||||
///
|
||||
pub mod ctrl_fan_cpu;
|
||||
///
|
||||
mod ctrl_leds;
|
||||
/// Start the daemon loop
|
||||
pub mod daemon;
|
||||
pub mod ctrl_leds;
|
||||
///
|
||||
mod dbus;
|
||||
pub mod dbus;
|
||||
/// Laptop matching to determine capabilities
|
||||
mod laptops;
|
||||
pub mod laptops;
|
||||
|
||||
mod error;
|
||||
|
||||
@@ -25,6 +23,8 @@ use std::sync::Arc;
|
||||
use tokio::sync::{mpsc::Receiver, Mutex};
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
pub static VERSION: &str = "1.0.0";
|
||||
|
||||
use ::dbus::{nonblock::SyncConnection, tree::Signal};
|
||||
|
||||
#[async_trait]
|
||||
@@ -1,24 +1,18 @@
|
||||
use daemon::ctrl_fan_cpu::FanLevel;
|
||||
use daemon::daemon::start_daemon;
|
||||
use gumdrop::Options;
|
||||
use log::info;
|
||||
use log::LevelFilter;
|
||||
use rog_client::{
|
||||
use asus_nb::{
|
||||
cli_options::{LedBrightness, SetAuraBuiltin},
|
||||
core_dbus::AuraDbusWriter,
|
||||
};
|
||||
use std::io::Write;
|
||||
|
||||
static VERSION: &str = "0.15.3";
|
||||
|
||||
#[derive(Options)]
|
||||
struct CLIStart {
|
||||
#[options(help = "print help message")]
|
||||
help: bool,
|
||||
#[options(help = "show program version number")]
|
||||
version: bool,
|
||||
#[options(help = "start daemon")]
|
||||
daemon: bool,
|
||||
#[options(meta = "VAL", help = "<off, low, med, high>")]
|
||||
bright: Option<LedBrightness>,
|
||||
#[options(meta = "FAN", help = "<silent, normal, boost>")]
|
||||
@@ -53,12 +47,9 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.init();
|
||||
|
||||
let parsed = CLIStart::parse_args_default_or_exit();
|
||||
if parsed.daemon {
|
||||
info!("Version: {}", VERSION);
|
||||
start_daemon().await?;
|
||||
}
|
||||
|
||||
if parsed.version {
|
||||
println!("Version: {}", VERSION);
|
||||
println!("Version: {}", daemon::VERSION);
|
||||
}
|
||||
|
||||
let writer = AuraDbusWriter::new()?;
|
||||
@@ -1,11 +1,11 @@
|
||||
[package]
|
||||
name = "rog-client"
|
||||
name = "asus-nb"
|
||||
version = "0.15.0"
|
||||
license = "MPL-2.0"
|
||||
readme = "README.md"
|
||||
authors = ["Luke <luke@ljones.dev>"]
|
||||
repository = "https://github.com/flukejones/rog-core"
|
||||
homepage = "https://github.com/flukejones/rog-core"
|
||||
repository = "https://gitlab.com/asus-linux/asus-nb-ctrl"
|
||||
homepage = "https://gitlab.com/asus-linux/asus-nb-ctrl"
|
||||
description = "A small library of effect types and conversions for ROG Aura"
|
||||
edition = "2018"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use rog_client::anime_dbus::AniMeDbusWriter;
|
||||
use rog_client::anime_matrix::{AniMeMatrix, AniMePacketType, HEIGHT, WIDTH};
|
||||
use asus_nb::anime_dbus::AniMeDbusWriter;
|
||||
use asus_nb::anime_matrix::{AniMeMatrix, AniMePacketType, HEIGHT, WIDTH};
|
||||
use tinybmp::{Bmp, Pixel};
|
||||
|
||||
fn main() {
|
||||
@@ -15,12 +15,10 @@ fn main() {
|
||||
|
||||
// Aligned left
|
||||
for px in pixels {
|
||||
if (px.x as usize / 2) < WIDTH && (px.y as usize) < HEIGHT {
|
||||
if px.x % 2 == 0 {
|
||||
if (px.x as usize / 2) < WIDTH && (px.y as usize) < HEIGHT && px.x % 2 == 0 {
|
||||
matrix.get_mut()[px.y as usize][px.x as usize / 2] = px.color as u8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Throw an alignment border up
|
||||
// {
|
||||
@@ -1,4 +1,4 @@
|
||||
use rog_client::{
|
||||
use asus_nb::{
|
||||
core_dbus::AuraDbusWriter,
|
||||
fancy::{GX502Layout, Key, KeyColourArray, KeyLayout},
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
use rog_client::{
|
||||
use asus_nb::{
|
||||
core_dbus::AuraDbusWriter,
|
||||
fancy::{GX502Layout, KeyColourArray, KeyLayout},
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
use rog_client::{
|
||||
use asus_nb::{
|
||||
core_dbus::AuraDbusWriter,
|
||||
fancy::{GX502Layout, Key, KeyColourArray, KeyLayout},
|
||||
};
|
||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@@ -1,4 +1,4 @@
|
||||
use rog_client::{
|
||||
use asus_nb::{
|
||||
core_dbus::AuraDbusWriter,
|
||||
fancy::{Key, KeyColourArray},
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
use rog_client::{
|
||||
use asus_nb::{
|
||||
core_dbus::AuraDbusWriter,
|
||||
fancy::{GX502Layout, KeyColourArray, KeyLayout},
|
||||
};
|
||||
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
@@ -1,6 +1,6 @@
|
||||
pub static DBUS_NAME: &str = "org.rogcore.Daemon";
|
||||
pub static DBUS_PATH: &str = "/org/rogcore/Daemon";
|
||||
pub static DBUS_IFACE: &str = "org.rogcore.Daemon";
|
||||
pub static DBUS_NAME: &str = "org.asus-linux.Daemon";
|
||||
pub static DBUS_PATH: &str = "/org/asus-linux/Daemon";
|
||||
pub static DBUS_IFACE: &str = "org.asus-linux.Daemon";
|
||||
pub const LED_MSG_LEN: usize = 17;
|
||||
|
||||
pub mod aura_modes;
|
||||
22
data/asusd.conf
Normal file
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE busconfig PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<policy group="adm">
|
||||
<allow send_destination="org.asus-linux.Daemon"/>
|
||||
<allow receive_sender="org.asus-linux.Daemon"/>
|
||||
</policy>
|
||||
<policy group="sudo">
|
||||
<allow send_destination="org.asus-linux.Daemon"/>
|
||||
<allow receive_sender="org.asus-linux.Daemon"/>
|
||||
</policy>
|
||||
<policy group="wheel">
|
||||
<allow send_destination="org.asus-linux.Daemon"/>
|
||||
<allow receive_sender="org.asus-linux.Daemon"/>
|
||||
</policy>
|
||||
<policy user="root">
|
||||
<allow own="org.asus-linux.Daemon"/>
|
||||
<allow send_destination="org.asus-linux.Daemon"/>
|
||||
<allow receive_sender="org.asus-linux.Daemon"/>
|
||||
</policy>
|
||||
</busconfig>
|
||||
@@ -1 +1 @@
|
||||
ACTION=="add|change", SUBSYSTEM=="input", ENV{ID_VENDOR_ID}=="0b05", ENV{ID_MODEL_ID}=="18[0-9][0-9]", ENV{ID_TYPE}=="hid", TAG+="systemd", ENV{SYSTEMD_WANTS}="rog-core.service"
|
||||
ACTION=="add|change", SUBSYSTEM=="input", ENV{ID_VENDOR_ID}=="0b05", ENV{ID_MODEL_ID}=="18[0-9][0-9]", ENV{ID_TYPE}=="hid", TAG+="systemd", ENV{SYSTEMD_WANTS}="asusd.service"
|
||||
8
data/asusd.service
Normal file
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=ASUS Notebook Control
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/asusd
|
||||
Restart=on-failure
|
||||
Type=dbus
|
||||
BusName=org.asus-linux.Daemon
|
||||
@@ -1,22 +0,0 @@
|
||||
<!DOCTYPE busconfig PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<policy group="adm">
|
||||
<allow send_destination="org.rogcore.Daemon"/>
|
||||
<allow receive_sender="org.rogcore.Daemon"/>
|
||||
</policy>
|
||||
<policy group="sudo">
|
||||
<allow send_destination="org.rogcore.Daemon"/>
|
||||
<allow receive_sender="org.rogcore.Daemon"/>
|
||||
</policy>
|
||||
<policy group="wheel">
|
||||
<allow send_destination="org.rogcore.Daemon"/>
|
||||
<allow receive_sender="org.rogcore.Daemon"/>
|
||||
</policy>
|
||||
<policy user="root">
|
||||
<allow own="org.rogcore.Daemon"/>
|
||||
<allow send_destination="org.rogcore.Daemon"/>
|
||||
<allow receive_sender="org.rogcore.Daemon"/>
|
||||
</policy>
|
||||
</busconfig>
|
||||
@@ -1,8 +0,0 @@
|
||||
[Unit]
|
||||
Description=ROG Core Daemon
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/rog-core -d
|
||||
Restart=on-failure
|
||||
Type=dbus
|
||||
BusName=org.rogcore.Daemon
|
||||