0x0005 · deviceTypeAndName
读取设备的市场分类(鼠标、键盘、轨迹球……)及其完整市场名称(分块读取)。
报告设备的类型(鼠标、键盘、轨迹球……)及其市场名称。名称分块读取:getDeviceNameCount()
给出长度,随后 getDeviceName(offset) 返回连续的字节区间。
OpenLogi 用类型来选择正确的示意图,用名称作为设备轮播的标签。
规格: Logitech HID++ 2.0 —— x0005 deviceTypeAndName(v2)。
Function reference
The DeviceTypeAndNameFeature wrapper (0x0005) exposes:
Methods
| Function | HID++ fn | Signature | Returns |
|---|---|---|---|
get_device_name_count | 0 | () | u8 |
get_device_name | 1 | (index: u8) | Vec<u8> |
get_whole_device_name | convenience | () | String |
get_device_type | 2 | () | 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.
| Variant | Value | Description |
|---|---|---|
Keyboard | 0 | Keyboard device. |
RemoteControl | 1 | Remote-control device. |
Numpad | 2 | Numeric keypad device. |
Mouse | 3 | Mouse device. |
Trackpad | 4 | Trackpad device. |
Trackball | 5 | Trackball device. |
Presenter | 6 | Presenter device. |
Receiver | 7 | Receiver device. |
Headset | 8 | Headset device. |
Webcam | 9 | Webcam device. |
SteeringWheel | 10 | Steering wheel device. |
Joystick | 11 | Joystick device. |
Gamepad | 12 | Gamepad device. |
Dock | 13 | Dock device. |
Speaker | 14 | Speaker device. |
Microphone | 15 | Microphone device. |
IlluminationLight | 16 | Illumination light device. |
ProgrammableController | 17 | Programmable controller device. |
CarSimPedals | 18 | Car-simulator pedals device. |
Adapter | 19 | Adapter 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):
| Byte | Field | Notes |
|---|---|---|
| 0 | count | Total number of UTF-8 characters in the marketing name |
get_device_name (fn 1)
Request: [index, 0x00, 0x00]
| Byte | Field | Notes |
|---|---|---|
| 0 | index | Byte 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):
| Byte | Field | Notes |
|---|---|---|
| 0 | device_type | DeviceType 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);
}