diff --git a/crates/buttplug_core/src/connector/remote_connector.rs b/crates/buttplug_core/src/connector/remote_connector.rs index 7bb34f1c9..51baf4d2f 100644 --- a/crates/buttplug_core/src/connector/remote_connector.rs +++ b/crates/buttplug_core/src/connector/remote_connector.rs @@ -13,11 +13,9 @@ use super::{ ButtplugConnectorResultFuture, transport::{ButtplugConnectorTransport, ButtplugTransportIncomingMessage}, }; -use crate::{ - message::{ - ButtplugMessage, - serializer::{ButtplugMessageSerializer, ButtplugSerializedMessage}, - }, +use crate::message::{ + ButtplugMessage, + serializer::{ButtplugMessageSerializer, ButtplugSerializedMessage}, }; use futures::{FutureExt, future::BoxFuture, select}; use log::*; diff --git a/crates/buttplug_core/src/util/async_manager/mod.rs b/crates/buttplug_core/src/util/async_manager/mod.rs index 35de82090..2c35f517b 100644 --- a/crates/buttplug_core/src/util/async_manager/mod.rs +++ b/crates/buttplug_core/src/util/async_manager/mod.rs @@ -113,7 +113,10 @@ pub async fn sleep(duration: Duration) { #[macro_export] macro_rules! spawn { ($future:expr) => { - $crate::util::async_manager::spawn($future, tracing::span!(tracing::Level::INFO, "Buttplug Async Task")) + $crate::util::async_manager::spawn( + $future, + tracing::span!(tracing::Level::INFO, "Buttplug Async Task"), + ) }; ($name:expr, $future:expr) => { $crate::util::async_manager::spawn($future, tracing::span!(tracing::Level::INFO, $name)) diff --git a/crates/buttplug_server/src/device/protocol_impl/fredorch_rotary.rs b/crates/buttplug_server/src/device/protocol_impl/fredorch_rotary.rs index 92864fed4..7f5c96c99 100644 --- a/crates/buttplug_server/src/device/protocol_impl/fredorch_rotary.rs +++ b/crates/buttplug_server/src/device/protocol_impl/fredorch_rotary.rs @@ -14,10 +14,7 @@ use crate::device::{ }, }; use async_trait::async_trait; -use buttplug_core::{ - errors::ButtplugDeviceError, - util::async_manager, -}; +use buttplug_core::{errors::ButtplugDeviceError, util::async_manager}; use buttplug_server_device_config::{ Endpoint, ProtocolCommunicationSpecifier, diff --git a/crates/buttplug_server/src/device/protocol_impl/hgod.rs b/crates/buttplug_server/src/device/protocol_impl/hgod.rs index aca1b5df1..f82d8583e 100644 --- a/crates/buttplug_server/src/device/protocol_impl/hgod.rs +++ b/crates/buttplug_server/src/device/protocol_impl/hgod.rs @@ -15,10 +15,7 @@ use crate::device::{ }, }; use async_trait::async_trait; -use buttplug_core::{ - errors::ButtplugDeviceError, - util::async_manager, -}; +use buttplug_core::{errors::ButtplugDeviceError, util::async_manager}; use buttplug_server_device_config::{ Endpoint, ProtocolCommunicationSpecifier, diff --git a/crates/buttplug_server/src/device/protocol_impl/honeyplaybox.rs b/crates/buttplug_server/src/device/protocol_impl/honeyplaybox.rs index 26145e713..7a829ae52 100644 --- a/crates/buttplug_server/src/device/protocol_impl/honeyplaybox.rs +++ b/crates/buttplug_server/src/device/protocol_impl/honeyplaybox.rs @@ -16,9 +16,9 @@ use crate::device::{ }, }; use async_trait::async_trait; +use buttplug_core::errors::ButtplugDeviceError; use buttplug_core::message::{InputReadingV4, InputTypeReading, InputValue}; use buttplug_core::util::async_manager; -use buttplug_core::errors::ButtplugDeviceError; use buttplug_server_device_config::Endpoint; use buttplug_server_device_config::{ ProtocolCommunicationSpecifier, @@ -217,13 +217,16 @@ impl HoneyPlayBox { ); let packet_id = Arc::new(AtomicU8::new(count)); let last_send = Arc::new(RwLock::new(Instant::now())); - buttplug_core::spawn!("HoneyPlayboxKeepalive", hpb_keepalive( - hardware.clone(), - random_key, - last_command.clone(), - packet_id.clone(), - last_send.clone(), - )); + buttplug_core::spawn!( + "HoneyPlayboxKeepalive", + hpb_keepalive( + hardware.clone(), + random_key, + last_command.clone(), + packet_id.clone(), + last_send.clone(), + ) + ); Self { random_key, diff --git a/crates/buttplug_server/src/device/protocol_impl/joyhub.rs b/crates/buttplug_server/src/device/protocol_impl/joyhub.rs index dac812252..92c3a4b76 100644 --- a/crates/buttplug_server/src/device/protocol_impl/joyhub.rs +++ b/crates/buttplug_server/src/device/protocol_impl/joyhub.rs @@ -5,27 +5,61 @@ // Licensed under the BSD 3-Clause license. See LICENSE file in the project root // for full license information. -use std::sync::atomic::{AtomicU8, Ordering}; - -use uuid::{Uuid, uuid}; - +use crate::device::hardware::{HardwareCommand, HardwareWriteCmd}; use crate::device::{ - hardware::{HardwareCommand, HardwareWriteCmd}, - protocol::{ProtocolHandler, generic_protocol_setup}, + hardware::Hardware, + protocol::{ + ProtocolHandler, + ProtocolIdentifier, + ProtocolInitializer, + generic_protocol_initializer_setup, + }, }; +use async_trait::async_trait; use buttplug_core::errors::ButtplugDeviceError; -use buttplug_server_device_config::Endpoint; +use buttplug_core::util::async_manager; +use buttplug_server_device_config::{ + Endpoint, + ProtocolCommunicationSpecifier, + ServerDeviceDefinition, + UserDeviceIdentifier, +}; +use std::sync::Arc; +use std::sync::atomic::{AtomicU8, Ordering}; +use std::time::Duration; +use uuid::{Uuid, uuid}; const JOYHUB_PROTOCOL_UUID: Uuid = uuid!("c0f6785a-0056-4a2a-a2a9-dc7ca4ae2a0d"); -generic_protocol_setup!(JoyHub, "joyhub"); +generic_protocol_initializer_setup!(JoyHub, "joyhub"); #[derive(Default)] +pub struct JoyHubInitializer {} + +#[async_trait] +impl ProtocolInitializer for JoyHubInitializer { + async fn initialize( + &mut self, + hardware: Arc, + _def: &ServerDeviceDefinition, + ) -> Result, ButtplugDeviceError> { + Ok(Arc::new(JoyHub::new(hardware.clone()))) + } +} + pub struct JoyHub { last_cmds: [AtomicU8; 4], + hardware: Arc, } impl JoyHub { + pub fn new(hardware: Arc) -> Self { + Self { + last_cmds: [const { AtomicU8::new(0) }; 4], + hardware, + } + } + fn form_hardware_command( &self, index: u32, @@ -52,6 +86,24 @@ impl JoyHub { } } +async fn cancel_spray(device: Arc, feature_id: Uuid) { + async_manager::sleep(Duration::from_millis(1000)).await; + if let Err(e) = device + .write_value(&HardwareWriteCmd::new( + &[feature_id], + Endpoint::Tx, + vec![0xa0, 0x24, 0x00, 0x00, 0x00, 0x00], + false, + )) + .await + { + warn!( + "Failed to stop the lube pump (the device has probably disconnected): {:?}", + e + ); + } +} + impl ProtocolHandler for JoyHub { fn handle_output_vibrate_cmd( &self, @@ -157,4 +209,29 @@ impl ProtocolHandler for JoyHub { .into(), ]) } + + fn handle_output_spray_cmd( + &self, + _feature_index: u32, + feature_id: Uuid, + level: u32, + ) -> Result, ButtplugDeviceError> { + buttplug_core::spawn!( + "JoyHub spray canceller", + cancel_spray(self.hardware.clone(), feature_id) + ); + Ok(vec![ + HardwareWriteCmd::new( + &[feature_id], + Endpoint::Tx, + if level == 0 { + vec![0xa0, 0x24, 0x00, 0x00, 0x00, 0x00] + } else { + vec![0xa0, 0x24, 0x01, 0x00, 0x01, 0xff] + }, + false, + ) + .into(), + ]) + } } diff --git a/crates/buttplug_server/src/device/protocol_impl/lovense/lovense_stroker.rs b/crates/buttplug_server/src/device/protocol_impl/lovense/lovense_stroker.rs index 2858b1497..c150d845f 100644 --- a/crates/buttplug_server/src/device/protocol_impl/lovense/lovense_stroker.rs +++ b/crates/buttplug_server/src/device/protocol_impl/lovense/lovense_stroker.rs @@ -9,11 +9,7 @@ use crate::device::{ hardware::{Hardware, HardwareCommand, HardwareWriteCmd}, protocol::{ProtocolHandler, ProtocolKeepaliveStrategy}, }; -use buttplug_core::{ - errors::ButtplugDeviceError, - message::InputReadingV4, - util::async_manager, -}; +use buttplug_core::{errors::ButtplugDeviceError, message::InputReadingV4, util::async_manager}; use buttplug_server_device_config::Endpoint; use futures::future::BoxFuture; use std::{ @@ -35,10 +31,10 @@ pub struct LovenseStroker { impl LovenseStroker { pub fn new(hardware: Arc, need_range_zerod: bool) -> Self { let linear_info = Arc::new((AtomicU32::new(0), AtomicU32::new(0))); - buttplug_core::spawn!("LovenseStroker update linear movement", update_linear_movement( - hardware.clone(), - linear_info.clone(), - )); + buttplug_core::spawn!( + "LovenseStroker update linear movement", + update_linear_movement(hardware.clone(), linear_info.clone(),) + ); Self { linear_info, need_range_zerod, diff --git a/crates/buttplug_server/src/device/protocol_impl/nintendo_joycon.rs b/crates/buttplug_server/src/device/protocol_impl/nintendo_joycon.rs index dc5f1e335..d9961a5d0 100644 --- a/crates/buttplug_server/src/device/protocol_impl/nintendo_joycon.rs +++ b/crates/buttplug_server/src/device/protocol_impl/nintendo_joycon.rs @@ -15,7 +15,7 @@ use crate::device::{ }, }; use async_trait::async_trait; -use buttplug_core::{errors::ButtplugDeviceError}; +use buttplug_core::errors::ButtplugDeviceError; use buttplug_server_device_config::{ Endpoint, ProtocolCommunicationSpecifier, diff --git a/crates/buttplug_server/src/device/protocol_impl/vibcrafter.rs b/crates/buttplug_server/src/device/protocol_impl/vibcrafter.rs index 6abbb38c7..8311d139a 100644 --- a/crates/buttplug_server/src/device/protocol_impl/vibcrafter.rs +++ b/crates/buttplug_server/src/device/protocol_impl/vibcrafter.rs @@ -31,8 +31,8 @@ use std::sync::{ }; use uuid::{Uuid, uuid}; -use rand::distr::Alphanumeric; use rand::RngExt; +use rand::distr::Alphanumeric; use regex::Regex; use sha2::{Digest, Sha256}; diff --git a/crates/buttplug_server/src/device/protocol_impl/vorze_sa/mod.rs b/crates/buttplug_server/src/device/protocol_impl/vorze_sa/mod.rs index 0fd5dca5e..b7729e04b 100644 --- a/crates/buttplug_server/src/device/protocol_impl/vorze_sa/mod.rs +++ b/crates/buttplug_server/src/device/protocol_impl/vorze_sa/mod.rs @@ -78,7 +78,7 @@ impl ProtocolInitializer for VorzeSAInitializer { } } "vorze-sa-dual-vibrator" => { - if hwname.contains("omorfi") { + if hwname.contains("omor") { Ok(Arc::new(dual_vibrator::VorzeSADualVibrator::default())) } else { Err(ButtplugDeviceError::ProtocolNotImplemented(format!( diff --git a/crates/buttplug_server/src/device/protocol_impl/xuanhuan.rs b/crates/buttplug_server/src/device/protocol_impl/xuanhuan.rs index 048fbb812..e974207b8 100644 --- a/crates/buttplug_server/src/device/protocol_impl/xuanhuan.rs +++ b/crates/buttplug_server/src/device/protocol_impl/xuanhuan.rs @@ -15,10 +15,7 @@ use crate::device::{ }, }; use async_trait::async_trait; -use buttplug_core::{ - errors::ButtplugDeviceError, - util::async_manager, -}; +use buttplug_core::{errors::ButtplugDeviceError, util::async_manager}; use buttplug_server_device_config::{ Endpoint, ProtocolCommunicationSpecifier, @@ -83,9 +80,9 @@ impl Xuanhuan { fn new(device: Arc) -> Self { let current_command = Arc::new(AtomicU8::new(0)); let current_command_clone = current_command.clone(); - buttplug_core::spawn!("Xuanhuan vibration update", - async move { vibration_update_handler(device, current_command_clone).await } - ); + buttplug_core::spawn!("Xuanhuan vibration update", async move { + vibration_update_handler(device, current_command_clone).await + }); Self { current_command } } } diff --git a/crates/buttplug_server/src/device/server_device_manager_event_loop.rs b/crates/buttplug_server/src/device/server_device_manager_event_loop.rs index 030f8754a..9cc0fae33 100644 --- a/crates/buttplug_server/src/device/server_device_manager_event_loop.rs +++ b/crates/buttplug_server/src/device/server_device_manager_event_loop.rs @@ -5,12 +5,11 @@ // Licensed under the BSD 3-Clause license. See LICENSE file in the project root // for full license information. -use buttplug_core::{ - message::{ButtplugServerMessageV4, DeviceListV4, ScanningFinishedV0}, -}; +use buttplug_core::message::{ButtplugServerMessageV4, DeviceListV4, ScanningFinishedV0}; use buttplug_server_device_config::DeviceConfigurationManager; use tracing::info_span; +use super::server_device_manager::DeviceManagerCommand; use crate::device::{ DeviceHandle, InternalDeviceEvent, @@ -23,7 +22,6 @@ use futures::{FutureExt, future}; use std::sync::Arc; use tokio::sync::{broadcast, mpsc}; use tokio_util::sync::CancellationToken; -use super::server_device_manager::DeviceManagerCommand; /// Scanning state machine for the device manager event loop. /// Replaces the previous combination of scanning_bringup_in_progress, scanning_started, @@ -286,27 +284,35 @@ impl ServerDeviceManagerEventLoop { // Clone sender again for the forwarding task that build_device_handle will spawn let device_event_sender_for_forwarding = self.device_event_sender.clone(); - buttplug_core::util::async_manager::spawn(async move { - match build_device_handle( - device_config_manager, - creator, - protocol_specializers, - device_event_sender_for_forwarding, - ).await { - Ok(device_handle) => { - if device_event_sender_clone - .send(InternalDeviceEvent::Connected(device_handle)) - .await - .is_err() { - error!("Device manager disappeared before connection established, device will be dropped."); + buttplug_core::util::async_manager::spawn( + async move { + match build_device_handle( + device_config_manager, + creator, + protocol_specializers, + device_event_sender_for_forwarding, + ) + .await + { + Ok(device_handle) => { + if device_event_sender_clone + .send(InternalDeviceEvent::Connected(device_handle)) + .await + .is_err() + { + error!( + "Device manager disappeared before connection established, device will be dropped." + ); + } + } + Err(e) => { + error!("Device errored while trying to connect: {:?}", e); } - }, - Err(e) => { - error!("Device errored while trying to connect: {:?}", e); } - } - connecting_devices.remove(&address); - }, span); + connecting_devices.remove(&address); + }, + span, + ); } } } diff --git a/crates/buttplug_server/src/message/v1/mod.rs b/crates/buttplug_server/src/message/v1/mod.rs index 063017c89..302ea7812 100644 --- a/crates/buttplug_server/src/message/v1/mod.rs +++ b/crates/buttplug_server/src/message/v1/mod.rs @@ -26,5 +26,9 @@ pub use device_message_info::DeviceMessageInfoV1; pub use linear_cmd::{LinearCmdV1, VectorSubcommandV1}; pub use request_server_info::RequestServerInfoV1; pub use rotate_cmd::{RotateCmdV1, RotationSubcommandV1}; -pub use spec_enums::{ButtplugClientMessageV1, ButtplugDeviceMessageNameV1, ButtplugServerMessageV1}; +pub use spec_enums::{ + ButtplugClientMessageV1, + ButtplugDeviceMessageNameV1, + ButtplugServerMessageV1, +}; pub use vibrate_cmd::{VibrateCmdV1, VibrateSubcommandV1}; diff --git a/crates/buttplug_server/src/message/v4/checked_output_cmd.rs b/crates/buttplug_server/src/message/v4/checked_output_cmd.rs index 998b9faa3..5b2bccf76 100644 --- a/crates/buttplug_server/src/message/v4/checked_output_cmd.rs +++ b/crates/buttplug_server/src/message/v4/checked_output_cmd.rs @@ -122,9 +122,12 @@ impl TryFromDeviceAttributes for CheckedOutputCmdV4 { if let Some(output_map) = feature.output() { let output_type = cmd.command().as_output_type(); if output_map.is_disabled(output_type) { - return Err(ButtplugError::from(ButtplugDeviceError::MessageNotSupported( - format!("Output type {:?} is disabled for this device", output_type), - ))); + return Err(ButtplugError::from( + ButtplugDeviceError::MessageNotSupported(format!( + "Output type {:?} is disabled for this device", + output_type + )), + )); } let value = cmd.command().value(); let new_value = output_map diff --git a/crates/buttplug_server/src/server_message_conversion.rs b/crates/buttplug_server/src/server_message_conversion.rs index 8789b12a6..6a635334b 100644 --- a/crates/buttplug_server/src/server_message_conversion.rs +++ b/crates/buttplug_server/src/server_message_conversion.rs @@ -95,7 +95,9 @@ impl ButtplugServerDeviceEventMessageConverter { return Some(ButtplugServerMessageVariant::V1(da1.into())); } let da0 = DeviceAddedV0::from(da1); - return Some(ButtplugServerMessageVariant::V0(ButtplugServerMessageV0::DeviceAdded(da0))); + return Some(ButtplugServerMessageVariant::V0( + ButtplugServerMessageV0::DeviceAdded(da0), + )); } // Check for removed devices diff --git a/crates/buttplug_server_device_config/build-config/buttplug-device-config-v4.json b/crates/buttplug_server_device_config/build-config/buttplug-device-config-v4.json index 0efb48027..2041d37fb 100644 --- a/crates/buttplug_server_device_config/build-config/buttplug-device-config-v4.json +++ b/crates/buttplug_server_device_config/build-config/buttplug-device-config-v4.json @@ -1,7 +1,7 @@ { "version": { "major": 4, - "minor": 180 + "minor": 186 }, "protocols": { "activejoy": { @@ -5814,7 +5814,13 @@ "J-Pogo", "J-Pyro", "J-MaxSensr", - "J-Diego" + "J-Diego", + "J-RoseVore", + "J-Rosethorn2", + "J-Pak", + "J-VeeLips", + "J-Veeva2", + "J-Punch" ], "services": { "0000ffa0-0000-1000-8000-00805f9b34fb": { @@ -9722,6 +9728,240 @@ "J-Diego" ], "name": "JoyHub Diego" + }, + { + "features": [ + { + "id": "ff39d6f4-d876-4701-9746-6c7bbe4db308", + "index": 0, + "output": { + "vibrate": { + "value": [ + 0, + 255 + ] + } + } + }, + { + "id": "6753b978-3d72-4a35-a81c-c9a82b868509", + "index": 1, + "output": { + "rotate": { + "value": [ + 0, + 255 + ] + } + } + }, + { + "id": "1ce54e39-94cf-4fa8-8717-a31917eaa73a", + "index": 4, + "output": { + "constrict": { + "value": [ + 0, + 7 + ] + } + } + } + ], + "id": "1939df4a-2041-4d8e-bf08-0f6144f54490", + "identifier": [ + "J-RoseVore" + ], + "name": "JoyHub Rose Vore" + }, + { + "features": [ + { + "id": "8e0414b6-87e2-4359-be06-aaf965d08e58", + "index": 0, + "output": { + "oscillate": { + "value": [ + 0, + 255 + ] + } + } + }, + { + "id": "e66e5331-26c9-4b6b-b2a3-f5d13e07a60c", + "index": 1, + "output": { + "vibrate": { + "value": [ + 0, + 255 + ] + } + } + } + ], + "id": "5b0614a8-857b-4d8f-b1ec-0d078d35c068", + "identifier": [ + "J-Rosethorn2" + ], + "name": "JoyHub Rosethorn 2" + }, + { + "features": [ + { + "id": "bf2f834c-8aeb-4256-aca6-aa8dab875335", + "index": 0, + "output": { + "vibrate": { + "value": [ + 0, + 255 + ] + } + } + }, + { + "id": "250903cb-4f2b-42c5-89a9-56f7d5a022a6", + "index": 1, + "output": { + "vibrate": { + "value": [ + 0, + 255 + ] + } + } + }, + { + "id": "d4e5df1e-4a94-4046-8e15-426a50bbbd32", + "index": 2, + "output": { + "oscillate": { + "value": [ + 0, + 255 + ] + } + } + } + ], + "id": "fc64af3a-5ce1-4306-884f-80bfe3264390", + "identifier": [ + "J-Pak" + ], + "name": "JoyHub Pak" + }, + { + "features": [ + { + "id": "c445c35e-ede0-41c8-a9a5-fdc149eaa749", + "index": 0, + "output": { + "rotate": { + "value": [ + 0, + 255 + ] + } + } + }, + { + "id": "8e352fda-af55-4f38-8c6a-b62765229b4f", + "index": 1, + "output": { + "vibrate": { + "value": [ + 0, + 255 + ] + } + } + }, + { + "id": "242d7a8d-cc3b-47fe-ac22-58b2392d9f4e", + "index": 2, + "output": { + "vibrate": { + "value": [ + 0, + 255 + ] + } + } + } + ], + "id": "7cea69f0-7451-4a9b-91bc-30029c20daad", + "identifier": [ + "J-VeeLips" + ], + "name": "JoyHub VeeLips" + }, + { + "features": [ + { + "id": "04a84dfd-d14b-46e1-90f8-db8d95bac592", + "index": 0, + "output": { + "oscillate": { + "value": [ + 0, + 255 + ] + } + } + }, + { + "id": "48f551e8-7e1d-4705-a487-600105b9a6f4", + "index": 1, + "output": { + "vibrate": { + "value": [ + 0, + 255 + ] + } + } + } + ], + "id": "be0ffcb5-e529-4d6c-9002-1764631b1fb6", + "identifier": [ + "J-Veeva2" + ], + "name": "JoyHub Veeva 2" + }, + { + "features": [ + { + "id": "bd5209de-3544-49c7-9c77-c612f958f78c", + "index": 0, + "output": { + "rotate": { + "value": [ + 0, + 255 + ] + } + } + }, + { + "id": "d4fad572-2b04-4491-9ed0-97555053b5ce", + "index": 1, + "output": { + "vibrate": { + "value": [ + 0, + 255 + ] + } + } + } + ], + "id": "bafdaacd-8e51-4779-9624-7b9af4a8a657", + "identifier": [ + "J-Punch" + ], + "name": "JoyHub Punch" } ], "defaults": { @@ -21254,7 +21494,8 @@ "UFO-TW", "VorzePiston", "ROCKET", - "OMORFI" + "OMORFI", + "OMOR" ], "services": { "40ee1111-63ec-4b7f-8ce7-712efd55b90e": { @@ -21442,7 +21683,8 @@ ], "id": "aef03284-6d45-426a-b02c-efa7896d4865", "identifier": [ - "OMORFI" + "OMORFI", + "OMOR" ], "name": "Vorze Omorfi", "protocol_variant": "vorze-sa-dual-vibrator" diff --git a/crates/buttplug_server_device_config/device-config-v4/protocols/joyhub.yml b/crates/buttplug_server_device_config/device-config-v4/protocols/joyhub.yml index a464a96a5..d99d938c4 100644 --- a/crates/buttplug_server_device_config/device-config-v4/protocols/joyhub.yml +++ b/crates/buttplug_server_device_config/device-config-v4/protocols/joyhub.yml @@ -2273,6 +2273,141 @@ configurations: - 1 index: 5 id: d862601d-1567-48c3-9dd8-bd4596a6657e +- identifier: + - J-RoseVore + name: JoyHub Rose Vore + features: + - id: ff39d6f4-d876-4701-9746-6c7bbe4db308 + output: + vibrate: + value: + - 0 + - 255 + index: 0 + - id: 6753b978-3d72-4a35-a81c-c9a82b868509 + output: + rotate: + value: + - 0 + - 255 + index: 1 + - id: 1ce54e39-94cf-4fa8-8717-a31917eaa73a + output: + constrict: + value: + - 0 + - 7 + index: 4 + id: 1939df4a-2041-4d8e-bf08-0f6144f54490 +- identifier: + - J-Rosethorn2 + name: JoyHub Rosethorn 2 + features: + - id: 8e0414b6-87e2-4359-be06-aaf965d08e58 + output: + oscillate: + value: + - 0 + - 255 + index: 0 + - id: e66e5331-26c9-4b6b-b2a3-f5d13e07a60c + output: + vibrate: + value: + - 0 + - 255 + index: 1 + id: 5b0614a8-857b-4d8f-b1ec-0d078d35c068 +- identifier: + - J-Pak + name: JoyHub Pak + features: + - id: bf2f834c-8aeb-4256-aca6-aa8dab875335 + output: + vibrate: + value: + - 0 + - 255 + index: 0 + - id: 250903cb-4f2b-42c5-89a9-56f7d5a022a6 + output: + vibrate: + value: + - 0 + - 255 + index: 1 + - id: d4e5df1e-4a94-4046-8e15-426a50bbbd32 + output: + oscillate: + value: + - 0 + - 255 + index: 2 + id: fc64af3a-5ce1-4306-884f-80bfe3264390 +- identifier: + - J-VeeLips + name: JoyHub VeeLips + features: + - id: c445c35e-ede0-41c8-a9a5-fdc149eaa749 + output: + rotate: + value: + - 0 + - 255 + index: 0 + - id: 8e352fda-af55-4f38-8c6a-b62765229b4f + output: + vibrate: + value: + - 0 + - 255 + index: 1 + - id: 242d7a8d-cc3b-47fe-ac22-58b2392d9f4e + output: + vibrate: + value: + - 0 + - 255 + index: 2 + id: 7cea69f0-7451-4a9b-91bc-30029c20daad +- identifier: + - J-Veeva2 + name: JoyHub Veeva 2 + features: + - id: 04a84dfd-d14b-46e1-90f8-db8d95bac592 + output: + oscillate: + value: + - 0 + - 255 + index: 0 + - id: 48f551e8-7e1d-4705-a487-600105b9a6f4 + output: + vibrate: + value: + - 0 + - 255 + index: 1 + id: be0ffcb5-e529-4d6c-9002-1764631b1fb6 +- identifier: + - J-Punch + name: JoyHub Punch + features: + - id: bd5209de-3544-49c7-9c77-c612f958f78c + output: + rotate: + value: + - 0 + - 255 + index: 0 + - id: d4fad572-2b04-4491-9ed0-97555053b5ce + output: + vibrate: + value: + - 0 + - 255 + index: 1 + id: bafdaacd-8e51-4779-9624-7b9af4a8a657 communication: - btle: names: @@ -2406,6 +2541,12 @@ communication: - J-Pyro - J-MaxSensr - J-Diego + - J-RoseVore + - J-Rosethorn2 + - J-Pak + - J-VeeLips + - J-Veeva2 + - J-Punch services: 0000ffa0-0000-1000-8000-00805f9b34fb: tx: 0000ffa1-0000-1000-8000-00805f9b34fb diff --git a/crates/buttplug_server_device_config/device-config-v4/protocols/vorze-sa.yml b/crates/buttplug_server_device_config/device-config-v4/protocols/vorze-sa.yml index ea83dfb74..1c2f0f2de 100644 --- a/crates/buttplug_server_device_config/device-config-v4/protocols/vorze-sa.yml +++ b/crates/buttplug_server_device_config/device-config-v4/protocols/vorze-sa.yml @@ -93,7 +93,8 @@ configurations: index: 0 id: b1b17b07-c5b8-4db4-97c4-ef1597cf2e59 - identifier: - - OMORFI + - OMORFI + - OMOR name: Vorze Omorfi protocol_variant: vorze-sa-dual-vibrator features: @@ -122,6 +123,7 @@ communication: - VorzePiston - ROCKET - OMORFI + - OMOR services: 40ee1111-63ec-4b7f-8ce7-712efd55b90e: tx: 40ee2222-63ec-4b7f-8ce7-712efd55b90e diff --git a/crates/buttplug_server_device_config/device-config-v4/version.yaml b/crates/buttplug_server_device_config/device-config-v4/version.yaml index 3f6c6f5be..31586ff3b 100644 --- a/crates/buttplug_server_device_config/device-config-v4/version.yaml +++ b/crates/buttplug_server_device_config/device-config-v4/version.yaml @@ -1,3 +1,3 @@ version: major: 4 - minor: 180 + minor: 186 diff --git a/crates/buttplug_server_device_config/src/server_device_feature.rs b/crates/buttplug_server_device_config/src/server_device_feature.rs index b146fed00..2e3651adb 100644 --- a/crates/buttplug_server_device_config/src/server_device_feature.rs +++ b/crates/buttplug_server_device_config/src/server_device_feature.rs @@ -498,9 +498,10 @@ impl ServerDeviceFeatureOutput { OutputType::Temperature => self.temperature.as_ref().is_some_and(|x| x.disabled()), OutputType::Led => self.led.as_ref().is_some_and(|x| x.disabled()), OutputType::Position => self.position.as_ref().is_some_and(|x| x.disabled()), - OutputType::HwPositionWithDuration => { - self.hw_position_with_duration.as_ref().is_some_and(|x| x.disabled()) - } + OutputType::HwPositionWithDuration => self + .hw_position_with_duration + .as_ref() + .is_some_and(|x| x.disabled()), OutputType::Spray => self.spray.as_ref().is_some_and(|x| x.disabled()), OutputType::Unknown => false, } @@ -556,23 +557,51 @@ impl ServerDeviceFeatureOutput { impl From for DeviceFeatureOutput { fn from(val: ServerDeviceFeatureOutput) -> Self { let mut builder = DeviceFeatureOutputBuilder::default(); - val.vibrate.as_ref().filter(|x| !x.disabled()).map(|x| builder.vibrate(x.into())); - val.rotate.as_ref().filter(|x| !x.disabled()).map(|x| builder.rotate(x.into())); - val.oscillate.as_ref().filter(|x| !x.disabled()).map(|x| builder.oscillate(x.into())); - val.constrict.as_ref().filter(|x| !x.disabled()).map(|x| builder.constrict(x.into())); + val + .vibrate + .as_ref() + .filter(|x| !x.disabled()) + .map(|x| builder.vibrate(x.into())); + val + .rotate + .as_ref() + .filter(|x| !x.disabled()) + .map(|x| builder.rotate(x.into())); + val + .oscillate + .as_ref() + .filter(|x| !x.disabled()) + .map(|x| builder.oscillate(x.into())); + val + .constrict + .as_ref() + .filter(|x| !x.disabled()) + .map(|x| builder.constrict(x.into())); val .temperature .as_ref() .filter(|x| !x.disabled()) .map(|x| builder.temperature(x.into())); - val.led.as_ref().filter(|x| !x.disabled()).map(|x| builder.led(x.into())); - val.position.as_ref().filter(|x| !x.disabled()).map(|x| builder.position(x.into())); + val + .led + .as_ref() + .filter(|x| !x.disabled()) + .map(|x| builder.led(x.into())); + val + .position + .as_ref() + .filter(|x| !x.disabled()) + .map(|x| builder.position(x.into())); val .hw_position_with_duration .as_ref() .filter(|x| !x.disabled()) .map(|x| builder.hw_position_with_duration(x.into())); - val.spray.as_ref().filter(|x| !x.disabled()).map(|x| builder.spray(x.into())); + val + .spray + .as_ref() + .filter(|x| !x.disabled()) + .map(|x| builder.spray(x.into())); builder.build().expect("Infallible") } } diff --git a/crates/buttplug_server_hwmgr_btleplug/src/btleplug_hardware.rs b/crates/buttplug_server_hwmgr_btleplug/src/btleplug_hardware.rs index 63d8d9ab0..35fc43550 100644 --- a/crates/buttplug_server_hwmgr_btleplug/src/btleplug_hardware.rs +++ b/crates/buttplug_server_hwmgr_btleplug/src/btleplug_hardware.rs @@ -11,7 +11,7 @@ use btleplug::{ api::{Central, CentralEvent, Characteristic, Peripheral, ValueNotification, WriteType}, platform::Adapter, }; -use buttplug_core::{errors::ButtplugDeviceError}; +use buttplug_core::errors::ButtplugDeviceError; use buttplug_server::device::hardware::{ Hardware, HardwareConnector, diff --git a/crates/buttplug_server_hwmgr_websocket/src/websocket_server_comm_manager.rs b/crates/buttplug_server_hwmgr_websocket/src/websocket_server_comm_manager.rs index 8ac1d3115..59fdaa074 100644 --- a/crates/buttplug_server_hwmgr_websocket/src/websocket_server_comm_manager.rs +++ b/crates/buttplug_server_hwmgr_websocket/src/websocket_server_comm_manager.rs @@ -82,90 +82,93 @@ impl WebsocketServerDeviceCommunicationManager { trace!("Websocket server port created."); let server_cancellation_token = CancellationToken::new(); let child_token = server_cancellation_token.child_token(); - buttplug_core::spawn!("WebsocketServerDeviceCommunicationManager loop", async move { - let base_addr = if listen_on_all_interfaces { - "0.0.0.0" - } else { - "127.0.0.1" - }; - - let addr = format!("{base_addr}:{port}"); - debug!("Trying to listen on {}", addr); - - // Create the event loop and TCP listener we'll accept connections on. - debug!("Socket bound."); - let listener = match TcpListener::bind(&addr).await { - Ok(listener) => listener, - Err(err) => { - error!("Cannot bind websocket server to {}: {:?}.", addr, err); - return; - } - }; - debug!("Listening on: {}", addr); - loop { - select! { - listener_result = listener.accept() => { - let stream = if let Ok((stream, _)) = listener_result { - stream - } else { - error!("Cannot bind websocket server comm manager to address {}.", addr); - return; - }; - info!("Got connection"); - let ws_fut = tokio_tungstenite::accept_async(stream); - let mut ws_stream = match ws_fut.await { - Ok(ws_stream) => ws_stream, - Err(err) => { - error!("Cannot accept socket: {}", err); - continue; - } - }; - // Websockets are different from the rest of the communication managers, in that we have no - // information about the device type when we create the connection, and therefore have to - // wait for the first packet. We'll have to pass our device event sender off to the newly - // created event loop, so that it can fire once the info packet is received. - let sender_clone = sender.clone(); - tokio::spawn(async move { - // TODO Implement a receive timeout here so we don't wait forever - if let Some(Ok(tokio_tungstenite::tungstenite::Message::Text(info_message))) = - ws_stream.next().await - { - let info_packet: WebsocketServerDeviceCommManagerInitInfo = - if let Ok(packet) = serde_json::from_str(&info_message) { - packet - } else { - error!("Did not receive a valid JSON info packet as the first packet, disconnecting."); - if let Err(err) = ws_stream.close(None).await { - error!("Error closing connection: {}", err); - } - return; - }; - if sender_clone - .send(HardwareCommunicationManagerEvent::DeviceFound { - name: format!("Websocket Device {}", info_packet.identifier), - address: info_packet.address.clone(), - creator: Box::new(WebsocketServerHardwareConnector::new( - info_packet, - ws_stream, - )), - }) - .await - .is_err() + buttplug_core::spawn!( + "WebsocketServerDeviceCommunicationManager loop", + async move { + let base_addr = if listen_on_all_interfaces { + "0.0.0.0" + } else { + "127.0.0.1" + }; + + let addr = format!("{base_addr}:{port}"); + debug!("Trying to listen on {}", addr); + + // Create the event loop and TCP listener we'll accept connections on. + debug!("Socket bound."); + let listener = match TcpListener::bind(&addr).await { + Ok(listener) => listener, + Err(err) => { + error!("Cannot bind websocket server to {}: {:?}.", addr, err); + return; + } + }; + debug!("Listening on: {}", addr); + loop { + select! { + listener_result = listener.accept() => { + let stream = if let Ok((stream, _)) = listener_result { + stream + } else { + error!("Cannot bind websocket server comm manager to address {}.", addr); + return; + }; + info!("Got connection"); + let ws_fut = tokio_tungstenite::accept_async(stream); + let mut ws_stream = match ws_fut.await { + Ok(ws_stream) => ws_stream, + Err(err) => { + error!("Cannot accept socket: {}", err); + continue; + } + }; + // Websockets are different from the rest of the communication managers, in that we have no + // information about the device type when we create the connection, and therefore have to + // wait for the first packet. We'll have to pass our device event sender off to the newly + // created event loop, so that it can fire once the info packet is received. + let sender_clone = sender.clone(); + tokio::spawn(async move { + // TODO Implement a receive timeout here so we don't wait forever + if let Some(Ok(tokio_tungstenite::tungstenite::Message::Text(info_message))) = + ws_stream.next().await { - error!("Device manager disappeared, exiting."); + let info_packet: WebsocketServerDeviceCommManagerInitInfo = + if let Ok(packet) = serde_json::from_str(&info_message) { + packet + } else { + error!("Did not receive a valid JSON info packet as the first packet, disconnecting."); + if let Err(err) = ws_stream.close(None).await { + error!("Error closing connection: {}", err); + } + return; + }; + if sender_clone + .send(HardwareCommunicationManagerEvent::DeviceFound { + name: format!("Websocket Device {}", info_packet.identifier), + address: info_packet.address.clone(), + creator: Box::new(WebsocketServerHardwareConnector::new( + info_packet, + ws_stream, + )), + }) + .await + .is_err() + { + error!("Device manager disappeared, exiting."); + } + } else { + error!("Did not receive info message as first packet, dropping connection."); } - } else { - error!("Did not receive info message as first packet, dropping connection."); - } - }); - }, - _ = child_token.cancelled() => { - info!("Task token cancelled, assuming websocket server comm manager shutdown."); - break; + }); + }, + _ = child_token.cancelled() => { + info!("Task token cancelled, assuming websocket server comm manager shutdown."); + break; + } } } } - }); + ); Self { server_cancellation_token, } diff --git a/crates/buttplug_tests/tests/test_disabled_device_features.rs b/crates/buttplug_tests/tests/test_disabled_device_features.rs index e1cf6b65b..e70ce78f1 100644 --- a/crates/buttplug_tests/tests/test_disabled_device_features.rs +++ b/crates/buttplug_tests/tests/test_disabled_device_features.rs @@ -19,11 +19,8 @@ use buttplug_core::message::{ RequestServerInfoV4, StartScanningV0, }; -use buttplug_server::{ - ButtplugServerBuilder, - device::ServerDeviceManagerBuilder, -}; use buttplug_server::message::{ButtplugClientMessageVariant, ButtplugServerMessageVariant}; +use buttplug_server::{ButtplugServerBuilder, device::ServerDeviceManagerBuilder}; use buttplug_server_device_config::load_protocol_configs; use futures::{StreamExt, pin_mut}; use util::{ @@ -48,8 +45,10 @@ fn load_disabled_test_dcm() -> buttplug_server_device_config::DeviceConfiguratio #[tokio::test] async fn test_disabled_output_type_not_in_device_list() { let dcm = load_disabled_test_dcm(); - let identifier = - TestDeviceIdentifier::new("tcode-v03-disabled-test", Some("tcode-disabled-test-addr".into())); + let identifier = TestDeviceIdentifier::new( + "tcode-v03-disabled-test", + Some("tcode-disabled-test-addr".into()), + ); let (client, _device_channel) = test_client_with_device_and_custom_dcm(&identifier, dcm).await; @@ -83,8 +82,10 @@ async fn test_disabled_output_type_not_in_device_list() { #[tokio::test] async fn test_disabled_output_type_command_rejected() { let dcm = load_disabled_test_dcm(); - let identifier = - TestDeviceIdentifier::new("tcode-v03-disabled-test", Some("tcode-disabled-test-addr".into())); + let identifier = TestDeviceIdentifier::new( + "tcode-v03-disabled-test", + Some("tcode-disabled-test-addr".into()), + ); let mut builder = TestDeviceCommunicationManagerBuilder::default(); let _device_channel = builder.add_test_device(&identifier); @@ -123,7 +124,13 @@ async fn test_disabled_output_type_command_rejected() { while let Some(msg) = recv.next().await { if let ButtplugServerMessageVariant::V4(ButtplugServerMessageV4::DeviceList(list)) = msg { if !list.devices().is_empty() { - device_index = Some(*list.devices().keys().next().expect("Checked non-empty above")); + device_index = Some( + *list + .devices() + .keys() + .next() + .expect("Checked non-empty above"), + ); break; } } diff --git a/crates/buttplug_tests/tests/util/device_test/client/client_v0/client_event_loop.rs b/crates/buttplug_tests/tests/util/device_test/client/client_v0/client_event_loop.rs index 8c7e4a07a..ced2fb62e 100644 --- a/crates/buttplug_tests/tests/util/device_test/client/client_v0/client_event_loop.rs +++ b/crates/buttplug_tests/tests/util/device_test/client/client_v0/client_event_loop.rs @@ -15,11 +15,7 @@ use buttplug_core::{ connector::ButtplugConnector, errors::{ButtplugDeviceError, ButtplugError}, }; -use buttplug_server::message::{ - ButtplugClientMessageV0, - ButtplugServerMessageV0, - DeviceListV0, -}; +use buttplug_server::message::{ButtplugClientMessageV0, ButtplugServerMessageV0, DeviceListV0}; use dashmap::DashMap; use futures::channel::oneshot; use log::*; @@ -225,11 +221,8 @@ where )); return; } - let device = self.create_client_device( - dev.device_index(), - dev.device_name(), - dev.device_messages(), - ); + let device = + self.create_client_device(dev.device_index(), dev.device_name(), dev.device_messages()); self.send_client_event(ButtplugClientEvent::DeviceAdded(device)); } ButtplugServerMessageV0::DeviceRemoved(dev) => { @@ -287,11 +280,8 @@ where if self.device_map.contains_key(&d.device_index()) { continue; } - let device = self.create_client_device( - d.device_index(), - d.device_name(), - d.device_messages(), - ); + let device = + self.create_client_device(d.device_index(), d.device_name(), d.device_messages()); self.send_client_event(ButtplugClientEvent::DeviceAdded(device)); } true diff --git a/crates/buttplug_tests/tests/util/device_test/client/client_v0/device.rs b/crates/buttplug_tests/tests/util/device_test/client/client_v0/device.rs index a724edc58..7852d7868 100644 --- a/crates/buttplug_tests/tests/util/device_test/client/client_v0/device.rs +++ b/crates/buttplug_tests/tests/util/device_test/client/client_v0/device.rs @@ -134,12 +134,7 @@ impl ButtplugClientDevice { device_messages: &Vec, sender: mpsc::Sender, ) -> Self { - ButtplugClientDevice::new( - device_name, - device_index, - device_messages.clone(), - sender, - ) + ButtplugClientDevice::new(device_name, device_index, device_messages.clone(), sender) } pub fn connected(&self) -> bool { diff --git a/crates/buttplug_tests/tests/util/device_test/client/client_v0/mod.rs b/crates/buttplug_tests/tests/util/device_test/client/client_v0/mod.rs index 0749b0d4a..264496f26 100644 --- a/crates/buttplug_tests/tests/util/device_test/client/client_v0/mod.rs +++ b/crates/buttplug_tests/tests/util/device_test/client/client_v0/mod.rs @@ -206,7 +206,9 @@ pub async fn run_test_case( device_sender.send(event.clone()).await.unwrap(); } } - TestCommand::VersionGated { .. } => unreachable!("filter_commands should not yield VersionGated"), + TestCommand::VersionGated { .. } => { + unreachable!("filter_commands should not yield VersionGated") + } } } } @@ -282,7 +284,9 @@ pub async fn run_test_case( device_sender.send(event.clone()).await.unwrap(); } } - TestCommand::VersionGated { .. } => unreachable!("filter_commands should not yield VersionGated"), + TestCommand::VersionGated { .. } => { + unreachable!("filter_commands should not yield VersionGated") + } } } } diff --git a/crates/buttplug_tests/tests/util/device_test/client/client_v1/mod.rs b/crates/buttplug_tests/tests/util/device_test/client/client_v1/mod.rs index 3270f6a49..af93d0394 100644 --- a/crates/buttplug_tests/tests/util/device_test/client/client_v1/mod.rs +++ b/crates/buttplug_tests/tests/util/device_test/client/client_v1/mod.rs @@ -224,7 +224,9 @@ pub async fn run_test_case( device_sender.send(event.clone()).await.unwrap(); } } - TestCommand::VersionGated { .. } => unreachable!("filter_commands should not yield VersionGated"), + TestCommand::VersionGated { .. } => { + unreachable!("filter_commands should not yield VersionGated") + } } } } @@ -300,7 +302,9 @@ pub async fn run_test_case( device_sender.send(event.clone()).await.unwrap(); } } - TestCommand::VersionGated { .. } => unreachable!("filter_commands should not yield VersionGated"), + TestCommand::VersionGated { .. } => { + unreachable!("filter_commands should not yield VersionGated") + } } } } diff --git a/crates/buttplug_tests/tests/util/device_test/client/client_v2/mod.rs b/crates/buttplug_tests/tests/util/device_test/client/client_v2/mod.rs index e3f20d9d5..303bc506b 100644 --- a/crates/buttplug_tests/tests/util/device_test/client/client_v2/mod.rs +++ b/crates/buttplug_tests/tests/util/device_test/client/client_v2/mod.rs @@ -238,7 +238,9 @@ pub async fn run_test_case( device_sender.send(event.clone()).await.unwrap(); } } - TestCommand::VersionGated { .. } => unreachable!("filter_commands should not yield VersionGated"), + TestCommand::VersionGated { .. } => { + unreachable!("filter_commands should not yield VersionGated") + } } } } @@ -314,7 +316,9 @@ pub async fn run_test_case( device_sender.send(event.clone()).await.unwrap(); } } - TestCommand::VersionGated { .. } => unreachable!("filter_commands should not yield VersionGated"), + TestCommand::VersionGated { .. } => { + unreachable!("filter_commands should not yield VersionGated") + } } } } diff --git a/crates/buttplug_tests/tests/util/device_test/client/client_v3/client.rs b/crates/buttplug_tests/tests/util/device_test/client/client_v3/client.rs index 2408a1221..457a2e120 100644 --- a/crates/buttplug_tests/tests/util/device_test/client/client_v3/client.rs +++ b/crates/buttplug_tests/tests/util/device_test/client/client_v3/client.rs @@ -17,7 +17,7 @@ use buttplug_core::{ StartScanningV0, StopScanningV0, }, - util::{stream::convert_broadcast_receiver_to_stream}, + util::stream::convert_broadcast_receiver_to_stream, }; use buttplug_server::message::{ ButtplugClientMessageV3, diff --git a/crates/buttplug_tests/tests/util/device_test/client/client_v3/mod.rs b/crates/buttplug_tests/tests/util/device_test/client/client_v3/mod.rs index 1ae7c722b..366760fb8 100644 --- a/crates/buttplug_tests/tests/util/device_test/client/client_v3/mod.rs +++ b/crates/buttplug_tests/tests/util/device_test/client/client_v3/mod.rs @@ -249,7 +249,9 @@ pub async fn run_test_case( device_sender.send(event.clone()).await.unwrap(); } } - TestCommand::VersionGated { .. } => unreachable!("filter_commands should not yield VersionGated"), + TestCommand::VersionGated { .. } => { + unreachable!("filter_commands should not yield VersionGated") + } } } } @@ -323,7 +325,9 @@ pub async fn run_test_case( device_sender.send(event.clone()).await.unwrap(); } } - TestCommand::VersionGated { .. } => unreachable!("filter_commands should not yield VersionGated"), + TestCommand::VersionGated { .. } => { + unreachable!("filter_commands should not yield VersionGated") + } } } } diff --git a/crates/buttplug_tests/tests/util/device_test/client/client_v4/mod.rs b/crates/buttplug_tests/tests/util/device_test/client/client_v4/mod.rs index 1932430a1..477f0c015 100644 --- a/crates/buttplug_tests/tests/util/device_test/client/client_v4/mod.rs +++ b/crates/buttplug_tests/tests/util/device_test/client/client_v4/mod.rs @@ -336,7 +336,9 @@ pub async fn run_test_case( device_sender.send(event.clone()).await.unwrap(); } } - TestCommand::VersionGated { .. } => unreachable!("filter_commands should not yield VersionGated"), + TestCommand::VersionGated { .. } => { + unreachable!("filter_commands should not yield VersionGated") + } } } } @@ -410,7 +412,9 @@ pub async fn run_test_case( device_sender.send(event.clone()).await.unwrap(); } } - TestCommand::VersionGated { .. } => unreachable!("filter_commands should not yield VersionGated"), + TestCommand::VersionGated { .. } => { + unreachable!("filter_commands should not yield VersionGated") + } } } } diff --git a/crates/buttplug_transport_websocket_tungstenite/src/websocket_server.rs b/crates/buttplug_transport_websocket_tungstenite/src/websocket_server.rs index 288cb199a..6cb93a3ac 100644 --- a/crates/buttplug_transport_websocket_tungstenite/src/websocket_server.rs +++ b/crates/buttplug_transport_websocket_tungstenite/src/websocket_server.rs @@ -236,15 +236,18 @@ impl ButtplugConnectorTransport for ButtplugWebsocketServerTransport { ButtplugConnectorTransportSpecificError::GenericNetworkError(format!("{err:?}")), ) })?; - buttplug_core::spawn!("ButtplugWebsocketServerTransport connection loop", async move { - run_connection_loop( - ws_stream, - outgoing_receiver, - response_sender_clone, - disconnect_notifier_clone, - ) - .await; - }); + buttplug_core::spawn!( + "ButtplugWebsocketServerTransport connection loop", + async move { + run_connection_loop( + ws_stream, + outgoing_receiver, + response_sender_clone, + disconnect_notifier_clone, + ) + .await; + } + ); Ok(()) } else { Err(ButtplugConnectorError::ConnectorGenericError( diff --git a/crates/intiface_engine/src/remote_server.rs b/crates/intiface_engine/src/remote_server.rs index 2fa88cafb..ab1a12a7c 100644 --- a/crates/intiface_engine/src/remote_server.rs +++ b/crates/intiface_engine/src/remote_server.rs @@ -8,7 +8,7 @@ use buttplug_core::{ connector::ButtplugConnector, errors::{ButtplugError, ButtplugHandshakeError}, message::{ButtplugMessageSpecVersion, ButtplugServerMessageV4}, - util::{stream::convert_broadcast_receiver_to_stream}, + util::stream::convert_broadcast_receiver_to_stream, }; use buttplug_server::{ ButtplugServer, ButtplugServerBuilder,