OpenLogi
功能(Features)

0x4531 · multiPlatform

为多主机设备的每个主机槽关联操作系统平台——查询功能能力与平台描述符,并读取任意主机槽当前分配的平台及其选择来源。

MultiPlatform 功能让多主机设备能将每个主机槽与特定的操作系统平台关联,使固件能够自动应用针对不同主机的按键映射与行为调整。getFeatureInfos 报告功能特性、可用平台数量、描述符行数、主机槽总数以及当前活跃的主机槽。getPlatformDescriptor 获取单条描述符行,该行编码了所覆盖的操作系统(OsMask)以及适用的 OS 版本范围。getHostPlatform 读取指定主机槽当前分配的平台及其选择来源(PlatformSource)。

  • MultiPlatformCapabilities —— OS_DETECTION(设备可自动检测主机操作系统),SET_HOST_PLATFORM(主机软件可覆盖该选择)。
  • OsMask —— 位域,涵盖 Windows、WindowsEmbedded、Linux、ChromeOS、Android、macOS、iOS、webOS 和 Tizen。
  • PlatformSource —— Default(设备默认)、Auto(设备自动检测)、Manual(在设备上手动设置)或 Software(由主机软件设置)。

规格: Logitech HID++ 2.0 —— multiPlatform用于: openlogi-hidpp 中的类型化封装。

Function reference

The MultiPlatformFeature wrapper (0x4531) exposes:

Methods

FunctionHID++ fnSignatureReturns
get_feature_infos0()MultiPlatformInfo
get_platform_descriptor1(descriptor_index: u8)PlatformDescriptor
get_host_platform2(host: HostIndex)HostPlatform

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

Types

MultiPlatformInfo

Static feature information returned by get_feature_infos.

FieldTypeDescription
capabilitiesMultiPlatformCapabilitiesFeature capabilities.
platform_countu8Number of platform IDs.
descriptor_countu8Number of platform descriptor rows.
host_countu8Number of host slots.
current_hostHostIndexCurrent host slot.
current_host_platformOption<u8>Platform index selected for the current host.

MultiPlatformCapabilities

Capabilities reported by MultiPlatform.

FlagBit/ValueDescription
OS_DETECTION1 << 0The device can detect the host OS automatically.
SET_HOST_PLATFORM1 << 1Software can set the host platform.

PlatformDescriptor

A platform descriptor row returned by get_platform_descriptor.

FieldTypeDescription
platform_indexu8Platform index this descriptor belongs to.
descriptor_indexu8Descriptor row index.
os_maskOsMaskCovered operating systems.
from_versionu8First supported OS major version.
from_revisionu8First supported OS revision.
to_versionu8Last supported OS major version.
to_revisionu8Last supported OS revision.

OsMask

Operating systems covered by a platform descriptor.

FlagBit/ValueDescription
WINDOWS1 << 0Microsoft Windows.
WINDOWS_EMBEDDED1 << 1Windows Embedded.
LINUX1 << 2Linux.
CHROME1 << 3ChromeOS.
ANDROID1 << 4Android.
MACOS1 << 5macOS.
IOS1 << 6iOS.
WEBOS1 << 7webOS.
TIZEN1 << 8Tizen.

HostPlatform

Platform selection for a host slot returned by get_host_platform.

FieldTypeDescription
host_indexHostIndexHost slot index returned by the device.
statusu8Raw host status byte.
platform_indexOption<u8>Selected platform, or None when undefined.
sourcePlatformSourceSource of the platform selection.
auto_platform_indexOption<u8>Automatically detected platform, if available.
auto_descriptor_indexOption<u8>Automatically matched platform descriptor, if available.

PlatformSource

Source of a host-platform selection.

VariantValueDescription
Default0Device default.
Auto1Automatically detected by the device.
Manual2Manually selected on the device.
Software3Set by host software.

HostIndex

A host slot selector (defined in hosts_info).

VariantValueDescription
Current0xffThe host slot currently selected by the device.
Slot(u8)00xfeA zero-based host slot index.

Wire format

All three functions use a short 3-byte request payload; responses are read from the 16-byte long payload returned by extend_payload().

get_feature_infos (fn 0)

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

Response (byte → field):

ByteFieldNotes
0–1capabilitiesMultiPlatformCapabilities as big-endian u16
2platform_countNumber of platform IDs
3descriptor_countNumber of descriptor rows
4host_countNumber of host slots
5current_hostHostIndex::from(byte)0xffCurrent
6current_host_platform0xffNone; otherwise Some(byte)

get_platform_descriptor (fn 1)

Request: [descriptor_index, 0x00, 0x00]

Response (byte → field):

ByteFieldNotes
0platform_indexPlatform index the descriptor belongs to
1descriptor_indexDescriptor row index (echoed back)
2–3os_maskOsMask as big-endian u16
4from_versionFirst supported OS major version
5from_revisionFirst supported OS revision
6to_versionLast supported OS major version
7to_revisionLast supported OS revision

get_host_platform (fn 2)

Request: [u8::from(host), 0x00, 0x00]HostIndex::Current encodes as 0xff; HostIndex::Slot(n) encodes as n.

Response (byte → field):

ByteFieldNotes
0host_indexHostIndex::from(byte)
1statusRaw host status byte
2platform_index0xffNone; otherwise Some(byte)
3sourcePlatformSource — 0 = Default, 1 = Auto, 2 = Manual, 3 = Software
4auto_platform_index0xffNone; otherwise Some(byte)
5auto_descriptor_index0xffNone; otherwise Some(byte)

Usage (Rust)

use hidpp::{
    device::Device,
    feature::multi_platform::{MultiPlatformFeature, OsMask},
    feature::hosts_info::HostIndex,
};

// mut device: Device, already created via Device::new(channel, index).await?
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<MultiPlatformFeature>() {
    let info = feat.get_feature_infos().await?;
    println!("hosts={}, platforms={}", info.host_count, info.platform_count);

    // Read the descriptor at index 0
    let desc = feat.get_platform_descriptor(0).await?;
    println!("os_mask={:?}, versions={}.{}–{}.{}", desc.os_mask,
        desc.from_version, desc.from_revision, desc.to_version, desc.to_revision);

    // Read the platform for the current host
    let hp = feat.get_host_platform(HostIndex::Current).await?;
    println!("platform={:?}, source={:?}", hp.platform_index, hp.source);
}

本页目录