0x4530 · dualPlatform
Persist and switch a device's HID key-code table between two OS families (iOS/macOS vs. Android/Windows) — read or write the selection and receive hardware-button change events.
The dualPlatform feature lets a device persist its HID key-code table across two OS families. The selection is set during pairing or by short-pressing a dedicated OS-selection button. getPlatform (function 1) reads the active setting; setPlatform (function 2) writes it and echoes the committed value back; it does not trigger a PlatformChanged notification. A PlatformChanged event is emitted only when the user switches via the hardware button.
0x4530 is the predecessor of 0x4531 multiPlatform; a device exposing 0x4531 should be driven through that feature instead.
IosOrMac(0) — iOS or macOS HID key-code table.AndroidOrWindows(1) — Android or Windows HID key-code table.
Spec: Logitech HID++ 2.0 — dualPlatform. Used by: Typed wrapper in
openlogi-hidpp.
Function reference
The DualPlatformFeature wrapper (0x4530) exposes:
Methods
| Function | HID++ fn | Signature | Returns |
|---|---|---|---|
get_platform | 1 | () | DualPlatformSelection |
set_platform | 2 | (platform: DualPlatformSelection) | DualPlatformSelection |
listen | — | () | async_channel::Receiver<DualPlatformEvent> |
get_platform and set_platform are async and return Result<…, Hidpp20Error>. listen is synchronous and infallible.
Types
DualPlatformSelection
The platform a device is configured for. The selection is persistent, chosen during pairing or by short-pressing an OS-selection button; there is no default.
| Variant | Value | Description |
|---|---|---|
IosOrMac | 0 | iOS or macOS HID key-code table. |
AndroidOrWindows | 1 | Android or Windows HID key-code table. |
Events
DualPlatformFeature implements EmittingFeature<DualPlatformEvent>. Call listen() to obtain an async_channel::Receiver<DualPlatformEvent> that receives hardware-button switch events. set_platform does not trigger this event.
| Variant | Payload | Description |
|---|---|---|
PlatformChanged | DualPlatformSelection | The user changed the platform via an OS-selection button. |
Wire format
Each request carries a 3-byte payload; responses are read from the returned long payload via extend_payload(). The event payload is parsed from the raw HID++ message.
get_platform (fn 1)
Request: [0x00, 0x00, 0x00] — all bytes are unused padding.
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | DualPlatformSelection | 0 = IosOrMac, 1 = AndroidOrWindows |
set_platform (fn 2)
Request: [platform, 0x00, 0x00] — byte 0 is the u8 representation of the new DualPlatformSelection; bytes 1–2 are unused padding.
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | DualPlatformSelection | Device echo of the committed value |
PlatformChanged event (sub-id 0)
Emitted by the hardware OS-selection button. Decoded from the raw HID++ event message when the feature index and func.to_lo() == 0 match.
| Byte | Field | Notes |
|---|---|---|
| 0 | DualPlatformSelection | 0 = IosOrMac, 1 = AndroidOrWindows |
Usage (Rust)
use hidpp::{device::Device, feature::dual_platform::{DualPlatformFeature, DualPlatformEvent, DualPlatformSelection}};
// chan: Arc<HidppChannel>, device_index: u8
let mut device = Device::new(chan, device_index).await?;
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<DualPlatformFeature>() {
// Read the current platform setting.
let current = feat.get_platform().await?;
println!("Current platform: {:?}", current);
// Switch to Android/Windows key-code table and confirm the echo.
let committed = feat.set_platform(DualPlatformSelection::AndroidOrWindows).await?;
println!("Committed: {:?}", committed);
// Listen for hardware-button platform-switch events.
let rx = feat.listen();
if let Ok(DualPlatformEvent::PlatformChanged(p)) = rx.recv().await {
println!("Hardware switch → {:?}", p);
}
}