OpenLogi

0x2201 · adjustableDpi

Per-sensor pointer resolution — enumerate supported DPI values and read or write the current DPI.

0x2201 controls one DPI value for each motion sensor. It reports the sensor count, supported DPI values, and the current DPI. Feature version 1 also reports a default DPI value.

Spec: Logitech HID++ 2.0 — x2201 adjustableDpi. Cross-checked: Logi Options+ 2.8 (static analysis), Solaar. Used by: DPI.

Function reference

AdjustableDpiFeature is the OpenLogi wrapper for 0x2201. Its methods are asynchronous and return Result<T, Hidpp20Error>.

Methods

FunctionHID++ fnSignatureReturns
get_sensor_count0()u8
get_sensor_dpi_list1(sensor_index: u8)Vec<u16>
get_sensor_dpi2(sensor_index: u8)u16
set_sensor_dpi3(sensor_index: u8, dpi: u16)()

Types

The wrapper uses a u8 sensor index and u16 DPI values. get_sensor_dpi_list returns values in ascending order without duplicates.

Events

OpenLogi v0.8.15 declares no 0x2201 event type.

Wire format

Functions 0–2 use three-byte short payloads. set_sensor_dpi uses that form in feature versions 0 and 1. Every multi-byte DPI value uses BE byte order. The wrapper calls extend_payload() for replies, so it does not require a long reply.

get_sensor_count (fn 0)

Request: [0x00, 0x00, 0x00].

ByteFieldNotes
0sensor_countNumber of motion sensors.
1–15/OpenLogi ignores these bytes.

get_sensor_dpi_list (fn 1)

Request: [sensor_index, 0x00, 0x00].

BytesFieldNotes
0echoed sensor_indexOpenLogi requires this value to match the request. A mismatch returns Hidpp20Error::UnsupportedResponse.
1–14DPI wordsUp to seven BE u16 words, decoded in order.
15trailing byteIt cannot form a complete word. OpenLogi ignores it.

0x0000 terminates the list. A full list has no terminator. A literal DPI word has top three bits other than 0b111. A word with top three bits 0b111 is a range marker. Its low 13 bits are the positive step.

The preceding literal is the range start. The following literal is the range end. OpenLogi expands the range, keeps an off-step end value, then sorts and deduplicates the result. A leading marker, a zero step, a missing end, or a descending end returns Hidpp20Error::UnsupportedResponse.

get_sensor_dpi (fn 2)

Request: [sensor_index, 0x00, 0x00].

BytesFieldNotes
0echoed sensor_indexThe protocol supplies this echo. OpenLogi ignores it for this function.
1–2current_dpiBE u16. OpenLogi returns this value.
3–4default_dpiBE u16 in feature version 1 and later. Version 0 uses zero. OpenLogi ignores these bytes.
5–15/OpenLogi ignores these bytes.

set_sensor_dpi (fn 3)

BytesFieldNotes
0sensor_indexTarget sensor.
1–2dpiBE u16.
3dpi_levelPresent for feature version 2 and later in Logi Options+ 2.8 static analysis. Its meaning is not confirmed.

For feature versions before 2, the request ends after byte 2. OpenLogi v0.8.15 always sends the three-byte form. It ignores the acknowledgment payload.

How OpenLogi uses it

The device layer resolves 0x2201 before 0x2202. It uses only sensor 0. It rejects a device that reports zero sensors. For 0x2201, it reads the current DPI and the supported DPI list.

Before a write, OpenLogi checks that the requested DPI exactly matches a device-reported value. Otherwise it returns WriteError::DpiUnsupported without sending a packet. It reads back the DPI after a write and retries once. A second different value returns WriteError::DpiNotApplied. A failed read-back leaves the acknowledged write in place.

The desktop saves a requested DPI before its asynchronous device write. Therefore, a rejected or unapplied write can leave the requested value in desktop state until a later live read. The agent re-applies the saved DPI after reconnect because the sensor setting is volatile. OpenLogi has no feature-specific reset when it exits.

OpenLogi exposes neither default_dpi nor a version-2 dpi_level. The user-facing control is the DPI page.

Open questions

Logi Options+ 2.8 writes a fourth dpi_level byte for 0x2201 version 2 and later. The public specification stops at version 1. Static analysis does not establish the field's meaning or hardware availability. OpenLogi sends the version-0/1 form for every version.

Usage (Rust)

use hidpp::{
    device::Device,
    feature::adjustable_dpi::AdjustableDpiFeature,
    protocol::v20::Hidpp20Error,
};

async fn set_first_other_dpi(device: &mut Device) -> Result<(), Hidpp20Error> {
    device.enumerate_features().await?;
    if let Some(feature) = device.get_feature::<AdjustableDpiFeature>() {
        let sensor_count = feature.get_sensor_count().await?;
        let supported = feature.get_sensor_dpi_list(0).await?;
        let current = feature.get_sensor_dpi(0).await?;

        println!("sensors: {sensor_count}, current DPI: {current}");
        if let Some(&next) = supported.iter().find(|&&dpi| dpi != current) {
            feature.set_sensor_dpi(0, next).await?;
        }
    }

    Ok(())
}

On this page