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::{BacklightMode, BacklightState, BacklightStatus};
37pub use channel::route::{
38    DIRECT_DEVICE_INDEX, DeviceRoute, LOGITECH_VENDOR_ID, RECEIVERS, ReceiverBrand,
39    ReceiverDescriptor, ReceiverProtocol, find_receiver, receiver_display_name,
40    speaks_unifying_protocol,
41};
42pub use channel::{ChannelPool, ChannelRegistry, SharedChannel};
43pub use device_io::{DeviceIoGate, DeviceIoSignal, IoSuspended, device_io_channel};
44pub use inventory::hotplug::watch_hotplug;
45pub use inventory::standalone::enumerate_standalone;
46pub use inventory::{Enumerator, InventoryError, enumerate};
47pub use openlogi_core::hid::FnLockState;
48pub use openlogi_core::hid::smartshift;
49pub use openlogi_core::hid::smartshift::{
50    SmartShiftAutoDisengage, SmartShiftMode, SmartShiftStatus, SmartShiftThreshold, TunableTorque,
51};
52pub use pairing::{
53    Click, DiscoveredDevice, PairingCommand, PairingError, PairingEvent, PairingReceiver,
54    PasskeyMethod, ReceiverFamily, ReceiverSelector, list_pairing_receivers, run_pairing, unpair,
55};
56pub use session::gesture::{
57    CaptureChannelSlot, CaptureError, CaptureHost, CaptureSessionFailure, CaptureSessionOutcome,
58    CapturedInput, PendingCaptureRestore, run_capture_session,
59};
60pub use session::host_switch::{
61    HostSwitchError, HostSwitchRestoreOutcome, HostSwitchSessionFailure, HostSwitchSessionOutcome,
62    HostSwitchStopReason, PendingHostSwitchRestore, run_host_switch_session, switch_linked_hosts,
63};
64pub use session::keyboard::{
65    RESERVED_KEYBOARD_CONTROLS, is_reserved_keyboard_control, run_keyboard_capture_session,
66};
67pub use write::{
68    Dpi, DpiCapabilities, DpiInfo, FeatureEntry, FirmwareEntity, FirmwareEntityInfo,
69    HapticWaveform, HidppFeatureErrorKind, HidppOperation, LITRA_BEAM_PRODUCT_ID,
70    LITRA_GLOW_PRODUCT_ID, LightCommand, LightingMethod, LitraDescriptor, LitraModel,
71    ReprogControlEntry, ScrollReportingTarget, ScrollResolution, ScrollWheelMode, WriteError,
72    apply_litra, commands_for_light_settings, dump_features, dump_firmware_entities,
73    dump_reprog_controls, encode_litra_command, ensure_haptics_armed_on, find_litra, get_backlight,
74    get_backlight_on, get_dpi, get_dpi_info, get_dpi_info_on, get_fn_lock, get_fn_lock_on,
75    get_scroll_wheel_mode, get_scroll_wheel_mode_on, get_smartshift_status,
76    get_smartshift_status_on, litra_model_for_route, matches_litra, play_haptic, play_haptic_on,
77    read_battery_raw, set_backlight_enabled, set_dpi, set_dpi_on, set_fn_lock, set_fn_lock_on,
78    set_keyboard_color, set_keyboard_color_on, set_keyboard_color_with, set_keyboard_color_with_on,
79    set_scroll_inversion, set_scroll_inversion_on, set_scroll_resolution, set_scroll_resolution_on,
80    set_scroll_wheel_mode, set_scroll_wheel_mode_on, set_smartshift, set_smartshift_on,
81    set_smartshift_sensitivity, toggle_smartshift, toggle_smartshift_on,
82};