Closed stefnotch closed 3 years ago
I ran it with RUST_BACKTRACE=full
and got this
cargo run --bin device_enumeration
Finished dev [unoptimized + debuginfo] target(s) in 0.29s
Running `target\debug\device_enumeration.exe`
Connected!
thread 'Client currently knows about these devices:
<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: SendError(ScanningFinished)', C:\Users\Stefnotch\.cargo\registry\src\github.com-1ecc6299db9ec823\buttplug-2.0.5\src\client\client_event_loop.rs:167:39
stack backtrace:
0: 0x7ff7dd93f56e - std::backtrace_rs::backtrace::dbghelp::trace
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:108
1: 0x7ff7dd93f56e - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
2: 0x7ff7dd93f56e - std::sys_common::backtrace::_print_fmt
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\sys_common\backtrace.rs:67
3: 0x7ff7dd93f56e - std::sys_common::backtrace::_print::{{impl}}::fmt
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\sys_common\backtrace.rs:46
4: 0x7ff7dd955d0b - core::fmt::write
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\core\src\fmt\mod.rs:1078
5: 0x7ff7dd93a408 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\io\mod.rs:1518
6: 0x7ff7dd9420fd - std::sys_common::backtrace::_print
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\sys_common\backtrace.rs:49
7: 0x7ff7dd9420fd - std::sys_common::backtrace::print
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\sys_common\backtrace.rs:36
8: 0x7ff7dd9420fd - std::panicking::default_hook::{{closure}}
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\panicking.rs:208
9: 0x7ff7dd941cd8 - std::panicking::default_hook
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\panicking.rs:227
10: 0x7ff7dd942a6f - std::panicking::rust_panic_with_hook
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\panicking.rs:593
11: 0x7ff7dd942571 - std::panicking::begin_panic_handler::{{closure}}
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\panicking.rs:499
12: 0x7ff7dd93feaf - std::sys_common::backtrace::__rust_end_short_backtrace<closure-0,!>
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\sys_common\backtrace.rs:141
13: 0x7ff7dd9424c9 - std::panicking::begin_panic_handler
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\panicking.rs:495
14: 0x7ff7dd954210 - core::panicking::panic_fmt
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\core\src\panicking.rs:92
15: 0x7ff7dd954033 - core::option::expect_none_failed
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\core\src\option.rs:1268
16: 0x7ff7dd0c956d - core::result::Result<usize, tokio::sync::broadcast::error::SendError<buttplug::client::ButtplugClientEvent>>::unwrap<usize,tokio::sync::broadcast::error::SendError<buttplug::client::ButtplugClientEvent>>
at C:\Users\Stefnotch\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\result.rs:973
17: 0x7ff7dd0ae059 - buttplug::client::client_event_loop::ButtplugClientEventLoop<buttplug::connector::in_process_connector::ButtplugInProcessClientConnector>::send_client_event<buttplug::connector::in_process_connector::ButtplugInProcessClientConnector>
at C:\Users\Stefnotch\.cargo\registry\src\github.com-1ecc6299db9ec823\buttplug-2.0.5\src\client\client_event_loop.rs:167
18: 0x7ff7dd0b2e56 - buttplug::client::client_event_loop::{{impl}}::parse_connector_message::{{closure}}<buttplug::connector::in_process_connector::ButtplugInProcessClientConnector>
at C:\Users\Stefnotch\.cargo\registry\src\github.com-1ecc6299db9ec823\buttplug-2.0.5\src\client\client_event_loop.rs:208
19: 0x7ff7dd0aa149 - core::future::from_generator::{{impl}}::poll<generator-0>
at C:\Users\Stefnotch\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\future\mod.rs:80
20: 0x7ff7dd0b6b39 - buttplug::client::client_event_loop::{{impl}}::run::{{closure}}<buttplug::connector::in_process_connector::ButtplugInProcessClientConnector>
at C:\Users\Stefnotch\.cargo\registry\src\github.com-1ecc6299db9ec823\buttplug-2.0.5\src\client\client_event_loop.rs:285
21: 0x7ff7dd0aa529 - core::future::from_generator::{{impl}}::poll<generator-0>
at C:\Users\Stefnotch\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\future\mod.rs:80
22: 0x7ff7dd09b676 - buttplug::client::{{impl}}::connect::{{closure}}::{{closure}}<buttplug::connector::in_process_connector::ButtplugInProcessClientConnector>
at C:\Users\Stefnotch\.cargo\registry\src\github.com-1ecc6299db9ec823\buttplug-2.0.5\src\client\mod.rs:248
23: 0x7ff7dd0a97a9 - core::future::from_generator::{{impl}}::poll<generator-1>
at C:\Users\Stefnotch\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\future\mod.rs:80
24: 0x7ff7dd0ba038 - tracing_futures::{{impl}}::poll<core::future::from_generator::GenFuture<generator-1>>
at C:\Users\Stefnotch\.cargo\registry\src\github.com-1ecc6299db9ec823\tracing-futures-0.2.4\src\lib.rs:258
25: 0x7ff7dd85f52b - futures_task::future_obj::{{impl}}::poll<tuple<>>
at C:\Users\Stefnotch\.cargo\registry\src\github.com-1ecc6299db9ec823\futures-task-0.3.12\src\future_obj.rs:86
26: 0x7ff7dd85f49f - futures_task::future_obj::{{impl}}::poll<tuple<>>
at C:\Users\Stefnotch\.cargo\registry\src\github.com-1ecc6299db9ec823\futures-task-0.3.12\src\future_obj.rs:133
27: 0x7ff7dd85e1eb - futures_util::future::future::FutureExt::poll_unpin<futures_task::future_obj::FutureObj<tuple<>>>
at C:\Users\Stefnotch\.cargo\registry\src\github.com-1ecc6299db9ec823\futures-util-0.3.12\src\future\future\mod.rs:561
28: 0x7ff7dd852d7f - futures_executor::thread_pool::Task::run
at C:\Users\Stefnotch\.cargo\registry\src\github.com-1ecc6299db9ec823\futures-executor-0.3.12\src\thread_pool.rs:326
29: 0x7ff7dd851de5 - futures_executor::thread_pool::PoolState::work
at C:\Users\Stefnotch\.cargo\registry\src\github.com-1ecc6299db9ec823\futures-executor-0.3.12\src\thread_pool.rs:160
30: 0x7ff7dd852c35 - futures_executor::thread_pool::{{impl}}::create::{{closure}}
at C:\Users\Stefnotch\.cargo\registry\src\github.com-1ecc6299db9ec823\futures-executor-0.3.12\src\thread_pool.rs:288
31: 0x7ff7dd849e52 - std::sys_common::backtrace::__rust_begin_short_backtrace<closure-0,tuple<>>
at C:\Users\Stefnotch\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys_common\backtrace.rs:125
32: 0x7ff7dd85d7e3 - std::thread::{{impl}}::spawn_unchecked::{{closure}}::{{closure}}<closure-0,tuple<>>
at C:\Users\Stefnotch\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\mod.rs:474
33: 0x7ff7dd849dd3 - std::panic::{{impl}}::call_once<tuple<>,closure-0>
at C:\Users\Stefnotch\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panic.rs:322
34: 0x7ff7dd857d9d - std::panicking::try::do_call<std::panic::AssertUnwindSafe<closure-0>,tuple<>>
at C:\Users\Stefnotch\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:381
35: 0x7ff7dd858917 - futures_executor::enter::ENTERED::__getit
36: 0x7ff7dd857cba - std::panicking::try<tuple<>,std::panic::AssertUnwindSafe<closure-0>>
at C:\Users\Stefnotch\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:345
37: 0x7ff7dd849fe3 - std::panic::catch_unwind<std::panic::AssertUnwindSafe<closure-0>,tuple<>>
at C:\Users\Stefnotch\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panic.rs:396
38: 0x7ff7dd85d5e2 - std::thread::{{impl}}::spawn_unchecked::{{closure}}<closure-0,tuple<>>
at C:\Users\Stefnotch\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\mod.rs:473
39: 0x7ff7dd8544ee - core::ops::function::FnOnce::call_once<closure-0,tuple<>>
at C:\Users\Stefnotch\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:227
40: 0x7ff7dd9450a7 - alloc::boxed::{{impl}}::call_once
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\library\alloc\src\boxed.rs:1307
41: 0x7ff7dd9450a7 - alloc::boxed::{{impl}}::call_once
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\library\alloc\src\boxed.rs:1307
42: 0x7ff7dd9450a7 - std::sys::windows::thread::{{impl}}::new::thread_start
at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\sys\windows\thread.rs:56
43: 0x7ffc80de7034 - BaseThreadInitThunk
44: 0x7ffc8127d0d1 - RtlUserThreadStart
Error: Connector channel has closed, meaning disconnection is likely.
error: process didn't exit successfully: `target\debug\device_enumeration.exe` (exit code: 1)
Also, I stepped through the code a bit. This is where the error happens https://github.com/buttplugio/buttplug-rs/blob/ff85ccc688b7ac1263271dc9d2bd95f8410b737d/buttplug/src/client/client_event_loop.rs#L167
And this gets called https://github.com/tokio-rs/tokio/blob/f13a9dd87a9026cf009c740ccfc341d479286e2f/tokio/src/sync/broadcast.rs#L598
Oops, yeah, that's a bug over in buttplug-rs. Listening for events is optional, but some calls don't handle that correctly.
Tracking bug is https://github.com/buttplugio/buttplug-rs/issues/264, will fix that in the next day or two and get a new version out.
Thank you very much for the super speedy response! Until the bug-fix is out, I'll go ahead and experiment with the excellent Javascript library
@stefnotch Ok all fixed in the new release. Lemme know if you have any other issues. :)
It works perfectly now! Currently I'm checking out the battery support for the magic-motion-2 lipstick. Basically just added that to my local copy. If it ends up working out, I'll report back
"0000180f-0000-1000-8000-00805f9b34fb": {
"rxblebattery": "00002a19-0000-1000-8000-00805f9b34fb"
}
For the record, I'm using it as an alarm clock, because most vibrating alarm clocks on the market are either massive bricks or barely purring gadgets.
@stefnotch Ok, at the moment that will also require an addition to our protocol files. I don't have auto-battery detection for BLE standard devices in quite yet. I'll file something over on the main repo and tag you there.
I've tried out the example code here, however, whenever I run it, I run into the following error.
alternatively, when running it with a turned on bluetooth device
Operating System: Windows 10 Home, Version 10.0.19042 Build 19042 Rust Version: rustc 1.49.0