Better settings, save proper defaults, check supported modes

This commit is contained in:
Luke
2020-04-17 21:41:12 +12:00
parent e1d2e913c5
commit a8a97bcece
13 changed files with 382 additions and 303 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "rog-core"
version = "0.3.1"
version = "0.3.2"
authors = ["Luke <luke@ljones.dev>"]
edition = "2018"

View File

@@ -46,8 +46,10 @@ impl Daemon {
let bytes: Vec<u8> = m.msg.read1()?;
let s = format!("Wrote {:x?}", bytes);
let supported =
unsafe { (*daemon.as_ptr()).hotkeys.supported_modes() };
let mut daemon = daemon.borrow_mut();
match daemon.rogcore.aura_set_and_save(&bytes[..]) {
match daemon.rogcore.aura_set_and_save(&bytes[..], supported) {
Ok(_) => {
let mret = m.msg.method_return().append1(s);
Ok(vec![mret])
@@ -71,18 +73,8 @@ impl Daemon {
connection.process(Duration::from_millis(1))?;
// READ KEYBOARD
// TODO: this needs to move to a thread, but there is unsafety
match daemon.borrow_mut().rogcore.poll_keyboard(&mut key_buf) {
Ok(read) => {
// [5a, c4, ; 32 bytes long] fn+up
// [5a, c5, ; 32 bytes long] fn+down
// [5a, b2, ; 32 bytes long] fn+left
// [5a, b3, ; 32 bytes long] fn+right
// To handle keys for aura:
// read config + inc/dec brightness byte
// write to aura
// write config
let hotkeys = unsafe { &mut (*daemon.as_ptr()).hotkeys };
let mut rogcore = unsafe { &mut (*daemon.as_ptr()).rogcore };

View File

@@ -5,8 +5,10 @@ use crate::daemon::*;
use dbus::Error as DbusError;
use dbus::{ffidisp::Connection, Message};
use gumdrop::Options;
use rog_lib::aura::*;
use rog_lib::core::{LedBrightness, RogCore, LED_MSG_LEN};
use rog_lib::{
cli_options::SetAuraBuiltin,
core::{LedBrightness, RogCore, LED_MSG_LEN},
};
pub static DBUS_NAME: &'static str = "org.rogcore.Daemon";
pub static DBUS_PATH: &'static str = "/org/rogcore/Daemon";