Press mute key when the headset gets muted / unmuted

This commit is contained in:
Lennard Kittner
2026-02-25 19:38:09 +01:00
parent a5fa443bff
commit 23edae7395
5 changed files with 418 additions and 6 deletions

View File

@@ -17,6 +17,8 @@ use hidapi::{HidApi, HidDevice, HidError};
use std::{collections::HashSet, fmt::Display, time::Duration};
use thistermination::TerminationFull;
const PASSIVE_REFRESH_TIME_OUT: Duration = Duration::from_secs(2);
type DeviceFactory = fn(DeviceState) -> Box<dyn Device>;
struct DeviceEntry {
@@ -660,7 +662,7 @@ pub trait Device {
/// Only the battery level is actively queried because it is not communicated by the device on its own
fn passive_refresh_state(&mut self) -> Result<(), DeviceError> {
if self.allow_passive_refresh() {
if let Some(events) = self.wait_for_updates(Duration::from_secs(1)) {
if let Some(events) = self.wait_for_updates(PASSIVE_REFRESH_TIME_OUT) {
for event in events {
self.get_device_state_mut().update_self_with_event(&event);
}