How to Control Logitech Mouse DPI Settings with OpenLogi

Yes, OpenLogi provides complete control over Logitech mouse DPI settings through its HID++ driver, supporting both legacy and modern mice via the AdjustableDpi and ExtendedAdjustableDpi features.

OpenLogi is an open-source alternative to Logitech Options that enables full DPI management for compatible HID++ mice. By abstracting the low-level protocol differences between device generations, the project exposes a unified API for reading, writing, and persisting DPI configurations across CLI, GUI, and programmatic interfaces.

Understanding OpenLogi's DPI Architecture

The HID++ driver (openlogi-device) automatically discovers the mouse's DPI capabilities by querying feature IDs 0x2201 (AdjustableDpi) or 0x2202 (ExtendedAdjustableDpi). This transparent detection ensures OpenLogi works with older Logitech hardware that exposes only the legacy feature, as well as newer models requiring the extended protocol.

The architecture routes DPI commands through a layered stack:


UI/CLI → IPC (openlogi-agent) → SharedChannel → hidpp::Device → DpiFeature::set_dpi()

This design decouples the user interface from hardware-specific implementation details, allowing the same set_dpi call to function regardless of whether the underlying device uses 0x2201 or 0x2202.

Core DPI Operations

OpenLogi exposes three high-level operations implemented in crates/openlogi-device/src/write/dpi.rs:

  • openlogi_hid::get_dpi(&route) – Returns the current active DPI value
  • openlogi_hid::get_dpi_info(&route) – Retrieves the full capability list including supported DPI steps
  • openlogi_hid::set_dpi(&route, dpi) – Writes a new DPI value to the device firmware

Reading Current DPI and Capabilities

Before modifying settings, applications should query the device's capabilities to determine valid DPI ranges. The driver returns a structured response containing both the current setting and an iterator of supported values.

Writing New DPI Values

When set_dpi is invoked, the driver selects the appropriate HID++ feature ID internally. The implementation includes read-back verification (lines 1000–1010 of dpi.rs) to confirm the firmware accepted the value, reporting a mismatch if the device rejects the requested DPI.

Accessing DPI Controls Through OpenLogi

OpenLogi provides three primary interfaces for DPI management, each suited to different workflows.

Command-Line Interface

The CLI offers immediate, scriptable control via the openlogi diag dpi command implemented in crates/openlogi-cli/src/cmd/diag/dpi.rs. This performs a round-trip test: reading capabilities, writing a test DPI, verifying the result, and restoring the original value.


# Run automated DPI diagnostics with auto-selected target

openlogi diag dpi

# Explicitly set DPI to 1200

openlogi diag dpi --target 1200

Agent IPC and GUI Integration

For desktop environments, the OpenLogi Agent exposes DPI controls through IPC. The agent's RPC handler in crates/openlogi-agent/src/server.rs accepts set_dpi requests from the GUI or third-party clients, forwarding them to the HID driver via a SharedChannel.

The desktop UI (crates/openlogi-desktop/src/services/ipc.rs) invokes this RPC when users adjust settings in the Settings panel, ensuring real-time synchronization between the interface and hardware.

Persistent Configuration

Users can persist DPI presets or concrete values in OpenLogi's TOML configuration. The Config struct in crates/openlogi-core/src/config.rs provides two key methods:

  • Config::set_dpi – Stores a single DPI value that the agent reapplies on device reconnect
  • Config::set_dpi_presets – Stores a vector of preset values for cycling via hardware buttons or UI selection

Implementation Details in the Source Code

The DPI implementation spans several crates with distinct responsibilities:

The driver automatically negotiates with the firmware to determine whether to use feature 0x2201 or 0x2202, eliminating the need for user-side compatibility checks.

Practical Code Examples

Programmatic DPI Control

use openlogi_hid::{self, Dpi};

// 1. Obtain a device route from the inventory
let route = /* DeviceRoute obtained from discovery */;

// 2. Query current DPI and supported values
let info = openlogi_hid::get_dpi_info(&route).await?;
println!("Current DPI: {}", info.current);
println!("Supported values: {:?}", info.capabilities.values());

// 3. Set a new DPI (must be in the supported list)
let new_dpi = Dpi::new(1600);
openlogi_hid::set_dpi(&route, new_dpi).await?;

// 4. Verify the write succeeded
let after = openlogi_hid::get_dpi(&route).await?;
assert_eq!(after, new_dpi);

Persistent DPI Presets

use openlogi_core::hid::Dpi;
use openlogi_core::config::Config;

let mut cfg = Config::default();
let device_key = "receiver:abcd1234:slot:1"; // Stable device identifier

// Store multiple presets for hardware button cycling
cfg.set_dpi_presets(device_key, vec![
    Dpi::new(800),
    Dpi::new(1600),
    Dpi::new(2400)
]);

// Or set a default value for automatic reapplication
cfg.set_dpi(device_key, Dpi::new(1600));

Summary

  • OpenLogi controls Logitech mouse DPI settings through a unified abstraction over HID++ features 0x2201 and 0x2202.
  • The driver implements read, write, and capability discovery operations in crates/openlogi-device/src/write/dpi.rs.
  • Users can adjust DPI via CLI diagnostics, Agent IPC for GUI integration, or persistent TOML configuration.
  • Automatic feature detection ensures compatibility with both legacy and modern Logitech mice without manual protocol selection.
  • Built-in read-back verification confirms that firmware accepts DPI changes before reporting success.

Frequently Asked Questions

Does OpenLogi support all Logitech mice?

OpenLogi supports Logitech mice that implement the HID++ protocol and expose either the AdjustableDpi (0x2201) or ExtendedAdjustableDpi (0x2202) feature. Most modern Logitech gaming and productivity mice include these features, though basic HID-only devices without HID++ support are not compatible.

What is the difference between AdjustableDpi and ExtendedAdjustableDpi?

AdjustableDpi (feature 0x2201) is the legacy protocol used in older mice, while ExtendedAdjustableDpi (feature 0x2202) supports higher precision settings and additional capabilities in newer hardware. OpenLogi's driver in dpi.rs transparently handles both protocols, presenting an identical API regardless of which feature the mouse exposes.

Can I set DPI presets that persist across reboots?

Yes. Use the Config::set_dpi_presets method to store a list of DPI values in the OpenLogi configuration file. The agent automatically reapplies these settings when the mouse reconnects, ensuring consistent behavior across system restarts without requiring manual intervention through the CLI or GUI.

How does OpenLogi verify that DPI changes were applied successfully?

After writing a new DPI value via set_dpi, the driver performs a read-back operation to confirm the firmware reports the same value. If the read-back differs from the requested setting (indicating the firmware rejected the value or rounded it), OpenLogi reports a mismatch error rather than falsely confirming success.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →