Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
06be911
feat(hidpp): read and write the 0x1F20 power-off timeout
tkroll-ionos Nov 23, 2026
9d944ee
feat(core): add the headset power-off timeout type and capability
tkroll-ionos Nov 23, 2026
029b0e6
feat(device): read and write a headset's power-off timeout
tkroll-ionos Nov 23, 2026
4f19174
feat(device): re-measure cached devices for the power-off capability
tkroll-ionos Nov 23, 2026
4fc5300
feat(hid): expose the headset power-off timeout on this host
tkroll-ionos Nov 23, 2026
64d7dcc
feat(agent-core): read and write a headset's power-off timeout
tkroll-ionos Nov 23, 2026
f80ea86
feat(fixture): record a headset's power-off timeout in device profiles
tkroll-ionos Nov 23, 2026
c62b7b9
feat(ipc,agent): serve a headset's power-off timeout over IPC
tkroll-ionos Nov 23, 2026
524c195
feat(cli): record a headset's power-off timeout in device profiles
tkroll-ionos Nov 23, 2026
d42f986
feat(i18n): add the headset automatic power-off strings
tkroll-ionos Nov 23, 2026
e2383df
feat(cli): add openlogi diag power-off
tkroll-ionos Nov 23, 2026
a4d8993
feat(gui): let a slider rest on a headset power-off timeout
tkroll-ionos Nov 23, 2026
b7d417b
feat(gui): add the automatic power-off row to the Audio tab
tkroll-ionos Nov 23, 2026
addfaf6
feat(gui): show the Audio tab for a headset with automatic power-off
tkroll-ionos Nov 23, 2026
1548082
feat(tray): offer the headset automatic power-off in the menu-bar item
tkroll-ionos Nov 23, 2026
cbaeb34
docs: note the headset automatic power-off setting
tkroll-ionos Nov 23, 2026
5fa0be2
test(tray): cover the headset automatic power-off submenu
tkroll-ionos Nov 23, 2026
66f6546
fix(gui): hide a refused power-off row beside a working sidetone
tkroll-ionos Nov 23, 2026
c864115
fix(device): read only a refusal of the power-off timeout as unsupported
tkroll-ionos Nov 23, 2026
bdf9374
test(gui): cover the power-off re-read on reconnect
tkroll-ionos Nov 23, 2026
91f398d
docs(gui): name every caller of the power-off re-read
tkroll-ionos Nov 23, 2026
de7c373
test(cli): name the power-off capture test after its gate
tkroll-ionos Nov 23, 2026
8157f4e
feat(i18n): translate the headset automatic power-off strings into Ge…
tkroll-ionos Nov 23, 2026
51d1422
feat(tray): show a power-off timeout between the steps
tkroll-ionos Nov 24, 2026
3418b25
fix(device): log a confirmed power-off timeout change at info
tkroll-ionos Nov 26, 2026
1256e44
fix(gui): ignore the answer to a superseded power-off timeout write
tkroll-ionos Nov 26, 2026
2577264
fix(cli): keep diag power-off off the headset while an agent runs
tkroll-ionos Nov 26, 2026
48b3a01
test(gui): drag the power-off slider in the rendered Audio tab
tkroll-ionos Nov 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Things OpenLogi does that Options+ won't:
- Logi Bolt and Unifying receivers, Bluetooth, and wired connections, with battery level and charge state
- Low-battery notices at the bottom of the screen, once per discharge, with no OS notification permission
- An on-screen indicator when a keyboard turns Caps Lock on or off, plus Num Lock and Scroll Lock on Windows and Linux
- On macOS, a menu-bar menu that lists each device with its battery or light state, flags a missing permission, and changes the settings you reach for most without opening the app: DPI preset, wheel mode, Fn lock, backlight, disabled keys, headset sidetone, and a light's power, brightness, and color temperature. Hold ⌥ to see how each device connects
- On macOS, a menu-bar menu that lists each device with its battery or light state, flags a missing permission, and changes the settings you reach for most without opening the app: DPI preset, wheel mode, Fn lock, backlight, disabled keys, headset sidetone and automatic power-off, and a light's power, brightness, and color temperature. Hold ⌥ to see how each device connects

<table>
<tr>
Expand Down
41 changes: 38 additions & 3 deletions crates/openlogi-agent-core/src/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ use openlogi_core::device_order::{DeviceIdentity, DeviceStableId, PhysicalDevice
use openlogi_hid::{
BacklightChange, BacklightState, CaptureChannelSlot, ChannelPool, ChannelRegistry,
DeviceIoGate, DeviceRoute, DisableKeysMask, Dpi, DpiInfo, EasySwitchHosts, FnLockState,
ForceSensingInfo, GamingWanted, HidppOperation, HostOs, PointerSpeed, ReportRate,
ReportRateInfo, SidetoneLevel, SmartShiftStatus, WriteError, commands_for_light_settings,
is_reserved_keyboard_control, key_display_for,
ForceSensingInfo, GamingWanted, HidppOperation, HostOs, PointerSpeed, PowerOffTimeout,
ReportRate, ReportRateInfo, SidetoneLevel, SmartShiftStatus, WriteError,
commands_for_light_settings, is_reserved_keyboard_control, key_display_for,
};
#[cfg(test)]
use openlogi_ipc::ChosenLight;
Expand Down Expand Up @@ -200,6 +200,8 @@ pub struct SharedHandles {
force_sensing_order: WriteOrder,
/// Orders the GUI's sidetone writes per headset.
sidetone_order: WriteOrder,
/// Orders the GUI's power-off timeout writes per headset.
power_off_timeout_order: WriteOrder,
/// Orders the GUI's backlight writes per keyboard.
backlight_order: WriteOrder,
/// Orders host renames per device.
Expand Down Expand Up @@ -318,6 +320,18 @@ impl SharedHandles {
.await
}

/// Read the automatic power-off timeout of the headset at `route`.
pub async fn read_power_off_timeout(
&self,
route: &DeviceRoute,
) -> Result<PowerOffTimeout, WriteError> {
self.device(route)
.run(HidppOperation::ReadPowerOffTimeout, |c| async move {
openlogi_hid::get_power_off_timeout_on(&c).await
})
.await
}

/// Read the DPI and the DPI values of the mouse at `route`.
pub async fn read_dpi(&self, route: &DeviceRoute) -> Result<DpiInfo, WriteError> {
self.device(route)
Expand Down Expand Up @@ -469,6 +483,26 @@ impl SharedHandles {
.await
}

/// Write `timeout` to the headset at `route` and return the timeout it
/// confirms. When a newer power-off timeout write for the headset is
/// requested before this one gets its turn, this one reads the headset
/// instead of writing a timeout that is about to be replaced.
pub async fn set_power_off_timeout(
&self,
route: &DeviceRoute,
timeout: PowerOffTimeout,
) -> Result<PowerOffTimeout, WriteError> {
let ticket = self.power_off_timeout_order.request(route);
self.device(route)
.run_in_turn(
HidppOperation::WritePowerOffTimeout,
&ticket,
|c| async move { openlogi_hid::set_power_off_timeout_on(&c, timeout).await },
|c| async move { openlogi_hid::get_power_off_timeout_on(&c).await },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Skipped writes report success

When a newer timeout request replaces a queued write, set_power_off_timeout runs a normal read and returns Ok(timeout) if it succeeds. The tray then records that answer as an applied change, even though the request wrote nothing.

This violates the repository’s write-order rule: superseded writes must return WriteSuperseded and update no cache. Return that error here and let the tray treat it as no change. Add a write-order test that queues two timeout changes behind a held turn and checks that the skipped request changes no cached reading.

Rule Used: Severity: high. Every HID++ write to one device takes a ticket from that device's WriteOrder and runs under WriteTicket::in_order (read-modify-write, strict request order) or WriteTicket::turn (idempotent set-value writes only, newest wins). Th... (source)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this one as is. set_power_off_timeout follows set_sidetone, set_report_rate, set_pointer_speed and set_force_sensing on master: a superseded write reads the headset, so its answer is what the headset holds at that moment, never the skipped request. WriteSuperseded is used where the caller would otherwise save the request to config (DPI, Fn lock), and nothing saves the power-off timeout. The tray records that read and the newer write's answer follows it. On the GUI side the write number from the P0 above now drops the older answer. If you'd rather have WriteSuperseded for every device-kept setting, I'd do that in its own PR, sidetone included.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I conflated “this request did not write” with “the returned value falsely claims it did.” The fallback is a read of the headset's current value, and for this device-owned setting that is a valid result; the GUI's write number also prevents an older answer from moving the slider after a newer request. Given the existing newest-wins pattern for these settings, I withdraw this finding for this PR. A broader change to return WriteSuperseded consistently can be considered separately, as you suggest.

)
.await
}

/// Write `dpi` to the mouse at `route`. On a DPI mouse the write ends
/// precision mode, so the pointer moves at the DPI the settings app
/// shows, and darkens the DPI LED when the precision speed ends with it.
Expand Down Expand Up @@ -922,6 +956,7 @@ impl Orchestrator {
pointer_speeds: Arc::default(),
force_sensing_order: WriteOrder::default(),
sidetone_order: WriteOrder::default(),
power_off_timeout_order: WriteOrder::default(),
backlight_order: WriteOrder::default(),
host_name_order: WriteOrder::default(),
host_switch_order: WriteOrder::default(),
Expand Down
31 changes: 29 additions & 2 deletions crates/openlogi-agent/src/bin/mock_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ use openlogi_core::single_instance::{self, InstanceError, Role};
use openlogi_fixture::{DeviceProfile, FixtureError, ProfileDeviceSettings, ProfileSetting};
use openlogi_hid::{
BacklightChange, BacklightState, DeviceRoute, Dpi, DpiInfo, EasySwitchHosts, FnLockState,
ForceSensingInfo, LightCommand, OnboardState, PasskeyMethod, PointerSpeed, ReceiverSelector,
ReportRate, ReportRateInfo, ScrollWheelMode, SidetoneLevel, SmartShiftStatus, WriteError,
ForceSensingInfo, LightCommand, OnboardState, PasskeyMethod, PointerSpeed, PowerOffTimeout,
ReceiverSelector, ReportRate, ReportRateInfo, ScrollWheelMode, SidetoneLevel, SmartShiftStatus,
WriteError,
};
use openlogi_ipc::transport;
use openlogi_ipc::{
Expand Down Expand Up @@ -1603,6 +1604,32 @@ impl Agent for MockAgent {
) -> Result<(), ActionRingCommandError> {
Err(ActionRingCommandError::SessionNotFound)
}
async fn read_power_off_timeout(
self,
_: Context,
route: DeviceRoute,
) -> Result<PowerOffTimeout, WriteError> {
let state = self.state.lock().await;
profile_value(
&state.settings_for(&route)?.power_off_timeout,
&route,
0x1f20,
)
.copied()
}
async fn set_power_off_timeout(
self,
_: Context,
route: DeviceRoute,
timeout: PowerOffTimeout,
) -> Result<PowerOffTimeout, WriteError> {
let mut state = self.state.lock().await;
let settings = state.settings_for_mut(&route)?;
let stored = profile_value_mut(&mut settings.power_off_timeout, &route, 0x1f20)?;
*stored = timeout;
info!(%route, %timeout, "set_power_off_timeout");
Ok(timeout)
}
}

#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions crates/openlogi-agent/src/bin/mock_agent/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub(super) fn unsupported_settings(route: DeviceRoute) -> ProfileDeviceSettings
force_sensing: ProfileSetting::Unsupported,
disable_keys: ProfileSetting::Unsupported,
sidetone: ProfileSetting::Unsupported,
power_off_timeout: ProfileSetting::Unsupported,
lighting: ProfileSupport::Unsupported,
light: ProfileSupport::Unsupported,
}
Expand Down
21 changes: 19 additions & 2 deletions crates/openlogi-agent/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ use openlogi_core::device::DeviceInventory;
use openlogi_hid::{
BacklightChange, BacklightState, DeviceRoute, Dpi, DpiInfo, EasySwitchHosts, FnLockState,
ForceSensingInfo, HapticRestore, HapticRestoreOutcome, HapticWaveform, HidppOperation,
LightCommand, OnboardState, PointerSpeed, ReceiverSelector, ReportRate, ReportRateInfo,
ScrollWheelMode, SidetoneLevel, SmartShiftStatus, WriteError,
LightCommand, OnboardState, PointerSpeed, PowerOffTimeout, ReceiverSelector, ReportRate,
ReportRateInfo, ScrollWheelMode, SidetoneLevel, SmartShiftStatus, WriteError,
};
use openlogi_ipc::transport;
use openlogi_ipc::{
Expand Down Expand Up @@ -599,6 +599,23 @@ impl Agent for AgentServer {
) -> Result<(), ActionRingCommandError> {
self.action_ring.unhover(session_id)
}

async fn read_power_off_timeout(
self,
_: Context,
route: DeviceRoute,
) -> Result<PowerOffTimeout, WriteError> {
self.shared.read_power_off_timeout(&route).await
}

async fn set_power_off_timeout(
self,
_: Context,
route: DeviceRoute,
timeout: PowerOffTimeout,
) -> Result<PowerOffTimeout, WriteError> {
self.shared.set_power_off_timeout(&route, timeout).await
}
}

/// Run the action a ring session closed on, whether a click on the overlay
Expand Down
35 changes: 31 additions & 4 deletions crates/openlogi-agent/src/tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ async fn read_device(shared: &SharedHandles, route: &DeviceRoute, reads: Reads)
Read::Unread
}
}
let (dpi, wheel, fn_lock, backlight, disabled_keys, sidetone) = tokio::join!(
let (dpi, wheel, fn_lock, backlight, disabled_keys, sidetone, power_off_timeout) = tokio::join!(
when(reads.dpi, async {
shared.read_dpi(route).await.map(|info| info.current)
}),
Expand All @@ -480,6 +480,10 @@ async fn read_device(shared: &SharedHandles, route: &DeviceRoute, reads: Reads)
when(reads.backlight, shared.read_backlight(route)),
when(reads.disabled_keys, shared.read_disable_keys(route)),
when(reads.sidetone, shared.read_sidetone(route)),
when(
reads.power_off_timeout,
shared.read_power_off_timeout(route)
),
);
Reading {
dpi,
Expand All @@ -488,13 +492,15 @@ async fn read_device(shared: &SharedHandles, route: &DeviceRoute, reads: Reads)
backlight,
disabled_keys,
sidetone,
power_off_timeout,
}
}

/// Make `change` to `device` as the settings app would: saved settings
/// through the agent's device settings, the backlight and sidetone, which
/// the device keeps itself, on the device alone. Answers the change the
/// device took, or `None` when a newer write superseded it. A change reaches
/// through the agent's device settings, the backlight, sidetone and
/// automatic power-off, which the device keeps itself, on the device alone.
/// Answers the change the device took, or `None` when a newer write
/// superseded it. A change reaches
/// only `device`: another device the agent knows on its route, or that
/// answers there when the change is written, such as one paired into the
/// receiver slot since the menu listed `device`, takes none of it.
Expand Down Expand Up @@ -548,6 +554,27 @@ async fn apply(
Failure::Device
});
}
Change::PowerOffTimeout(timeout) => {
let written = server
.shared
.reaching(device.unit)
.set_power_off_timeout(route, timeout)
.await;
// The settings app re-reads it, as it does after a backlight
// change the agent made.
server
.orchestrator
.lock()
.await
.announce_settings_changed(route);
// A superseded write answers the timeout the headset kept.
return written
.map(|timeout| Some(Change::PowerOffTimeout(timeout)))
.map_err(|error| {
warn!(%route, %error, "menu-bar power-off change failed");
Failure::Device
});
}
};
match saved {
Ok(()) => Ok(Some(change)),
Expand Down
1 change: 1 addition & 0 deletions crates/openlogi-agent/src/tray_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ impl Known {
backlight: capabilities.backlight,
disable_keys: capabilities.disable_keys,
sidetone: capabilities.sidetone,
power_off_timeout: capabilities.power_off_timeout,
light: None,
}
}
Expand Down
Loading