Small fixxes to functionality

- Fixed return of rog-core in client mode
- Fixed writing of customised builtin LED modes
This commit is contained in:
Luke
2020-05-04 15:33:41 +12:00
parent a0d256cbef
commit 62a613a312
9 changed files with 36 additions and 25 deletions

View File

@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [0.9.3] - 2020-05-04
### Changed
- Fixed return of rog-core in client mode
- Fixed writing of customised builtin LED modes
## [0.9.2] - 2020-05-04 ## [0.9.2] - 2020-05-04
### Added ### Added
- Begin keeping a Changelog - Begin keeping a Changelog

16
Cargo.lock generated
View File

@@ -489,9 +489,9 @@ checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.6.21" version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fuchsia-zircon", "fuchsia-zircon",
@@ -520,9 +520,9 @@ dependencies = [
[[package]] [[package]]
name = "net2" name = "net2"
version = "0.2.33" version = "0.2.34"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
@@ -613,9 +613,9 @@ checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.10" version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" checksum = "8872cf6f48eee44265156c111456a700ab3483686b3f96df4cf5481c89157319"
dependencies = [ dependencies = [
"unicode-xid", "unicode-xid",
] ]
@@ -667,7 +667,7 @@ checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
[[package]] [[package]]
name = "rog-aura" name = "rog-aura"
version = "0.9.0" version = "0.9.1"
dependencies = [ dependencies = [
"dbus", "dbus",
"gumdrop", "gumdrop",
@@ -678,7 +678,7 @@ dependencies = [
[[package]] [[package]]
name = "rog-daemon" name = "rog-daemon"
version = "0.9.2" version = "0.9.3"
dependencies = [ dependencies = [
"dbus", "dbus",
"dbus-tokio", "dbus-tokio",

View File

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

View File

@@ -36,7 +36,6 @@ impl AuraDbusWriter {
if let Ok(stop) = msg.read1::<bool>() { if let Ok(stop) = msg.read1::<bool>() {
if stop { if stop {
if let Ok(mut lock) = stopper.lock() { if let Ok(mut lock) = stopper.lock() {
println!("SHOULD STOP");
*lock = true; *lock = true;
} }
} }
@@ -77,7 +76,7 @@ impl AuraDbusWriter {
thread::sleep(Duration::from_millis(self.block_time)); thread::sleep(Duration::from_millis(self.block_time));
if let Ok(lock) = self.stop.try_lock() { if let Ok(lock) = self.stop.try_lock() {
if *lock { if *lock {
panic!("Stopping!"); panic!("Go signal to stop!");
} }
} }
Ok(()) Ok(())

2
debian/changelog vendored
View File

@@ -1,4 +1,4 @@
rog-core (0.9.2) UNRELEASED; urgency=medium rog-core (0.9.2) focal; urgency=medium
* Internal fixes to prevent deadlocks on mutexes * Internal fixes to prevent deadlocks on mutexes

View File

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

View File

@@ -414,7 +414,7 @@ where
}; };
self.set_builtin(config, idx_next).await?; self.set_builtin(config, idx_next).await?;
} }
AuraCommand::WriteBytes(bytes) => self.write_bytes(&bytes).await?, AuraCommand::WriteBytes(bytes) => self.set_and_save(&bytes, config).await?,
AuraCommand::WriteEffect(effect) => self.write_effect(effect).await?, AuraCommand::WriteEffect(effect) => self.write_effect(effect).await?,
AuraCommand::ReloadLast => self.reload_last_builtin(&config).await?, AuraCommand::ReloadLast => self.reload_last_builtin(&config).await?,
} }
@@ -426,7 +426,7 @@ where
match unsafe { self.handle.as_ref() }.write_interrupt( match unsafe { self.handle.as_ref() }.write_interrupt(
self.led_endpoint, self.led_endpoint,
message, message,
Duration::from_millis(2), Duration::from_millis(5),
) { ) {
Ok(_) => {} Ok(_) => {}
Err(err) => match err { Err(err) => match err {

View File

@@ -128,7 +128,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
} else { } else {
if let Ok(mut lock) = input.try_lock() { if let Ok(mut lock) = input.try_lock() {
if let Some(bytes) = lock.take() { if let Some(bytes) = lock.take() {
if bytes.len() > 8 { if bytes.len() > 0 {
let mut config = config.lock().await; let mut config = config.lock().await;
led_writer led_writer
.do_command(AuraCommand::WriteBytes(bytes), &mut config) .do_command(AuraCommand::WriteBytes(bytes), &mut config)
@@ -148,11 +148,11 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
// Write a colour block // Write a colour block
if let Ok(mut effect_lock) = effect.try_lock() { if let Ok(mut effect_lock) = effect.try_lock() {
// Spawn a writer // Spawn a writer
if let Some(stuff) = effect_lock.take() { if let Some(effect) = effect_lock.take() {
if stuff.len() == 10 { if effect.len() == 10 {
let mut config = config.lock().await; let mut config = config.lock().await;
led_writer led_writer
.do_command(AuraCommand::WriteEffect(stuff), &mut config) .do_command(AuraCommand::WriteEffect(effect), &mut config)
.await .await
.map_err(|err| warn!("{:?}", err)) .map_err(|err| warn!("{:?}", err))
.unwrap(); .unwrap();

View File

@@ -7,7 +7,7 @@ use rog_aura::{
AuraDbusWriter, LED_MSG_LEN, AuraDbusWriter, LED_MSG_LEN,
}; };
static VERSION: &'static str = "0.9.2"; static VERSION: &'static str = "0.9.3";
#[derive(Debug, Options)] #[derive(Debug, Options)]
struct CLIStart { struct CLIStart {
@@ -64,17 +64,24 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
SetAuraBuiltin::MultiStatic(_) => { SetAuraBuiltin::MultiStatic(_) => {
let byte_arr = <[[u8; LED_MSG_LEN]; 4]>::from(command); let byte_arr = <[[u8; LED_MSG_LEN]; 4]>::from(command);
for arr in byte_arr.iter() { for arr in byte_arr.iter() {
writer.write_bytes(arr)?; match writer.write_bytes(arr) {
Ok(msg) => println!("Response: {}", msg),
Err(err) => println!("Error: {}", err),
}
} }
} }
_ => { _ => match writer.write_builtin_mode(&command) {
writer.write_builtin_mode(&command)?; Ok(msg) => println!("Response: {}", msg),
} Err(err) => println!("Error: {}", err),
},
} }
} }
} }
if let Some(brightness) = parsed.bright { if let Some(brightness) = parsed.bright {
writer.write_brightness(brightness.level())?; match writer.write_brightness(brightness.level()) {
Ok(msg) => println!("Response: {}", msg),
Err(err) => println!("Error: {}", err),
}
} }
Ok(()) Ok(())
} }