diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 9b9cbe41..8a97e6d6 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -3,7 +3,7 @@ name: Release build on: push: branches: - - 'arm64' + - 'fix/flex-config-apply' tags: - 'v0.*' - 'v1.*' diff --git a/Cargo.lock b/Cargo.lock index 2dfff3f3..e8a53b68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,9 +35,9 @@ checksum = "3c07dab4369547dbe5114677b33fbbf724971019f3818172d59a97a61c774ffd" [[package]] name = "async-trait" -version = "0.1.53" +version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600" +checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" dependencies = [ "proc-macro2", "quote", @@ -465,9 +465,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.18" +version = "0.14.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" +checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f" dependencies = [ "bytes", "futures-channel", @@ -580,7 +580,7 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "minidsp" -version = "0.1.6" +version = "0.1.7" dependencies = [ "anyhow", "assert_approx_eq", @@ -614,7 +614,7 @@ dependencies = [ "tokio", "tokio-stream", "tokio-tungstenite", - "tokio-util 0.7.2", + "tokio-util", "tower", "url2", "urlencoding", @@ -623,7 +623,7 @@ dependencies = [ [[package]] name = "minidsp-daemon" -version = "0.1.6" +version = "0.1.7" dependencies = [ "anyhow", "bytes", @@ -652,13 +652,13 @@ dependencies = [ "thiserror", "tokio", "tokio-stream", - "tokio-util 0.7.2", + "tokio-util", "url2", ] [[package]] name = "minidsp-devtools" -version = "0.1.6" +version = "0.1.7" dependencies = [ "Inflector", "anyhow", @@ -674,12 +674,12 @@ dependencies = [ "strong-xml", "termcolor 1.1.3", "tokio", - "tokio-util 0.7.2", + "tokio-util", ] [[package]] name = "minidsp-protocol" -version = "0.1.6" +version = "0.1.7" dependencies = [ "anyhow", "bytes", @@ -1126,13 +1126,13 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.92" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52" +checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -1196,9 +1196,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.18.2" +version = "1.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4903bf0427cf68dddd5aa6a93220756f8be0c34fcfa9f5e6191e103e15a31395" +checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439" dependencies = [ "bytes", "libc", @@ -1225,14 +1225,14 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" +checksum = "df54d54117d6fdc4e4fea40fe1e4e566b3505700e148a6827e59b34b0d2600d9" dependencies = [ "futures-core", "pin-project-lite", "tokio", - "tokio-util 0.6.9", + "tokio-util", ] [[package]] @@ -1249,23 +1249,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.6.9" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f988a1a1adc2fb21f9c12aa96441da33a1728193ae0b95d2be22dbd17fcb4e5c" +checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" dependencies = [ "bytes", "futures-core", @@ -1321,21 +1307,9 @@ dependencies = [ "cfg-if 1.0.0", "log", "pin-project-lite", - "tracing-attributes", "tracing-core", ] -[[package]] -name = "tracing-attributes" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tracing-core" version = "0.1.26" @@ -1397,12 +1371,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-xid" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" - [[package]] name = "url" version = "2.2.2" diff --git a/daemon/Cargo.toml b/daemon/Cargo.toml index c4220548..4d9614b2 100644 --- a/daemon/Cargo.toml +++ b/daemon/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Mathieu Rene "] edition = "2021" name = "minidsp-daemon" -version = "0.1.6" +version = "0.1.7" license = "Apache-2.0" description = "A control interface for some MiniDSP products" repository = "https://github.com/mrene/minidsp-rs" @@ -23,7 +23,7 @@ env_logger = "0.9.0" futures = "0.3.21" futures-sink = "0.3.21" futures-util = "0.3.21" -hyper = "0.14.18" +hyper = "0.14.19" hyper-tungstenite = "0.8.0" lazy_static = "1.4.0" log = "0.4.17" @@ -38,16 +38,16 @@ serde_json = "1.0.81" strum = { version = "0.24.0", features = ["derive"], optional = true } termcolor = "1.1.3" thiserror = "1.0.31" -tokio-stream = { version = "0.1.8", features = ["sync"] } +tokio-stream = { version = "0.1.9", features = ["sync"] } url2 = "0.0.6" [dependencies.tokio] features = ["rt-multi-thread", "net", "fs", "macros", "io-util"] -version = "1.18.2" +version = "1.19.2" [dependencies.tokio-util] features = ["net", "codec", "io"] -version = "0.7.2" +version = "0.7.3" [target.'cfg(target_family="unix")'.dependencies] hyperlocal = "0.8.0" diff --git a/devtools/Cargo.toml b/devtools/Cargo.toml index 855dc054..78ba6762 100644 --- a/devtools/Cargo.toml +++ b/devtools/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Mathieu Rene "] edition = "2021" name = "minidsp-devtools" -version = "0.1.6" +version = "0.1.7" license = "Apache-2.0" [features] @@ -29,8 +29,8 @@ quote = "1.0.18" [dependencies.tokio] features = ["rt-multi-thread", "net", "fs", "macros", "io-util"] -version = "1.18.2" +version = "1.19.2" [dependencies.tokio-util] features = ["net", "codec", "io"] -version = "0.7.2" +version = "0.7.3" diff --git a/minidsp/Cargo.toml b/minidsp/Cargo.toml index 88eeea75..99d0bc16 100644 --- a/minidsp/Cargo.toml +++ b/minidsp/Cargo.toml @@ -7,11 +7,11 @@ keywords = ["minidsp", "audio", "dsp"] license = "Apache-2.0" name = "minidsp" repository = "https://github.com/mrene/minidsp-rs" -version = "0.1.6" +version = "0.1.7" [dependencies] anyhow = "1.0.57" -async-trait = "0.1.53" +async-trait = "0.1.56" atomic_refcell = "0.1.8" bimap = "0.6.2" bytes = "1.1.0" @@ -22,10 +22,10 @@ futures-sink = "0.3.21" futures-util = "0.3.21" hex = "0.4.3" hexplay = "0.2.1" -hyper = "0.14.18" +hyper = "0.14.19" lazy_static = "1.4.0" log = "0.4.17" -minidsp-protocol = {path = "../protocol", version = "0.1.6", default-features = false, features = ["use_serde", "debug", "devices"]} +minidsp-protocol = {path = "../protocol", version = "0.1.7", default-features = false, features = ["use_serde", "debug", "devices"]} pin-project = "1.0.10" schemars = "0.8.10" serde = { version = "1.0.137", features = ["derive"] } @@ -35,7 +35,7 @@ strong-xml = "0.6.3" strum = { version = "0.24.0", features = ["derive"] } termcolor = "1.1.3" thiserror = "1.0.31" -tokio-stream = { version = "0.1.8", features = ["sync"] } +tokio-stream = { version = "0.1.9", features = ["sync"] } tokio-tungstenite = "0.17.1" tower = { version = "0.4.12", features = ["util", "timeout"] } url2 = "0.0.6" @@ -54,11 +54,11 @@ version = "1.4.1" [dependencies.tokio] features = ["rt-multi-thread", "net", "fs", "macros", "io-util"] -version = "1.18.2" +version = "1.19.2" [dependencies.tokio-util] features = ["net", "codec", "io"] -version = "0.7.2" +version = "0.7.3" [target.'cfg(target_family="unix")'.dependencies] hyperlocal = "0.8.0" diff --git a/minidsp/src/lib.rs b/minidsp/src/lib.rs index 68423f19..cf2d9a3d 100644 --- a/minidsp/src/lib.rs +++ b/minidsp/src/lib.rs @@ -227,8 +227,22 @@ impl MiniDSP<'_> { reset: true, }) .await? - .into_config_changed() - .err_into() + .into_config_changed()?; + + // The MiniDSP Flex is immediately responding to `SetConfig` without waiting for it to be applied + // Try polling the master status until the new config is reported + loop { + let status = self.get_master_status().await?; + let preset = status.preset.unwrap(); + + if preset == config { + break; + } + + tokio::time::sleep(Duration::from_millis(500)).await; + } + + Ok(()) } /// Enables or disables Dirac Live diff --git a/minidsp/src/utils/decoder.rs b/minidsp/src/utils/decoder.rs index 76679389..708538cb 100644 --- a/minidsp/src/utils/decoder.rs +++ b/minidsp/src/utils/decoder.rs @@ -20,6 +20,7 @@ pub struct Decoder { quiet: bool, w: Box, name_map: Option>, + start_instant: std::time::Instant, } impl Decoder { @@ -28,7 +29,12 @@ impl Decoder { quiet: bool, name_map: Option>, ) -> Self { - Decoder { quiet, w, name_map } + Decoder { + quiet, + w, + name_map, + start_instant: std::time::Instant::now(), + } } /// Sets the symbol names to be printed @@ -86,6 +92,14 @@ impl Decoder { } } + fn print_time(&mut self) -> std::io::Result<()> { + let elapsed = self.start_instant.elapsed(); + let secs = elapsed.as_secs(); + let millis = elapsed.subsec_millis(); + let _ = write!(self.w, "[{}.{:03}s] ", secs, millis); + Ok(()) + } + fn print_frame(&mut self, sent: bool, frame: &Bytes) -> std::io::Result<()> { let _ = self.print_direction(sent); let _ = self @@ -122,6 +136,7 @@ impl Decoder { let _ = self.w.set_color(ColorSpec::new().set_fg(Some(Color::Blue))); "Recv: " }; + let _ = self.print_time(); write!(self.w, "{}", direction)?; Ok(()) @@ -129,6 +144,7 @@ impl Decoder { fn print_error(&mut self, err: T) -> std::io::Result<()> { let _ = self.w.set_color(ColorSpec::new().set_fg(Some(Color::Red))); + let _ = self.print_time(); writeln!(self.w, "Decode error: {:?}", err)?; Ok(()) } @@ -180,11 +196,7 @@ mod test { #[test] fn test_print() { let writer = Box::new(StandardStream::stderr(ColorChoice::Always)); - let mut d = Decoder { - w: writer, - quiet: false, - name_map: None, - }; + let mut d = Decoder::new(writer, false, None); d.feed_sent(&Bytes::from_static(&[0x05, 0x14, 0x00, 0x46, 0x04, 0x63])); d.feed_recv(&Bytes::from_static(&[ 0x05, 0x14, 0x00, 0x46, 0x00, 0x00, 0x00, diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index afa34b53..b0ed6d38 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Mathieu Rene "] edition = "2021" name = "minidsp-protocol" -version = "0.1.6" +version = "0.1.7" license = "Apache-2.0" description = "A control interface for some MiniDSP products" repository = "https://github.com/mrene/minidsp-rs"