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