Skip to main content

openlogi_device/
lib.rs

1//! OpenLogi's HID++ device layer: everything that knows Logitech's protocol
2//! and nothing about a host.
3//!
4//! [`backend::HidBackend`] is the seam. Above it sits this crate — enumeration
5//! and probing, the write layer, capture sessions, pairing. Below it sits one
6//! implementation per host HID API: `openlogi-hid` over `async-hid`, a
7//! scripted device tree in tests, WebHID under wasm if that is ever built.
8//!
9//! Nothing here opens a device by itself; everything that needs one is handed
10//! a backend. That is what makes the layer reusable, and it is checked rather
11//! than trusted — CI's `wasm (portable crates)` job builds this crate for a
12//! target with no OS underneath it, so a dependency that assumes one fails
13//! there and nowhere else.
14
15#![deny(missing_docs)]
16#![deny(rustdoc::bare_urls)]
17#![deny(rustdoc::broken_intra_doc_links)]
18
19mod channel;
20mod device_io;
21
22pub mod backend;
23pub mod backlight;
24pub mod host_lock;
25pub mod inventory;
26pub mod pairing;
27pub mod replay;
28pub mod reprog_controls;
29pub mod session;
30pub mod thumbwheel;
31pub mod write;
32
33pub use backend::{
34    BackendError, HidBackend, HotplugEvent, HotplugStream, NodeId, NodeInfo, RawWriter,
35};
36pub use backlight::{
37    BacklightChange, BacklightControls, BacklightMode, BacklightState, BacklightStatus,
38};
39pub use channel::route::{
40    DIRECT_DEVICE_INDEX, DeviceRoute, LOGITECH_VENDOR_ID, RECEIVERS, ReceiverBrand,
41    ReceiverDescriptor, ReceiverProtocol, find_receiver, receiver_display_name,
42    speaks_unifying_protocol,
43};
44pub use channel::{ChannelPool, ChannelRegistry, SharedChannel, WeakSharedChannel};
45pub use device_io::{DeviceIoGate, DeviceIoSignal, IoSuspended, device_io_channel};
46pub use inventory::hotplug::watch_hotplug;
47pub use inventory::standalone::enumerate_standalone;
48pub use inventory::{Enumerator, InventoryError, enumerate};
49pub use openlogi_core::hid::FnLockState;
50pub use openlogi_core::hid::smartshift;
51pub use openlogi_core::hid::smartshift::{
52    SmartShiftAutoDisengage, SmartShiftMode, SmartShiftStatus, SmartShiftThreshold, TunableTorque,
53};
54pub use pairing::{
55    Click, DiscoveredDevice, PairingCommand, PairingError, PairingEvent, PairingReceiver,
56    PasskeyMethod, ReceiverFamily, ReceiverSelector, list_pairing_receivers, run_pairing, unpair,
57};
58pub use session::gesture::{
59    CaptureChannelSlot, CaptureError, CaptureHost, CaptureSessionFailure, CaptureSessionOutcome,
60    CaptureSessionStop, CapturedInput, PendingCaptureRestore, run_capture_session,
61};
62pub use session::host_switch::{
63    HostSwitchError, HostSwitchRestoreOutcome, HostSwitchSessionFailure, HostSwitchSessionOutcome,
64    HostSwitchStopReason, PendingHostSwitchRestore, run_host_switch_session, switch_linked_hosts,
65};
66pub use session::keyboard::{
67    RESERVED_KEYBOARD_CONTROLS, is_reserved_keyboard_control, run_keyboard_capture_session,
68};
69pub use write::{
70    Dpi, DpiCapabilities, DpiInfo, EasySwitchHosts, EasySwitchSlot, FeatureEntry, FirmwareEntity,
71    FirmwareEntityInfo, HapticWaveform, HidppFeatureErrorKind, HidppOperation, HostConnection,
72    HostOs, HostOsInfo, HostOsKind, LITRA_BEAM_PRODUCT_ID, LITRA_GLOW_PRODUCT_ID, LightCommand,
73    LightingMethod, LitraDescriptor, LitraModel, OsLayoutOutcome, OsMask, OsVersion, ReportRate,
74    ReportRateInfo, ReprogControlEntry, ScrollReportingTarget, ScrollResolution, ScrollWheelMode,
75    WriteError, apply_litra, commands_for_light_settings, dump_features, dump_firmware_entities,
76    dump_reprog_controls, encode_litra_command, ensure_haptics_armed_on, find_litra, get_backlight,
77    get_backlight_on, get_dpi, get_dpi_info, get_dpi_info_on, get_easy_switch_hosts,
78    get_easy_switch_hosts_on, get_fn_lock, get_fn_lock_on, get_report_rate_info,
79    get_report_rate_info_on, get_scroll_wheel_mode, get_scroll_wheel_mode_on,
80    get_smartshift_status, get_smartshift_status_on, keep_os_layout_on, litra_model_for_route,
81    matches_litra, play_haptic, play_haptic_on, read_battery_raw, rename_easy_switch_host,
82    rename_easy_switch_host_on, set_dpi, set_dpi_on, set_fn_lock, set_fn_lock_on,
83    set_keyboard_color, set_keyboard_color_on, set_keyboard_color_with, set_keyboard_color_with_on,
84    set_report_rate, set_report_rate_on, set_scroll_inversion, set_scroll_inversion_on,
85    set_scroll_resolution, set_scroll_resolution_on, set_scroll_wheel_mode,
86    set_scroll_wheel_mode_on, set_smartshift, set_smartshift_on, set_smartshift_sensitivity,
87    toggle_smartshift, toggle_smartshift_on, update_backlight, update_backlight_on,
88};