Buttplug sex toy control library
20
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: Correcting vibe handling for Sam Neo Gen2

authored by

blackspherefollower and committed by
qDot
404c538c 4a3ab9a2

+35 -6
+2 -1
buttplug/buttplug-device-config/buttplug-device-config.json
··· 3822 3822 "services": { 3823 3823 "0000ae00-0000-1000-8000-00805f9b34fb": { 3824 3824 "tx": "0000ae01-0000-1000-8000-00805f9b34fb", 3825 - "rx": "0000ae02-0000-1000-8000-00805f9b34fb" 3825 + "rx": "0000ae02-0000-1000-8000-00805f9b34fb", 3826 + "txmode": "0000ae10-0000-1000-8000-00805f9b34fb" 3826 3827 } 3827 3828 } 3828 3829 },
+1
buttplug/buttplug-device-config/buttplug-device-config.yml
··· 1936 1936 0000ae00-0000-1000-8000-00805f9b34fb: 1937 1937 tx: 0000ae01-0000-1000-8000-00805f9b34fb 1938 1938 rx: 0000ae02-0000-1000-8000-00805f9b34fb 1939 + txmode: 0000ae10-0000-1000-8000-00805f9b34fb 1939 1940 defaults: 1940 1941 name: Svakom Sam Neo 1941 1942 messages:
+32 -5
buttplug/src/server/device/protocol/svakom_sam.rs
··· 5 5 // Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6 6 // for full license information. 7 7 8 - use crate::server::device::hardware::HardwareSubscribeCmd; 8 + use crate::server::device::hardware::{HardwareReadCmd, HardwareSubscribeCmd}; 9 9 use crate::{ 10 10 core::{ 11 11 errors::ButtplugDeviceError, ··· 41 41 hardware 42 42 .subscribe(&HardwareSubscribeCmd::new(Endpoint::Rx)) 43 43 .await?; 44 - Ok(Arc::new(SvakomSam::default())) 44 + let gen2 = hardware 45 + .read_value(&HardwareReadCmd::new(Endpoint::TxMode, 16, 500)) 46 + .await 47 + .is_ok(); 48 + Ok(Arc::new(SvakomSam::new(gen2))) 45 49 } 46 50 } 47 51 48 - #[derive(Default)] 49 - pub struct SvakomSam {} 52 + pub struct SvakomSam { 53 + gen2: bool, 54 + } 55 + impl SvakomSam { 56 + pub fn new(gen2: bool) -> Self { 57 + Self { gen2 } 58 + } 59 + } 50 60 51 61 impl ProtocolHandler for SvakomSam { 52 62 fn keepalive_strategy(&self) -> super::ProtocolKeepaliveStrategy { ··· 60 70 let mut msg_vec = vec![]; 61 71 if let Some((_, speed)) = cmds[0] { 62 72 msg_vec.push( 63 - HardwareWriteCmd::new(Endpoint::Tx, [18, 1, 3, 0, 5, speed as u8].to_vec(), false).into(), 73 + HardwareWriteCmd::new( 74 + Endpoint::Tx, 75 + if self.gen2 { 76 + [ 77 + 18, 78 + 1, 79 + 3, 80 + 0, 81 + if speed == 0 { 0x00 } else { 0x04 }, 82 + speed as u8, 83 + ] 84 + .to_vec() 85 + } else { 86 + [18, 1, 3, 0, 5, speed as u8].to_vec() 87 + }, 88 + false, 89 + ) 90 + .into(), 64 91 ); 65 92 } 66 93 if cmds.len() > 1 {