OpenLogi

0x2100 · verticalScrolling

读取设备垂直滚轮报告的滚轮类型、每圈棘齿数和首选滚动量。

verticalScrolling 报告垂直滚轮的物理属性和首选滚动属性。OpenLogi v0.8.15 提供只读的类型化封装,但设备层和用户界面不使用此信息。

**规格:**Logitech HID++ 2.0 —— verticalScrolling。**交叉核对:**Solaar。**用于:**OpenLogi 不使用。

函数参考

VerticalScrollingFeature(0x2100)支持 feature 版本 0,并提供一个异步读取方法。

方法

函数HID++ fn签名返回值
get_roller_info0()Result<RollerInfo, Hidpp20Error>

类型

RollerInfo

字段类型说明
roller_typeRollerType滚轮机械类型。
ratchets_per_turnu8一整圈中的物理棘齿数。
scroll_linesScrollLines首选滚动量。

RollerType

变体值说明
Standard0x01标准的一维或二维滚轮。
ThreeG0x033G 滚轮。
MicroRatchet0x04微棘齿滚轮。
Touchpad0x05触控板滚动。
TouchpadNaturalDefault0x06默认启用自然滚动的触控板。

ScrollLines

变体值说明
SystemDefault0x00保持主机系统设置。
Lines(u8)0x01–0xFE每次移动滚动此行数。
Page0xFF每次移动滚动一整页或一整屏。

事件

此 feature 没有定义事件。

线格式

OpenLogi 发送三个零字节,并在解码前将回复扩展为 16 字节缓冲区。已定义字段位于字节 0~2。

get_roller_info(fn 0)

请求:[0x00, 0x00, 0x00]。三个字节均为填充。

回复:

字节字段说明
0roller_typeRollerType 值。未知值会使 OpenLogi 返回 Hidpp20Error::UnsupportedResponse。
1ratchets_per_turn原始 u8 计数。
2scroll_lines0x00 为 SystemDefault;0xFF 为 Page;其他值均为 Lines(value)。
3~15保留OpenLogi 忽略这些字节。

OpenLogi 的用法

feature 注册表会为版本 0 或更高版本的 0x2100 实例化 VerticalScrollingFeature。v0.8.15 的设备层、库存层、会话层、agent 层和桌面层均不消费 RollerInfo。因此,OpenLogi 不为此 feature 执行写入、读回、能力门控、状态恢复或用户操作。

Rust 用法

use std::sync::Arc;

use hidpp::{
    channel::HidppChannel,
    device::Device,
    feature::vertical_scrolling::VerticalScrollingFeature,
};

async fn read_roller_info(
    channel: Arc<HidppChannel>,
    device_index: u8,
) -> Result<(), Box<dyn std::error::Error>> {
    let mut device = Device::new(channel, device_index).await?;
    device.enumerate_features().await?;

    let Some(feature) = device.get_feature::<VerticalScrollingFeature>() else {
        return Ok(());
    };
    let info = feature.get_roller_info().await?;
    println!("{info:?}");
    Ok(())
}

本页目录