Skip to main content

Module hotplug

Module hotplug 

Source
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 receiver
  • DeviceEvent: Enum representing device add/remove events with device identification
  • Uses udev::MonitorBuilder with subsystem filtering for input devices only
  • Blocking udev socket iteration runs in spawn_blocking to 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§

DeviceMonitor
Device hotplug monitor

Enums§

DeviceEvent
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