0x2110 · smartShift
读取或写入滚轮模式(自由滚动或棘轮)及滚轮自动脱开进入自由滚动的速度阈值。
原始的 smartShift 滚轮功能。getRatchetControlMode(function 0)读取当前滚轮模式、
自动脱开速度阈值及出厂默认值;setRatchetControlMode(function 1)将它们写回。
传入 None(或字节字段传 0)的字段将保持不变。
- wheelMode ——
Freespin(1)或Ratchet(2);反映软件或按钮设定的模式,而非瞬态的自动脱开状态。 - autoDisengage ——
0x01–0xFE,棘轮模式下滚轮脱开进入自由滚动所需的速度(以四分之一转/秒为单位);0xFF表示永久保持棘轮咬合。 - autoDisengageDefault —— 与当前值一并存储的出厂默认阈值。
注意:OpenLogi 的 SmartShift 面板与 ToggleSmartShift 动作实际驱动的是更新的
0x2111 smartShiftEnhanced 变体。
规格: Logitech HID++ 2.0 —— smartShift。用于:
openlogi-hidpp中的 typed wrapper。
Function reference
The SmartShiftFeature wrapper (0x2110) exposes:
Methods
| Function | HID++ fn | Signature | Returns |
|---|---|---|---|
get_ratchet_control_mode | 0 | () | RatchetControlMode |
set_ratchet_control_mode | 1 | (wheel_mode: Option<WheelMode>, auto_disengage: Option<u8>, auto_disengage_default: Option<u8>) | () |
All methods are async and return Result<…, Hidpp20Error>.
Types
RatchetControlMode
Represents the ratchet control mode of the mouse wheel.
| Field | Type | Description |
|---|---|---|
wheel_mode | WheelMode | The mode the wheel is currently set to. Does not reflect the transient auto-disengage state. |
auto_disengage | u8 | Quarter-turns per second at which the wheel automatically disengages. 0xff disables automatic disengagement (permanent ratchet). |
auto_disengage_default | u8 | The factory-default value of auto_disengage. |
WheelMode
Represents the ratchet mode of the scroll wheel.
| Variant | Value | Description |
|---|---|---|
Freespin | 1 | Free-spin wheel mode. |
Ratchet | 2 | Ratchet wheel mode. |
Wire format
Both functions send a 3-byte short-report request payload. The response is accessed via extend_payload(), which always returns a 16-byte array (zero-padded from a short response); only bytes 0–2 carry meaningful data for get_ratchet_control_mode.
get_ratchet_control_mode (fn 0)
Request: [0x00, 0x00, 0x00] — no parameters; all bytes are zero.
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | wheel_mode | WheelMode enum: 1 = Freespin, 2 = Ratchet |
| 1 | auto_disengage | Quarter-turns/s threshold; 0xFF = permanent ratchet |
| 2 | auto_disengage_default | Factory-default value of auto_disengage |
set_ratchet_control_mode (fn 1)
Request: [wheel_mode_byte, auto_disengage_byte, auto_disengage_default_byte]
| Byte | Source | Notes |
|---|---|---|
| 0 | wheel_mode.map_or(0, u8::from) | 0 = leave unchanged; 1 = Freespin, 2 = Ratchet |
| 1 | auto_disengage.unwrap_or(0) | 0 = leave unchanged; 0x01–0xFE = threshold; 0xFF = permanent |
| 2 | auto_disengage_default.unwrap_or(0) | 0 = leave unchanged; same range as byte 1 |
Response: not used (the device echoes the written values but the wrapper discards them).
Usage (Rust)
use hidpp::{device::Device, feature::smartshift::SmartShiftFeature};
// device: &mut Device, already created via Device::new(channel, index)
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<SmartShiftFeature>() {
// Read current mode
let mode = feat.get_ratchet_control_mode().await?;
println!("wheel_mode={:?}, auto_disengage={}", mode.wheel_mode, mode.auto_disengage);
// Switch to free-spin, keep the auto_disengage threshold unchanged
feat.set_ratchet_control_mode(
Some(hidpp::feature::smartshift::WheelMode::Freespin),
None,
None,
).await?;
}