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