0x1814 · changeHost
Query the number of host slots on a multi-host device and switch the active connection — with per-slot cookie management for enhanced fallback behaviour.
Multi-host devices expose this feature to query how many host slots / RF channels
they support and to switch between them. get_host_info returns a ChangeHostInfo
struct containing the host count, the current host index, and a
ChangeHostCapabilities flags field; set_current_host sends a fire-and-forget
switch to the requested slot; the device typically resets its connection on a
host switch, so no response is awaited.
Two additional functions manage the per-host cookie byte, a small value
stored in the device's non-volatile memory. get_cookies returns one byte per
host slot; set_cookie writes an individual entry. The firmware clears a slot's
cookie when a new host pairs to it. Enhanced host switching
(ENHANCED_HOST_SWITCH capability flag) uses non-zero cookies to select a
fallback host on a failed connection before returning to the original slot.
ChangeHostInfo—host_count,current_host,capabilities.ChangeHostCapabilities::ENHANCED_HOST_SWITCH— on a failed connection, fall back to a host with a non-zero cookie before returning to the original.
Spec: Logitech HID++ 2.0 — changeHost. Used by: Typed wrapper in
openlogi-hidpp.
Function reference
The ChangeHostFeature wrapper (0x1814) exposes methods for querying and changing the active host slot on multi-host devices, plus per-slot cookie management.
Methods
| Function | HID++ fn | Signature | Returns |
|---|---|---|---|
get_host_info | 0 | () | ChangeHostInfo |
set_current_host | 1 | (host: u8) | () |
get_cookies | 2 | (host_count: u8) | Vec<u8> |
set_cookie | 3 | (host: u8, cookie: u8) | () |
All methods are async and return Result<…, Hidpp20Error>.
Types
ChangeHostInfo
Host configuration returned by get_host_info.
| Field | Type | Description |
|---|---|---|
host_count | u8 | Number of hosts / RF channels. |
current_host | u8 | Current host index, in 0..host_count. |
capabilities | ChangeHostCapabilities | Host-switching capabilities. |
ChangeHostCapabilities
Host-switching capabilities bitflags reported by get_host_info.
| Flag | Bit/Value | Description |
|---|---|---|
ENHANCED_HOST_SWITCH | 1 << 0 | Enhanced host switching is enabled: on a failed connection the device falls back to another host with a non-zero cookie before returning to the original host. |
Wire format
Short 3-byte request payloads are used for all functions; responses are read from the 16-byte long payload via extend_payload().
get_host_info (fn 0)
Request: [0x00, 0x00, 0x00] (no parameters)
Response (byte → field):
| Byte | Field | Notes |
|---|---|---|
| 0 | host_count | Total number of host slots / RF channels |
| 1 | current_host | Active host index, zero-based |
| 2 | capabilities | ChangeHostCapabilities bitflags; bit 0 = ENHANCED_HOST_SWITCH |
set_current_host (fn 1)
Sent as a notify (fire-and-forget); no response is read.
Request: [host, 0x00, 0x00]
| Byte | Field | Notes |
|---|---|---|
| 0 | host | Target host index to activate |
| 1–2 | — | Padding, always 0x00 |
get_cookies (fn 2)
Request: [0x00, 0x00, 0x00] (no parameters)
Response: bytes payload[0..host_count] — one cookie byte per host slot in order. The caller supplies host_count (from get_host_info) to slice the response; bytes beyond host_count are ignored.
| Byte | Field | Notes |
|---|---|---|
| 0 | cookie for host 0 | |
| 1 | cookie for host 1 | |
| … | cookie for host N-1 | Up to host_count bytes |
set_cookie (fn 3)
Request: [host, cookie, 0x00]
| Byte | Field | Notes |
|---|---|---|
| 0 | host | Host slot index whose cookie is being written |
| 1 | cookie | Arbitrary byte value to store in NVM |
| 2 | — | Padding, always 0x00 |
The device ACK response is awaited but its payload is discarded.
Usage (Rust)
use hidpp::feature::change_host::ChangeHostFeature;
// device: &mut Device, already created via Device::new(channel, index)
device.enumerate_features().await?;
if let Some(feat) = device.get_feature::<ChangeHostFeature>() {
// Query host count, current host, and capabilities
let info = feat.get_host_info().await?;
println!("hosts: {}, current: {}", info.host_count, info.current_host);
// Read the per-host cookies (one byte per slot)
let cookies = feat.get_cookies(info.host_count).await?;
println!("cookies: {:?}", cookies);
// Switch to host 1 (fire-and-forget; device will reset its connection)
feat.set_current_host(1).await?;
}