OpenLogi

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.

  • ChangeHostInfohost_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

FunctionHID++ fnSignatureReturns
get_host_info0()ChangeHostInfo
set_current_host1(host: u8)()
get_cookies2(host_count: u8)Vec<u8>
set_cookie3(host: u8, cookie: u8)()

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

Types

ChangeHostInfo

Host configuration returned by get_host_info.

FieldTypeDescription
host_countu8Number of hosts / RF channels.
current_hostu8Current host index, in 0..host_count.
capabilitiesChangeHostCapabilitiesHost-switching capabilities.

ChangeHostCapabilities

Host-switching capabilities bitflags reported by get_host_info.

FlagBit/ValueDescription
ENHANCED_HOST_SWITCH1 << 0Enhanced 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):

ByteFieldNotes
0host_countTotal number of host slots / RF channels
1current_hostActive host index, zero-based
2capabilitiesChangeHostCapabilities 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]

ByteFieldNotes
0hostTarget host index to activate
1–2Padding, 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.

ByteFieldNotes
0cookie for host 0
1cookie for host 1
cookie for host N-1Up to host_count bytes

Request: [host, cookie, 0x00]

ByteFieldNotes
0hostHost slot index whose cookie is being written
1cookieArbitrary byte value to store in NVM
2Padding, 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?;
}

On this page