Expand description
OpenLogi’s HID++ device layer: everything that knows Logitech’s protocol and nothing about a host.
backend::HidBackend is the seam. Above it sits this crate — enumeration
and probing, the write layer, capture sessions, pairing. Below it sits one
implementation per host HID API: openlogi-hid over async-hid, a
scripted device tree in tests, WebHID under wasm if that is ever built.
Nothing here opens a device by itself; everything that needs one is handed
a backend. That is what makes the layer reusable, and it is checked rather
than trusted — CI’s wasm (portable crates) job builds this crate for a
target with no OS underneath it, so a dependency that assumes one fails
there and nowhere else.
Re-exports§
pub use backend::BackendError;pub use backend::HidBackend;pub use backend::HotplugEvent;pub use backend::HotplugStream;pub use backend::NodeId;pub use backend::NodeInfo;pub use backend::RawWriter;pub use inventory::hotplug::watch_hotplug;pub use inventory::standalone::enumerate_standalone;pub use inventory::Enumerator;pub use inventory::InventoryError;pub use inventory::enumerate;pub use pairing::DiscoveredDevice;pub use pairing::PairingCommand;pub use pairing::PairingEvent;pub use pairing::PairingReceiver;pub use pairing::ReceiverFamily;pub use pairing::list_pairing_receivers;pub use pairing::run_pairing;pub use pairing::unpair;pub use session::gesture::CaptureChannelSlot;pub use session::gesture::CaptureError;pub use session::gesture::CaptureHost;pub use session::gesture::CaptureSessionFailure;pub use session::gesture::CaptureSessionOutcome;pub use session::gesture::CaptureSessionStop;pub use session::gesture::CapturedInput;pub use session::gesture::PendingCaptureRestore;pub use session::gesture::run_capture_session;pub use session::host_switch::HostSwitchError;pub use session::host_switch::HostSwitchRestoreOutcome;pub use session::host_switch::HostSwitchSessionFailure;pub use session::host_switch::HostSwitchSessionOutcome;pub use session::host_switch::HostSwitchStopReason;pub use session::host_switch::PendingHostSwitchRestore;pub use session::host_switch::run_host_switch_session;pub use session::host_switch::switch_linked_hosts;pub use session::keyboard::RESERVED_KEYBOARD_CONTROLS;pub use session::keyboard::is_reserved_keyboard_control;pub use session::keyboard::run_keyboard_capture_session;pub use write::FeatureEntry;pub use write::FirmwareEntity;pub use write::FirmwareEntityInfo;pub use write::HostOs;pub use write::LightingMethod;pub use write::OsLayoutOutcome;pub use write::OsVersion;pub use write::ReprogControlEntry;pub use write::apply_litra;pub use write::dump_features;pub use write::dump_firmware_entities;pub use write::dump_reprog_controls;pub use write::encode_litra_command;pub use write::ensure_haptics_armed_on;pub use write::get_backlight;pub use write::get_backlight_on;pub use write::get_dpi;pub use write::get_dpi_info;pub use write::get_dpi_info_on;pub use write::get_easy_switch_hosts;pub use write::get_easy_switch_hosts_on;pub use write::get_fn_lock;pub use write::get_fn_lock_on;pub use write::get_report_rate_info;pub use write::get_report_rate_info_on;pub use write::get_scroll_wheel_mode;pub use write::get_scroll_wheel_mode_on;pub use write::get_smartshift_status;pub use write::get_smartshift_status_on;pub use write::keep_os_layout_on;pub use write::litra_model_for_route;pub use write::play_haptic;pub use write::play_haptic_on;pub use write::read_battery_raw;pub use write::rename_easy_switch_host;pub use write::rename_easy_switch_host_on;pub use write::set_dpi;pub use write::set_dpi_on;pub use write::set_fn_lock;pub use write::set_fn_lock_on;pub use write::set_keyboard_color;pub use write::set_keyboard_color_on;pub use write::set_keyboard_color_with;pub use write::set_keyboard_color_with_on;pub use write::set_report_rate;pub use write::set_report_rate_on;pub use write::set_scroll_inversion;pub use write::set_scroll_inversion_on;pub use write::set_scroll_resolution;pub use write::set_scroll_resolution_on;pub use write::set_scroll_wheel_mode;pub use write::set_scroll_wheel_mode_on;pub use write::set_smartshift;pub use write::set_smartshift_on;pub use write::set_smartshift_sensitivity;pub use write::toggle_smartshift;pub use write::toggle_smartshift_on;pub use write::update_backlight;pub use write::update_backlight_on;
Modules§
- backend
- The contract between OpenLogi’s HID++ layer and the HID stack beneath it.
- backlight
- Compatibility re-exports for semantic keyboard-backlight types.
- host_
lock - Advisory locks shared by every OpenLogi process on the host.
- inventory
- Enumerate connected HID++ receivers and their paired devices.
- pairing
- Wireless device pairing for Logi Bolt and Unifying receivers.
- replay
- Strict cassette replay over the production device-layer contracts.
- reprog_
controls - HID++
ReprogControlsV4(feature0x1b04) — temporary control diversion and raw-XY reporting, the mechanism behind MX-line reprogrammable controls. - session
- Long-running device sessions.
- smartshift
- HID++
SmartShift Enhanced(feature0x2111) — wheel ratchet ↔ free-spin control with sensitivity threshold. - thumbwheel
- HID++
Thumbwheel(feature0x2150) — divert the MX-line horizontal thumb wheel so its rotation and single-tap gesture arrive as HID++ events instead of native HID scroll. - write
- HID++ reads and writes per feature — DPI, SmartShift, wheel modes, lighting, backlight, and diagnostics.
Structs§
- Backlight
Controls - What software may change on a keyboard backlight beyond turning it on or
off, from the
0x1982capability bits and feature version. - Backlight
State - Snapshot of a keyboard’s backlight, merged from the
0x1982getBacklightConfigandgetBacklightInforesponses. - Channel
Pool - Reuses one open HID++ channel for routes on the same receiver.
- Channel
Registry - Channels already opened and owned by the persistent inventory enumerator.
- Device
IoGate - Cheaply cloneable read capability for device-I/O producers.
- Device
IoSignal - Non-blocking producer owned by the host lifecycle observer.
- Dpi
- A sensor resolution that fits HID++’s unsigned 16-bit DPI field.
- DpiCapabilities
- Supported DPI values reported by a device’s HID++ AdjustableDpi feature.
- DpiInfo
- Current DPI plus the supported values reported by the device.
- Easy
Switch Hosts - The Easy-Switch channels of a multi-host device, read from
0x1815. - Easy
Switch Slot - One Easy-Switch channel of a multi-host device.
- FnLock
State - What a keyboard reports about its Fn-lock: whether a bare F-key currently
sends F1–F12 (
fn_lock), and what it does out of the box. - Host
OsInfo - The OS and version the computer on a slot recorded in the device.
- IoSuspended
- The gate’s refusal while host device I/O is suspended.
- Litra
Descriptor - A known Litra raw-HID identity and its static product metadata.
- OsMask
- Operating systems covered by a platform descriptor.
- Receiver
Descriptor - A known receiver’s USB identity and the behavior OpenLogi assigns to it.
- Report
Rate - How often a device sends movement reports, in whole hertz.
- Report
Rate Info - A device’s report rate and the rates it lets software choose.
- Scroll
Wheel Mode - Current HID++
0x2121wheel reporting mode. - Shared
Channel - An open HID++ channel to a device, shared so route-addressed reads and writes can reuse an inventory- or capture-owned connection instead of re-enumerating and opening a fresh channel each time (which costs ~100ms+).
- Smart
Shift Status - Snapshot returned from OpenLogi’s SmartShift read helpers.
- Smart
Shift Threshold - A SmartShift auto-disengage speed threshold in firmware units of 0.25 turn/s.
- Tunable
Torque - A SmartShift Enhanced tunable-torque level, in percent of the wheel’s maximum force.
- Weak
Shared Channel - A
SharedChannelthat does not keep its connection open. Two handles are equal when they name the same connection to the same route, so a replug or another device answering on the route compares unequal.
Enums§
- Backlight
Change - One change to a keyboard backlight, written to the keyboard’s own memory.
- Backlight
Mode - How the firmware decides the backlight brightness level.
- Backlight
Status - Why the backlight is in its current state, as reported by the device.
- Click
- A single click in a pointer passkey sequence.
- Device
Route - How to reach a controllable HID++ device.
- Haptic
Waveform - A haptic waveform ID accepted by
playWaveform. - Hidpp
Feature Error Kind - HID++ feature error kind in a serializable wire-safe form.
- Hidpp
Operation - HID++ operation being performed when a device write/read failed.
- Host
Connection - How a host slot reaches its computer.
- Host
OsKind - An operating system a host slot can record.
- Light
Command - A semantic command accepted by the standalone-light layer.
- Litra
Model - A supported Litra product model.
- Pairing
Error - Errors raised by pairing operations.
- Passkey
Method - How the user authenticates the device during Bolt pairing.
- Receiver
Brand - Logitech receiver product family, independent of its wire protocol.
- Receiver
Protocol - Receiver protocol implementation used to enumerate and address devices.
- Receiver
Selector - Selects which receiver a pairing operation targets.
- Scroll
Reporting Target - Destination for vertical wheel movement reports.
- Scroll
Resolution - Vertical wheel reporting resolution for HID++
0x2121 HiResWheel. - Smart
Shift Auto Disengage - SmartShift’s auto-disengage behavior.
- Smart
Shift Mode - SmartShift mode values understood by the firmware.
Free= free-spin,Ratchet= clicky / smartshift-off. The discriminant is the wire byte; reserved values (0/3/ future) failTryFromand callers fall back to whatever they consider sane. - Write
Error - Error returned by HID++ read/write operations.
Constants§
- DIRECT_
DEVICE_ INDEX - HID++ device index that addresses a directly-attached device’s own features (USB-cable or Bluetooth, no receiver indirection).
- LITRA_
BEAM_ PRODUCT_ ID - Litra Beam product ID.
- LITRA_
GLOW_ PRODUCT_ ID - Litra Glow product ID.
- LOGITECH_
VENDOR_ ID - Logitech’s USB/Bluetooth vendor ID.
- RECEIVERS
- All receiver identities supported by OpenLogi.
Functions§
- commands_
for_ light_ settings - Expand protocol-neutral saved settings into only the controls advertised by a standalone light. Unsupported controls are omitted rather than sent speculatively, which keeps power-only and brightness-only drivers usable.
- device_
io_ channel - Create an initially-open device-I/O gate.
- find_
litra - Finds a Litra descriptor by its complete writable raw-HID identity.
- find_
receiver - Finds the descriptor for an exact USB vendor/product identity.
- matches_
litra - Whether an HID descriptor identifies a supported Litra interface.
- receiver_
display_ name - Human-readable name for a receiver identified by
product_id, used to label it in the inventory. Lightspeed receivers share the Unifying protocol path but are surfaced under their own name. - speaks_
unifying_ protocol - Whether
product_idis a receiver that speaks the Unifying HID++ 1.0 register protocol — a Unifying receiver proper, or a protocol-compatible Nano or Lightspeed receiver. Such receivers are addressed withDeviceRoute::Unifying.