OpenLogi
功能(Features)

0x0005 · deviceTypeAndName

读取设备的市场分类(鼠标、键盘、轨迹球……)及其完整市场名称(分块读取)。

报告设备的类型(鼠标、键盘、轨迹球……)及其市场名称。名称分块读取:getDeviceNameCount() 给出长度,随后 getDeviceName(offset) 返回连续的字节区间。

OpenLogi 用类型来选择正确的示意图,用名称作为设备轮播的标签。

规格: Logitech HID++ 2.0 —— x0005 deviceTypeAndName(v2)。

Function reference

The DeviceTypeAndNameFeature wrapper (0x0005) exposes:

Methods

FunctionHID++ fnSignatureReturns
get_device_name_count0()u8
get_device_name1(index: u8)Vec<u8>
get_whole_device_nameconvenience()String
get_device_type2()DeviceType

get_whole_device_name is a convenience wrapper that calls get_device_name_count (fn 0) and then get_device_name (fn 1) in a loop until the full name is assembled.

All methods are async and return Result<…, Hidpp20Error>.

Types

DeviceType

Represents the marketing category of a HID++ 2.0 device, as returned by get_device_type.

VariantValueDescription
Keyboard0Keyboard device.
RemoteControl1Remote-control device.
Numpad2Numeric keypad device.
Mouse3Mouse device.
Trackpad4Trackpad device.
Trackball5Trackball device.
Presenter6Presenter device.
Receiver7Receiver device.
Headset8Headset device.
Webcam9Webcam device.
SteeringWheel10Steering wheel device.
Joystick11Joystick device.
Gamepad12Gamepad device.
Dock13Dock device.
Speaker14Speaker device.
Microphone15Microphone device.
IlluminationLight16Illumination light device.
ProgrammableController17Programmable controller device.
CarSimPedals18Car-simulator pedals device.
Adapter19Adapter device.

Wire format

All three functions use a 3-byte short-report request payload. Responses from get_device_name_count and get_device_type arrive as a short report and are read via extend_payload()[0]; get_device_name returns the raw payload bytes (3 bytes from a short report, 16 bytes from a long report, depending on device and channel capability).

get_device_name_count (fn 0)

Request: [0x00, 0x00, 0x00] (no parameters)

Response (byte → field):

ByteFieldNotes
0countTotal number of UTF-8 characters in the marketing name

get_device_name (fn 1)

Request: [index, 0x00, 0x00]

ByteFieldNotes
0indexByte offset to start reading from (inclusive)

Response: the raw payload bytes returned by the device. Up to 3 bytes on a short-report channel or up to 16 bytes on a long-report channel. The caller must accumulate chunks until count bytes have been collected, then strip trailing NUL bytes.

get_device_type (fn 2)

Request: [0x00, 0x00, 0x00] (no parameters)

Response (byte → field):

ByteFieldNotes
0device_typeDeviceType enum discriminant (see table above)

Usage (Rust)

use hidpp::feature::device_type_and_name::DeviceTypeAndNameFeature;

// mut device: Device, already created via Device::new(channel, index)
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<DeviceTypeAndNameFeature>() {
    // Read the device type (mouse, keyboard, trackball, …)
    let device_type = feat.get_device_type().await?;
    println!("Device type: {:?}", device_type);

    // Read the full marketing name in one convenience call
    let name = feat.get_whole_device_name().await?;
    println!("Device name: {}", name);

    // Or read it manually: get the length, then fetch chunks
    let count = feat.get_device_name_count().await?;
    let chunk = feat.get_device_name(0).await?;
    println!("Name length: {}, first chunk: {:?}", count, chunk);
}

本页目录