Expand description
Device Hotplug Detection Module
This module provides udev-based monitoring for input device hotplug events. It detects when devices are added or removed from the system and streams events to the main daemon loop via mpsc channels.
§Architecture
DeviceMonitor: Spawns a blocking udev monitor task and provides an async receiverDeviceEvent: Enum representing device add/remove events with device identification- Uses
udev::MonitorBuilderwith subsystem filtering for input devices only - Blocking udev socket iteration runs in
spawn_blockingto avoid blocking async runtime
§Device ID Format
Device IDs use the “vendor:product” hexadecimal format (e.g., “1532:0220”)
matching the YAML configuration format and DeviceManager::format_device_id().
Structs§
- Device
Monitor - Device hotplug monitor
Enums§
- Device
Event - Device hotplug event
Functions§
- format_
device_ id - Format a device identifier from vendor and product IDs
- handle_
device_ add - Handle device addition - restore LED state if available
- handle_
device_ remove - Handle device removal - preserve LED state in memory